Update def.go
This commit is contained in:
@@ -19,6 +19,7 @@ var {{.StructName}}Columns = struct { {{range $em := .Em}}
|
||||
package {{.PackageName}}
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -27,6 +28,11 @@ import (
|
||||
|
||||
var globalIsRelated bool = true // 全局预加载
|
||||
|
||||
// IsNotFound ErrRecordNotFound
|
||||
func IsNotFound(err error) bool {
|
||||
return errors.Is(err, gorm.ErrRecordNotFound)
|
||||
}
|
||||
|
||||
// prepare for other
|
||||
type _BaseMgr struct {
|
||||
*gorm.DB
|
||||
@@ -89,6 +95,11 @@ func (obj *_BaseMgr) NewDB() *gorm.DB {
|
||||
return obj.DB.Session(&gorm.Session{NewDB: true, Context: obj.ctx})
|
||||
}
|
||||
|
||||
// IsNotFound ErrRecordNotFound
|
||||
func (obj *_BaseMgr) IsNotFound(err error) bool {
|
||||
return errors.Is(err, gorm.ErrRecordNotFound)
|
||||
}
|
||||
|
||||
type options struct {
|
||||
query map[string]interface{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user