Add Truncate method #2220

Merged
lunny merged 4 commits from KN4CK3R/xorm:feature-truncate into master 2023-02-19 23:17:36 +00:00
2 changed files with 2 additions and 0 deletions
Showing only changes of commit da09ed8cb0 - Show all commits

View File

@ -1241,6 +1241,7 @@ func (engine *Engine) Delete(beans ...interface{}) (int64, error) {
}
// Truncate records, bean's non-empty fields are conditions
// In contrast to Delete this method allows deletes without conditions.
func (engine *Engine) Truncate(beans ...interface{}) (int64, error) {
session := engine.NewSession()
defer session.Close()

View File

@ -97,6 +97,7 @@ func (session *Session) Delete(beans ...interface{}) (int64, error) {
}
// Truncate records, bean's non-empty fields are conditions
// In contrast to Delete this method allows deletes without conditions.
func (session *Session) Truncate(beans ...interface{}) (int64, error) {
return session.delete(beans, false)
}