Skip to content

Commit

Permalink
新增tuncate方法
Browse files Browse the repository at this point in the history
  • Loading branch information
tobycroft committed Oct 1, 2021
1 parent 221b4e8 commit 65bf07e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ func (dba *Orm) OrWhereNotBetween(needle string, hystack []interface{}) IOrm {
return dba.OrWhere(needle, "NOT BETWEEN", hystack)
}

// Truncate ...
func (dba *Orm) Truncate() (err error) {
dba.table, err = dba.GetISession().GetTableName()
if err != nil {
dba.GetISession().GetIEngin().GetLogger().Error(err.Error())
return
}
_, err = dba.Execute("TRUNCATE " + dba.table)
return
}

// Join : select join query
func (dba *Orm) Join(args ...interface{}) IOrm {
dba._joinBuilder("INNER", args)
Expand Down
2 changes: 1 addition & 1 deletion orm_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type IOrm interface {
WhereNotBetween(needle string, hystack []interface{}) IOrm
OrWhereNotBetween(needle string, hystack []interface{}) IOrm
// truncate
//Truncate()
Truncate() error
GetDriver() string
//GetIBinder() IBinder
SetBindValues(v interface{})
Expand Down

0 comments on commit 65bf07e

Please sign in to comment.