Documentation ¶
Index ¶
- type BasePO
- type BaseRepo
- func (r *BaseRepo[E, T]) Create(ctx context.Context, value any) error
- func (r *BaseRepo[E, T]) Delete(ctx context.Context, ids []string, query any, conds ...any) error
- func (r *BaseRepo[E, T]) Find(ctx context.Context, query any, conds ...any) ([]E, error)
- func (r *BaseRepo[E, T]) FindByPage(ctx context.Context, offset int, limit int, orderBy map[string]string, ...) ([]E, int, error)
- func (r *BaseRepo[E, T]) FindOne(ctx context.Context, query any, conds ...any) (E, error)
- func (r *BaseRepo[E, T]) Update(ctx context.Context, column string, value any, conds ...any) (E, error)
- func (r *BaseRepo[E, T]) Updates(ctx context.Context, values map[string]any, query any, conds ...any) (E, error)
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasePO ¶
type BasePO struct { Id string `gorm:"type:varchar(26);primaryKey;comment:分布式全局唯一 ULID"` CreatedAt time.Time `gorm:"type:datetime not null;comment:创建时间"` UpdatedAt time.Time `gorm:"type:datetime not null;comment:更新时间"` DeletedAt gorm.DeletedAt `gorm:"type:datetime;index;comment:删除时间"` Version optimisticlock.Version `gorm:"not null;default:0;comment:版本号(乐观锁专用)"` }
type BaseRepo ¶
func (*BaseRepo[E, T]) FindByPage ¶
type Repo ¶
type Repo[E, T any] interface { Create(ctx context.Context, value any) error FindOne(ctx context.Context, query any, conds ...any) (E, error) Find(ctx context.Context, query any, conds ...any) ([]E, error) FindByPage(ctx context.Context, offset int, limit int, orderBy map[string]string, query any, conds ...any) ([]E, int, error) Update(ctx context.Context, column string, value any, conds ...any) (E, error) Updates(ctx context.Context, values map[string]any, query any, conds ...any) (E, error) Delete(ctx context.Context, ids []string, query any, conds ...any) error }
Click to show internal directories.
Click to hide internal directories.