Documentation ¶
Index ¶
- func Count[TBase any](orm Orm, maps map[string]interface{}) (count int64)
- func CreateOne[TBase, TFormat any](orm Orm, data TBase) (info TFormat)
- func CreateOneSimp[TBase any](orm Orm, data TBase) TBase
- func Delete[Tm any](orm Orm, uc UpdateConfig) (err error)
- func Format[T any](info T) T
- func FormatList(originList interface{}, formatFunc interface{}) []interface{}
- func FormatListSimp[TBase, TFormat any](baseList []TBase, formatEvery bool) []TFormat
- func GetList[TBase, TFormat any](orm Orm, c ListConfig) []TFormat
- func GetListSimp[TBase any](orm Orm, c ListConfig) []TBase
- func GetOne[TBase, TFormat any](orm Orm, where map[string]interface{}) (info TFormat)
- func GetOneSimp[TBase any](orm Orm, where map[string]interface{}) (info TBase)
- func KeyList(originList interface{}, key string) []interface{}
- func Update[Tm, Tf any](orm Orm, uc UpdateConfig, SetFunc func(info Tm) (Tm, error)) (info2 Tf, err error)
- func UpdateOne[TFormat, TBase any](orm Orm, data TBase) (info TFormat)
- func UpdateOneSimp[TBase any](orm Orm, data TBase) TBase
- type BaseModel
- type BaseModelOnlyId
- type BaseModelWithoutDeletedAt
- type BaseModelWithoutDeletedCreatedAt
- type BaseModelWithoutDeletedUpdatedAt
- type FilterConfig
- type IBaseModel
- type ListConfig
- type MysqlConfig
- type Orm
- func (o Orm) Begin() Orm
- func (o Orm) ClearTempData() Orm
- func (o Orm) Commit()
- func (o Orm) Count(list interface{}, maps map[string]interface{}) (count int64)
- func (o Orm) Debug() Orm
- func (o Orm) Delete(info interface{})
- func (o Orm) Find(list interface{}, maps map[string]interface{})
- func (o Orm) FindPage(pageSize int, page int, list interface{}, maps map[string]interface{}) PageInfo
- func (o Orm) First(info interface{}, maps map[string]interface{})
- func (o Orm) GetInfo(info interface{}, id int64) error
- func (o Orm) GetInfoByKey(info interface{}, key string, value interface{})
- func (o Orm) GetInfoByKeyLike(info interface{}, key string, value interface{})
- func (o Orm) In(key string, values []interface{}) Orm
- func (o Orm) Joins(query string, args ...interface{}) Orm
- func (o Orm) Limit(limit int) Orm
- func (o Orm) Order(v interface{}) Orm
- func (o Orm) Original(f func(*gorm.DB) *gorm.DB) Orm
- func (o Orm) Rollback()
- func (o Orm) Save(info interface{}) error
- func (o Orm) Select(fields string) Orm
- func (o Orm) SetDefaultOrder(s string) Orm
- func (o Orm) Table(name string, args ...interface{}) Orm
- func (o Orm) Unscoped() Orm
- func (o Orm) Where(maps map[string]interface{}) Orm
- type PageInfo
- type PageResult
- type RedisConfig
- type UpdateConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOneSimp ¶
func FormatList ¶
func FormatList(originList interface{}, formatFunc interface{}) []interface{}
FormatList 格式化列表
func FormatListSimp ¶
func GetList ¶
func GetList[TBase, TFormat any](orm Orm, c ListConfig) []TFormat
GetList 简单获取查询DB格式化后的列表
func GetListSimp ¶
func GetListSimp[TBase any](orm Orm, c ListConfig) []TBase
func GetOneSimp ¶
func KeyList ¶
func KeyList(originList interface{}, key string) []interface{}
KeyList 获取list中指定key数组
func Update ¶
func Update[Tm, Tf any](orm Orm, uc UpdateConfig, SetFunc func(info Tm) (Tm, error)) (info2 Tf, err error)
func UpdateOneSimp ¶
Types ¶
type BaseModelOnlyId ¶
type BaseModelOnlyId struct {
Id int64 `gorm:"primary_key"`
}
type FilterConfig ¶
type IBaseModel ¶
type IBaseModel interface {
Format() interface{}
}
type ListConfig ¶
type ListConfig struct { Filter map[string]interface{} FilterConfig FilterConfig FormatEvery bool }
type MysqlConfig ¶
type MysqlConfig struct { DBAddress string `yaml:"DBAddress" json:"DBAddress"` DBUserName string `yaml:"DBUserName" json:"DBUserName"` DBPassword string `yaml:"DBPassword" json:"DBPassword"` DBDatabaseName string `yaml:"DBDatabaseName" json:"DBDatabaseName"` DBTablePrefix string `yaml:"DBTablePrefix" json:"DBTablePrefix"` DBMaxOpenConns int `yaml:"DBMaxOpenConns" json:"DBMaxOpenConns"` DBMaxIdleConns int `yaml:"DBMaxIdleConns" json:"DBMaxIdleConns"` DBMaxLifeTime int64 `yaml:"DBMaxLifeTime" json:"DBMaxLifeTime"` SingularTable bool `yaml:"SingularTable" json:"SingularTable"` }
type Orm ¶
type Orm struct { // gorm实例 GormDb *gorm.DB // 默认排序方式 DefaultOrder string // contains filtered or unexported fields }
func (Orm) ClearTempData ¶
func (Orm) FindPage ¶
func (o Orm) FindPage(pageSize int, page int, list interface{}, maps map[string]interface{}) PageInfo
FindPage 查询记录列表
func (Orm) GetInfoByKey ¶
GetInfoByKey 通过指定的key、value获取数据
func (Orm) GetInfoByKeyLike ¶
GetInfoByKeyLike 通过模糊匹配获取数据
func (Orm) SetDefaultOrder ¶
type PageResult ¶
type PageResult struct { List interface{} `json:"list"` PageInfo PageInfo `json:"page_info"` }
func FindPage ¶
func FindPage[TBase, TFormat any](o Orm, pageSize int, pageStr interface{}, c *ListConfig) PageResult
FindPage 查询记录列表
type RedisConfig ¶
type UpdateConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.