Documentation ¶
Index ¶
- func Count[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper) (int64, error)
- func Default() *gorm.DB
- func Get(name string)
- func GetById[T IBaseModel](db *gorm.DB, id interface{}) (T, error)
- func List[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper) ([]T, error)
- func ListById[T IBaseModel](db *gorm.DB, ids []interface{}) ([]T, error)
- func Save[T IBaseModel](db *gorm.DB, t T) (T, error)
- func Sqlite(config SqliteConfig) (*gorm.DB, error)
- func Start(viper *viper.Viper) error
- func Update[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper, t T) error
- func UpdateById[T IBaseModel](db *gorm.DB, t T) error
- type Config
- type CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Between(column string, value1, value2 interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Eq(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Ge(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Gt(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) IsNotNull(column string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) IsNull(column string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Le(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Like(column string, value string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) LikeLeft(column string, value string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) LikeRight(column string, value string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Lt(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Ne(column string, value interface{}) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Nest(nest NestFunc)
- func (criteriaWrapper CriteriaWrapper) Omit(cols []string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Or() CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) OrderByAsc(column string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) OrderByDesc(column string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) Select(cols []string) CriteriaWrapper
- func (criteriaWrapper CriteriaWrapper) ToCriteria() string
- func (criteriaWrapper CriteriaWrapper) ToOrder() string
- type IBaseModel
- type MysqlConfig
- type NestFunc
- type PageModel
- type SqliteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
func Count[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper) (int64, error)
Count 获取数据总数
func ListById ¶
func ListById[T IBaseModel](db *gorm.DB, ids []interface{}) ([]T, error)
ListById 根据id获取多条数据
func Update ¶
func Update[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper, t T) error
Types ¶
type Config ¶
type Config struct {
Mysql MysqlConfig
}
type CriteriaWrapper ¶
type CriteriaWrapper struct {
// contains filtered or unexported fields
}
func BuildCriteriaWrapper ¶
func BuildCriteriaWrapper() CriteriaWrapper
func (CriteriaWrapper) Between ¶
func (criteriaWrapper CriteriaWrapper) Between(column string, value1, value2 interface{}) CriteriaWrapper
func (CriteriaWrapper) Eq ¶
func (criteriaWrapper CriteriaWrapper) Eq(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) Ge ¶
func (criteriaWrapper CriteriaWrapper) Ge(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) Gt ¶
func (criteriaWrapper CriteriaWrapper) Gt(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) IsNotNull ¶
func (criteriaWrapper CriteriaWrapper) IsNotNull(column string) CriteriaWrapper
func (CriteriaWrapper) IsNull ¶
func (criteriaWrapper CriteriaWrapper) IsNull(column string) CriteriaWrapper
func (CriteriaWrapper) Le ¶
func (criteriaWrapper CriteriaWrapper) Le(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) Like ¶
func (criteriaWrapper CriteriaWrapper) Like(column string, value string) CriteriaWrapper
func (CriteriaWrapper) LikeLeft ¶
func (criteriaWrapper CriteriaWrapper) LikeLeft(column string, value string) CriteriaWrapper
func (CriteriaWrapper) LikeRight ¶
func (criteriaWrapper CriteriaWrapper) LikeRight(column string, value string) CriteriaWrapper
func (CriteriaWrapper) Lt ¶
func (criteriaWrapper CriteriaWrapper) Lt(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) Ne ¶
func (criteriaWrapper CriteriaWrapper) Ne(column string, value interface{}) CriteriaWrapper
func (CriteriaWrapper) Nest ¶
func (criteriaWrapper CriteriaWrapper) Nest(nest NestFunc)
func (CriteriaWrapper) Omit ¶
func (criteriaWrapper CriteriaWrapper) Omit(cols []string) CriteriaWrapper
func (CriteriaWrapper) Or ¶
func (criteriaWrapper CriteriaWrapper) Or() CriteriaWrapper
func (CriteriaWrapper) OrderByAsc ¶
func (criteriaWrapper CriteriaWrapper) OrderByAsc(column string) CriteriaWrapper
func (CriteriaWrapper) OrderByDesc ¶
func (criteriaWrapper CriteriaWrapper) OrderByDesc(column string) CriteriaWrapper
func (CriteriaWrapper) Select ¶
func (criteriaWrapper CriteriaWrapper) Select(cols []string) CriteriaWrapper
func (CriteriaWrapper) ToCriteria ¶
func (criteriaWrapper CriteriaWrapper) ToCriteria() string
func (CriteriaWrapper) ToOrder ¶
func (criteriaWrapper CriteriaWrapper) ToOrder() string
type IBaseModel ¶
type IBaseModel interface {
TableName() string
}
type MysqlConfig ¶
type NestFunc ¶
type NestFunc = func(wrapper CriteriaWrapper) CriteriaWrapper
type PageModel ¶
type PageModel[T IBaseModel] struct { // contains filtered or unexported fields }
func Page ¶
func Page[T IBaseModel](db *gorm.DB, wrapper CriteriaWrapper, page, size int) (*PageModel[T], error)
Page 分页
type SqliteConfig ¶
Click to show internal directories.
Click to hide internal directories.