Explorar o código

新增基础操作

rdluck %!s(int64=4) %!d(string=hai) anos
pai
achega
523c7b8c52
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      models/db_base.go

+ 2 - 1
models/db_base.go

@@ -50,7 +50,8 @@ func DeleteByExpr(ptrStructOrTableName interface{}, where map[string]interface{}
 }
 
 // 插入
-func InsertData(o orm.Ormer, ptrStructOrTableName interface{}) error {
+func InsertData(ptrStructOrTableName interface{}) error {
+	o := orm.NewOrm()
 	_, err := o.Insert(ptrStructOrTableName)
 	return err
 }