Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRecordRepeat = errors.New("数据已经存在") ErrDateBusy = errors.New("数据在使用") )
View Source
var ( // Conf All 配置 Conf *conf.Config // CacheLocal // 1.一级缓存 变动小、容量少。容量固定,有淘汰策略。 // 2.不适合分布式数据共享。 CacheLocal *cache.Cache // CacheDB 二级缓存 容量大,有网络IO延迟 CacheDB redis.Cmdable // DB gorm 关系型数据库 -- 持久化 DB *gorm.DB )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Inner error Text string // 业务错误信息,通常是中文提示,返回给客户端 StackTrace string Misc map[string]any // miscellaneous(各种各样) information }
Error 自定义错误
type FindByIDService ¶ added in v0.0.6
type FindByIDService[T any] struct{}
type UniqueService ¶ added in v0.0.6
type UniqueService[T any] struct{}
UniqueService 校验传入值是否已经在数据库中存在 T 表示要查询表的Model k为 'id' 作为排除,比如更新时
type UserService struct{ g.Unique[model.User] }
Click to show internal directories.
Click to hide internal directories.