Documentation ¶
Index ¶
- Variables
- func Find[T any](db *gdb.Model, orderBy []sys_model.OrderBy, ...) (response *sys_model.CollectRes[T], err error)
- func Get[T any](model *gdb.Model) *T
- func GetAll[T any](db *gdb.Model, info *sys_model.Pagination) (response *sys_model.CollectRes[*T], err error)
- func GetById[T any](model *gdb.Model, id int64) *T
- func GetByIdWithError[T any](model *gdb.Model, id int64) (*T, error)
- func GetWithError[T any](model *gdb.Model) (*T, error)
- func Query[T any](db *gdb.Model, searchFields *sys_model.SearchParams, IsExport bool) (response *sys_model.CollectRes[T], err error)
- func RemoveQueryCache(db gdb.DB, prefix string)
Constants ¶
This section is empty.
Variables ¶
View Source
var CacheHookHandler = gdb.HookHandler{ Update: cleanCache[gdb.HookUpdateInput], Insert: cleanCache[gdb.HookInsertInput], Delete: cleanCache[gdb.HookDeleteInput], Select: func(ctx context.Context, in *gdb.HookSelectInput) (result gdb.Result, err error) { conf := gdb.CacheOption{ Duration: time.Hour * 24, Name: in.Table, Force: false, } table := gstr.Replace(in.Table, "\"", "") for _, cacheConf := range sys_consts.Global.OrmCacheConf { if cacheConf.TableName == table { conf.Duration = time.Second * (time.Duration)(cacheConf.ExpireSeconds) conf.Force = cacheConf.Force } } in.Model.Cache(conf) result, err = in.Next(ctx) return }, }
Functions ¶
func Find ¶
func Find[T any](db *gdb.Model, orderBy []sys_model.OrderBy, searchFields ...sys_model.FilterInfo) (response *sys_model.CollectRes[T], err error)
func GetAll ¶
func GetAll[T any](db *gdb.Model, info *sys_model.Pagination) (response *sys_model.CollectRes[*T], err error)
func GetByIdWithError ¶ added in v0.2.48
func Query ¶
func Query[T any](db *gdb.Model, searchFields *sys_model.SearchParams, IsExport bool) (response *sys_model.CollectRes[T], err error)
func RemoveQueryCache ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.