From 206de7b046c41f213aecbba5c4d69dacc33c5efa Mon Sep 17 00:00:00 2001 From: xxj <346944475@qq.com> Date: Wed, 29 Sep 2021 21:22:23 +0800 Subject: [PATCH] add Reset support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加重置会话函数Reset --- data/view/genfunc/def.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/view/genfunc/def.go b/data/view/genfunc/def.go index fe5edf3..13b73f0 100755 --- a/data/view/genfunc/def.go +++ b/data/view/genfunc/def.go @@ -195,6 +195,12 @@ func (obj *_{{$obj.StructName}}Mgr) GetTableName() string { return "{{GetTablePrefixName $obj.TableName}}" } +// Reset 重置gorm会话 +func (obj *_{{$obj.StructName}}Mgr) Reset() *_{{$obj.StructName}}Mgr { + obj.New() + return obj +} + // Get 获取 func (obj *_{{$obj.StructName}}Mgr) Get() (result {{$obj.StructName}}, err error) { err = obj.DB.WithContext(obj.ctx).Model({{$obj.StructName}}{}).Find(&result).Error