Documentation ¶
Index ¶
- func AnyToInt(in any) (iVal int, err error)
- func AnyToString(val any) (str string, err error)
- func IsEmpty(val any) bool
- type Criteria
- func (c *Criteria) AddPreload(name string, args ...any) *Criteria
- func (c *Criteria) GetLimit() int
- func (c *Criteria) GetOffset() int
- func (c *Criteria) GetPage() int
- func (c *Criteria) GetPerPage() int
- func (c *Criteria) Group(query string) *Criteria
- func (c *Criteria) GroupOr(group groupConditionSpec) *Criteria
- func (c *Criteria) Having(query any, values ...any) *Criteria
- func (c *Criteria) Joins(query string, values ...any) *Criteria
- func (c *Criteria) Limit(limit int) *Criteria
- func (c *Criteria) Offset(offset int) *Criteria
- func (c *Criteria) OrWhere(query any, values ...any) *Criteria
- func (c *Criteria) Order(value string, isDescending bool) *Criteria
- func (c *Criteria) OrderAsc(value string) *Criteria
- func (c *Criteria) OrderDesc(value string) *Criteria
- func (c *Criteria) Page(page int) *Criteria
- func (c *Criteria) PerPage(perPage int) *Criteria
- func (c *Criteria) Where(query any, values ...any) *Criteria
- func (c *Criteria) WhereBetween(field string, start, end any) *Criteria
- func (c *Criteria) WhereIn(field string, values any) *Criteria
- func (c *Criteria) WhereIsNull(field string) *Criteria
- func (c *Criteria) WhereNot(query any, values ...any) *Criteria
- func (c *Criteria) WhereNotIn(field string, values any) *Criteria
- func (c *Criteria) WhereNotNull(field string) *Criteria
- type GormStore
- func (r *GormStore[M]) AddPreload(name string, args ...any) *GormStore[M]
- func (r *GormStore[M]) All(ctx context.Context) ([]M, error)
- func (r *GormStore[M]) Avg(ctx context.Context, column string, criteria *Criteria) (avg float64, err error)
- func (r *GormStore[M]) Columns(fields []string) *GormStore[M]
- func (r *GormStore[M]) Count(ctx context.Context, criteria *Criteria) (i int64, err error)
- func (r *GormStore[M]) Create(ctx context.Context, model *M) *gorm.DB
- func (r *GormStore[M]) CreateInBatches(ctx context.Context, models []M, batchSize int) *gorm.DB
- func (r *GormStore[M]) Creates(ctx context.Context, models []M) *gorm.DB
- func (r *GormStore[M]) Delete(ctx context.Context, model *M) *gorm.DB
- func (r *GormStore[M]) DeleteById(ctx context.Context, id any) *gorm.DB
- func (r *GormStore[M]) Deletes(ctx context.Context, criteria *Criteria) *gorm.DB
- func (r *GormStore[M]) Emit(fields []string) *GormStore[M]
- func (r *GormStore[M]) Exists(ctx context.Context, criteria *Criteria) (bool, error)
- func (r *GormStore[M]) Find(ctx context.Context, criteria *Criteria) ([]M, error)
- func (r *GormStore[M]) FindByID(ctx context.Context, id any) (*M, error)
- func (r *GormStore[M]) FindByIDs(ctx context.Context, ids []int64) ([]M, error)
- func (r *GormStore[M]) FindInBatches(ctx context.Context, models *[]M, batchSize int, ...) error
- func (r *GormStore[M]) First(ctx context.Context, criteria *Criteria) (*M, error)
- func (r *GormStore[M]) Hidden(fields []string) *GormStore[M]
- func (r *GormStore[M]) Insert(ctx context.Context, model *M) *gorm.DB
- func (r *GormStore[M]) Paginate(ctx context.Context, criteria *Criteria) (*Pagination[M], error)
- func (r *GormStore[M]) Pluck(ctx context.Context, column string, dest any, criteria *Criteria) error
- func (r *GormStore[M]) Save(ctx context.Context, model M) *gorm.DB
- func (r *GormStore[M]) ScopeClosure(closure gormClosure) *GormStore[M]
- func (r *GormStore[M]) SetTx(tx *gorm.DB) *GormStore[M]
- func (r *GormStore[M]) Sum(ctx context.Context, column string, criteria *Criteria) (sum float64, err error)
- func (r *GormStore[M]) Unscoped() *GormStore[M]
- func (r *GormStore[M]) Update(ctx context.Context, column string, value interface{}, criteria *Criteria) *gorm.DB
- func (r *GormStore[M]) UpdateById(ctx context.Context, id any, column string, value interface{}) *gorm.DB
- func (r *GormStore[M]) Updates(ctx context.Context, attributes any, criteria *Criteria) *gorm.DB
- func (r *GormStore[M]) UpdatesById(ctx context.Context, id any, updates interface{}) *gorm.DB
- func (r *GormStore[M]) WithTrashed(with bool) *GormStore[M]
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyToString ¶
Types ¶
type Criteria ¶
type Criteria struct {
// contains filtered or unexported fields
}
func ExtractCriteria ¶
ExtractCriteria 从结构体导出 Criteria
func NewCriteria ¶
func NewCriteria() *Criteria
func (*Criteria) AddPreload ¶ added in v0.7.0
func (*Criteria) GetPerPage ¶
func (*Criteria) WhereBetween ¶
func (*Criteria) WhereIsNull ¶
func (*Criteria) WhereNotNull ¶
type GormStore ¶
type GormStore[M interface{}] struct {
// contains filtered or unexported fields
}
func (*GormStore[M]) AddPreload ¶
func (*GormStore[M]) Avg ¶
func (r *GormStore[M]) Avg(ctx context.Context, column string, criteria *Criteria) (avg float64, err error)
Avg Retrieve the average of the values of a given column.
func (*GormStore[M]) CreateInBatches ¶
func (*GormStore[M]) DeleteById ¶
func (*GormStore[M]) FindInBatches ¶ added in v0.6.8
func (r *GormStore[M]) FindInBatches(ctx context.Context, models *[]M, batchSize int, fc func(tx *gorm.DB, batch int) error, criteria *Criteria) error
FindInBatches finds all records in batches of batchSize
func (*GormStore[M]) ScopeClosure ¶
func (*GormStore[M]) Sum ¶
func (r *GormStore[M]) Sum(ctx context.Context, column string, criteria *Criteria) (sum float64, err error)
Sum Retrieve the sum of the values of a given column.
func (*GormStore[M]) UpdateById ¶ added in v0.7.10
func (*GormStore[M]) UpdatesById ¶ added in v0.7.10
func (*GormStore[M]) WithTrashed ¶ added in v0.7.11
Click to show internal directories.
Click to hide internal directories.