Versions in this module Expand all Collapse all v0 v0.0.4 Jul 9, 2022 Changes in this version + const ConcurrentUpdateCode + const DefaultSlowThreshold + var ErrConcurrency = kerrors.Conflict(ConcurrentUpdateCode, "") + func BuildBooleanFilter(field string, filter *query.BooleanFilterOperators) func(db *gorm.DB) *gorm.DB + func BuildDateFilter(field string, filter *query.DateFilterOperators) func(db *gorm.DB) *gorm.DB + func BuildDoubleFilter(field string, filter *query.DoubleFilterOperators) func(db *gorm.DB) *gorm.DB + func BuildFloatFilter(field string, filter *query.FloatFilterOperators) func(db *gorm.DB) *gorm.DB + func BuildInt32Filter(field string, filter *query.Int32FilterOperators) func(db *gorm.DB) *gorm.DB + func BuildInt64Filter(field string, filter *query.Int64FilterOperators) func(db *gorm.DB) *gorm.DB + func BuildNullFilter(field string, filter *query.NullFilterOperators) func(db *gorm.DB) *gorm.DB + func BuildStringFilter(field string, filter *query.StringFilterOperation) func(db *gorm.DB) *gorm.DB + func NewConnStrResolver(c *conf.Endpoints, ts saas.TenantStore) data.ConnStrResolver + func NewDbGuardianContext(ctx context.Context, enable ...bool) context.Context + func NewDbProvider(cache *DbCache, cs data.ConnStrResolver, d *conf.Data) sgorm.DbProvider + func PageScope(page query.Page) func(db *gorm.DB) *gorm.DB + func RegisterCallbacks(db *gorm.DB) + func SortScope(sort query.Sort, d []string) func(db *gorm.DB) *gorm.DB + func WhereUserId(id interface{}) func(db *gorm.DB) *gorm.DB + type AuditedModel struct + CreatedAt time.Time + CreatedBy *string + UpdatedAt time.Time + UpdatedBy *string + func (model *AuditedModel) SetCreatedBy(createdBy interface{}) + func (model *AuditedModel) SetUpdatedBy(updatedBy interface{}) + func (model AuditedModel) GetCreatedBy() *string + func (model AuditedModel) GetUpdatedBy() *string + type BuildDetailScope interface + BuildDetailScope func(withDetail bool) func(db *gorm.DB) *gorm.DB + type BuildFilterScope interface + BuildFilterScope func(q *TQuery) func(db *gorm.DB) *gorm.DB + type BuildPageScope interface + BuildPageScope func(q *TQuery) func(db *gorm.DB) *gorm.DB + type BuildSortScope interface + BuildSortScope func(q *TQuery) func(db *gorm.DB) *gorm.DB + type DbCache struct + func NewDbCache(d *conf.Data, l klog.Logger) (*DbCache, func()) + func (c *DbCache) GetOrSet(ctx context.Context, key, connStr string) (*gorm.DB, error) + type DbProviderFunc func(ctx context.Context, key string) *gorm.DB + func (d DbProviderFunc) Get(ctx context.Context, key string) *gorm.DB + type DefaultSorting interface + DefaultSorting func() []string + type GetDb interface + GetDb func(ctx context.Context) *gorm.DB + type Logger struct + LogLevel logger.LogLevel + SlowThreshold time.Duration + func (l *Logger) Error(ctx context.Context, s string, i ...interface{}) + func (l *Logger) Info(ctx context.Context, s string, i ...interface{}) + func (l *Logger) LogMode(level logger.LogLevel) logger.Interface + func (l *Logger) Trace(ctx context.Context, begin time.Time, ...) + func (l *Logger) Warn(ctx context.Context, s string, i ...interface{}) + type Repo struct + DbProvider sgorm.DbProvider + Eventbus *eventbus.EventBus + func NewRepo(dbProvider sgorm.DbProvider, eventbus *eventbus.EventBus, override interface{}) *Repo[TEntity, TKey, TQuery] + func (r *Repo[TEntity, TKey, TQuery]) BatchCreate(ctx context.Context, entity []*TEntity, batchSize int) error + func (r *Repo[TEntity, TKey, TQuery]) Count(ctx context.Context, query *TQuery) (total int64, filtered int64, err error) + func (r *Repo[TEntity, TKey, TQuery]) Create(ctx context.Context, entity *TEntity) error + func (r *Repo[TEntity, TKey, TQuery]) Delete(ctx context.Context, id TKey) error + func (r *Repo[TEntity, TKey, TQuery]) First(ctx context.Context, query *TQuery) (*TEntity, error) + func (r *Repo[TEntity, TKey, TQuery]) Get(ctx context.Context, id TKey) (*TEntity, error) + func (r *Repo[TEntity, TKey, TQuery]) List(ctx context.Context, query *TQuery) ([]*TEntity, error) + func (r *Repo[TEntity, TKey, TQuery]) Update(ctx context.Context, id TKey, entity *TEntity, p query.Select) error + func (r *Repo[TEntity, TKey, TQuery]) Upsert(ctx context.Context, entity *TEntity) error + type UIDBase struct + ID uuid.UUID + func (u *UIDBase) BeforeCreate(tx *gorm.DB) error + type UpdateAssociation interface + UpdateAssociation func(ctx context.Context, entity *TEntity) error