add model

添加model支持
This commit is contained in:
xxj
2021-06-02 17:08:57 +08:00
parent 26254de0d8
commit 96794856b6
3 changed files with 23 additions and 2 deletions

View File

@@ -122,7 +122,7 @@ func {{$obj.StructName}}Mgr(db *gorm.DB) *_{{$obj.StructName}}Mgr {
panic(fmt.Errorf("{{$obj.StructName}}Mgr need init by db"))
}
ctx, cancel := context.WithCancel(context.Background())
return &_{{$obj.StructName}}Mgr{_BaseMgr: &_BaseMgr{DB: db.Table("{{GetTablePrefixName $obj.TableName}}"), isRelated: globalIsRelated,ctx:ctx,cancel:cancel,timeout:-1}}
return &_{{$obj.StructName}}Mgr{_BaseMgr: &_BaseMgr{DB: db.Model({{$obj.StructName}}{}), isRelated: globalIsRelated,ctx:ctx,cancel:cancel,timeout:-1}}
}
// GetTableName get sql table name.获取数据库名字