Documentation ¶
Index ¶
- func NotFoundReturnNil(o *Options)
- type CommonManager
- func (cm *CommonManager) AddSets(name string) error
- func (cm *CommonManager) Delete(key string) error
- func (cm *CommonManager) Get(key string, keyObj interface{}) error
- func (cm *CommonManager) List(filters map[string]interface{}) ([]map[string]string, error)
- func (cm *CommonManager) PrimaryKey(key string) string
- func (cm *CommonManager) Save(key string, keyObj interface{}, expire time.Duration, sets bool) error
- func (cm *CommonManager) SetsKey() string
- func (cm *CommonManager) Update(key string, keyObj interface{}, expire time.Duration, sets bool) error
- type OptionFunc
- type Options
- type Pagination
- type PaginationCondition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotFoundReturnNil ¶
func NotFoundReturnNil(o *Options)
Types ¶
type CommonManager ¶
type CommonManager struct { Client *redis.Client DB *gorm.DB ModelKey string context.Context // contains filtered or unexported fields }
func NewCommonManager ¶
func NewCommonManager(redisClient *redis.Client, db *gorm.DB, key string, watch bool) *CommonManager
func (*CommonManager) AddSets ¶
func (cm *CommonManager) AddSets(name string) error
func (*CommonManager) Delete ¶
func (cm *CommonManager) Delete(key string) error
func (*CommonManager) Get ¶
func (cm *CommonManager) Get(key string, keyObj interface{}) error
func (*CommonManager) List ¶
func (cm *CommonManager) List(filters map[string]interface{}) ([]map[string]string, error)
func (*CommonManager) PrimaryKey ¶
func (cm *CommonManager) PrimaryKey(key string) string
func (*CommonManager) SetsKey ¶
func (cm *CommonManager) SetsKey() string
type OptionFunc ¶
type OptionFunc func(o *Options)
type Options ¶
type Options struct { // Get未找到数据时,返回nil NotFoundReturnNil bool }
func GetOptions ¶
func GetOptions(opfs []OptionFunc) *Options
type Pagination ¶
type Pagination struct { PageSize int64 `json:"page_size"` PageNo int64 `json:"page_no"` Pages int64 `json:"pages"` Records int64 `json:"records"` Offset int64 `json:"-"` Limit int64 `json:"-"` }
func NewPagination ¶
func NewPagination(pageSize int64, pageNo int64, records int64) *Pagination
NewPagination 创建分页对象
func NewPaginationFromDb ¶
func NewPaginationFromDb(tx *gorm.DB, modelType schema.Tabler, modelList interface{}, cond PaginationCondition) (*Pagination, error)
NewPaginationFromDb 通过查询数据库创建分页对象
type PaginationCondition ¶
Click to show internal directories.
Click to hide internal directories.