Documentation ¶
Index ¶
- func FromContext(ctx context.Context, defaultDB *gorm.DB) *gorm.DB
- func GetOrDefault[T complex64](values url.Values, key string, defaultValue int) int
- func New(dsn string, dbPoolConfig string) (*gorm.DB, error)
- func ParseDBPoolConfig(poolConfig string) (url.Values, error)
- func WithValue(ctx context.Context, defaultDB *gorm.DB) context.Context
- type BaseRepository
- func (b *BaseRepository[T]) BatchInsert(ctx context.Context, m []*T) (int64, error)
- func (b *BaseRepository[T]) DeleteById(ctx context.Context, id int64) (int64, error)
- func (b *BaseRepository[T]) DeleteByIds(ctx context.Context, ids int64) (int64, error)
- func (b *BaseRepository[T]) FindById(ctx context.Context, id int64) (*T, error)
- func (b *BaseRepository[T]) FindByIdWithDeleted(ctx context.Context, id int64) (*T, error)
- func (b *BaseRepository[T]) FindByIds(ctx context.Context, id ...int64) ([]*T, error)
- func (b *BaseRepository[T]) FindByIdsWithDeleted(ctx context.Context, id ...int64) ([]*T, error)
- func (b *BaseRepository[T]) ForceDeleteById(ctx context.Context, id int64) (int64, error)
- func (b *BaseRepository[T]) ForceDeleteByIds(ctx context.Context, ids ...int64) (int64, error)
- func (b *BaseRepository[T]) Insert(ctx context.Context, m *T) error
- type Model
- type PK
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrDefault ¶
Types ¶
type BaseRepository ¶
type BaseRepository[T any] struct { // contains filtered or unexported fields }
func NewBaseRepository ¶
func NewBaseRepository[T any](db *gorm.DB) BaseRepository[T]
func (*BaseRepository[T]) BatchInsert ¶
func (b *BaseRepository[T]) BatchInsert(ctx context.Context, m []*T) (int64, error)
func (*BaseRepository[T]) DeleteById ¶
func (*BaseRepository[T]) DeleteByIds ¶
func (*BaseRepository[T]) FindById ¶
func (b *BaseRepository[T]) FindById(ctx context.Context, id int64) (*T, error)
func (*BaseRepository[T]) FindByIdWithDeleted ¶
func (b *BaseRepository[T]) FindByIdWithDeleted(ctx context.Context, id int64) (*T, error)
func (*BaseRepository[T]) FindByIds ¶
func (b *BaseRepository[T]) FindByIds(ctx context.Context, id ...int64) ([]*T, error)
func (*BaseRepository[T]) FindByIdsWithDeleted ¶
func (b *BaseRepository[T]) FindByIdsWithDeleted(ctx context.Context, id ...int64) ([]*T, error)
func (*BaseRepository[T]) ForceDeleteById ¶
func (*BaseRepository[T]) ForceDeleteByIds ¶
Click to show internal directories.
Click to hide internal directories.