Documentation
¶
Index ¶
- func NewDBClient(configPath string, opts ...gorm.Option) *gorm.DB
- func ToGormScopes(scopes []Scope) []func(db *gorm.DB) *gorm.DB
- func ToMap(maps []Map) map[string]interface{}
- type BaseRepo
- func (b *BaseRepo[T]) Create(ctx context.Context, t *T, tx ...*gorm.DB) error
- func (b *BaseRepo[T]) CreateInBatches(ctx context.Context, ts []*T, batchSize int, tx ...*gorm.DB) error
- func (b *BaseRepo[T]) GetByScopes(ctx context.Context, scopes []Scope, tx ...*gorm.DB) (*T, error)
- func (b *BaseRepo[T]) GetCountByScopes(ctx context.Context, scopes []Scope, tx ...*gorm.DB) (int64, error)
- func (b *BaseRepo[T]) GetListByScopes(ctx context.Context, scopes []Scope, tx ...*gorm.DB) ([]*T, error)
- func (b *BaseRepo[T]) GetRDB(tx ...*gorm.DB) *gorm.DB
- func (b *BaseRepo[T]) GetRwDB(tx ...*gorm.DB) *gorm.DB
- func (b *BaseRepo[T]) MapExprAdd(k string, v interface{}) Map
- func (b *BaseRepo[T]) MapExprSub(k string, v interface{}) Map
- func (b *BaseRepo[T]) MapKV(k string, v interface{}) Map
- func (b *BaseRepo[T]) SaveByScopes(ctx context.Context, t *T, scopes []Scope, tx ...*gorm.DB) error
- func (b *BaseRepo[T]) ScopeBetween(k string, v1, v2 interface{}) Scope
- func (b *BaseRepo[T]) ScopeEqual(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeGT(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeGTE(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeIN(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeInnerJoin(joinTable string, onTableFiled, onJoinTableField string) Scope
- func (b *BaseRepo[T]) ScopeLT(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeLTE(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeLeftJoin(joinTable string, onTableFiled, onJoinTableField string) Scope
- func (b *BaseRepo[T]) ScopeLike(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeLimit(v int) Scope
- func (b *BaseRepo[T]) ScopeNotEqual(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeNotIN(k string, v interface{}) Scope
- func (b *BaseRepo[T]) ScopeOffset(v int) Scope
- func (b *BaseRepo[T]) ScopeOrderBy(k, expr string) Scope
- func (b *BaseRepo[T]) Transaction(f func(tx *gorm.DB) error) error
- func (b *BaseRepo[T]) UpdateByScopesAndMaps(ctx context.Context, scopes []Scope, maps []Map, tx ...*gorm.DB) (int64, error)
- type ICreator
- type IGetter
- type ITx
- type IUpdater
- type Map
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDBClient ¶
NewDBClient ...
Types ¶
type BaseRepo ¶
func NewBaseRepo ¶
NewBaseRepo ...
func (*BaseRepo[T]) CreateInBatches ¶
func (b *BaseRepo[T]) CreateInBatches(ctx context.Context, ts []*T, batchSize int, tx ...*gorm.DB) error
CreateInBatches ...
func (*BaseRepo[T]) GetByScopes ¶
GetByScopes ...
func (*BaseRepo[T]) GetCountByScopes ¶
func (b *BaseRepo[T]) GetCountByScopes(ctx context.Context, scopes []Scope, tx ...*gorm.DB) (int64, error)
GetCountByScopes ...
func (*BaseRepo[T]) GetListByScopes ¶
func (b *BaseRepo[T]) GetListByScopes(ctx context.Context, scopes []Scope, tx ...*gorm.DB) ([]*T, error)
GetListByScopes ...
func (*BaseRepo[T]) MapExprAdd ¶
MapExprAdd ...
func (*BaseRepo[T]) MapExprSub ¶
MapExprSub ...
func (*BaseRepo[T]) SaveByScopes ¶
SaveByScopes ...
func (*BaseRepo[T]) ScopeBetween ¶
ScopeBetween ...
func (*BaseRepo[T]) ScopeEqual ¶
ScopeEqual ...
func (*BaseRepo[T]) ScopeInnerJoin ¶
ScopeInnerJoin ...
func (*BaseRepo[T]) ScopeLeftJoin ¶
ScopeLeftJoin ...
func (*BaseRepo[T]) ScopeNotEqual ¶
ScopeNotEqual ...
func (*BaseRepo[T]) ScopeNotIN ¶
ScopeNotIN ...
func (*BaseRepo[T]) ScopeOrderBy ¶
ScopeOrderBy expr: ASC、DESC、>=0、<= 0 ...
func (*BaseRepo[T]) Transaction ¶
Transaction ...
Click to show internal directories.
Click to hide internal directories.