diff --git a/orm.go b/orm.go index 2b81233..48fb1b8 100644 --- a/orm.go +++ b/orm.go @@ -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) diff --git a/orm_interface.go b/orm_interface.go index 4c32513..c0f9094 100644 --- a/orm_interface.go +++ b/orm_interface.go @@ -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{})