Documentation ¶
Index ¶
- func ChunkSlice[T any](slice []T, chunkSize int) [][]T
- type GormRepository
- func (r *GormRepository[M, E]) Count(ctx context.Context, specifications ...Specification) (i int64, err error)
- func (r *GormRepository[M, E]) Delete(ctx context.Context, entity *E) error
- func (r *GormRepository[M, E]) DeleteByID(ctx context.Context, id entity.ID) error
- func (r *GormRepository[M, E]) DisablePreloadAssociations() *GormRepository[M, E]
- func (r *GormRepository[M, E]) EnablePreloadAssociations() *GormRepository[M, E]
- func (r *GormRepository[M, E]) Find(ctx context.Context, specifications ...Specification) ([]E, error)
- func (r *GormRepository[M, E]) FindAll(ctx context.Context) ([]E, error)
- func (r *GormRepository[M, E]) FindByID(ctx context.Context, id entity.ID) (E, error)
- func (r *GormRepository[M, E]) FindWithLimit(ctx context.Context, limit int, offset int, specifications ...Specification) ([]E, error)
- func (r GormRepository[M, E]) GetDB() *gorm.DB
- func (r *GormRepository[M, E]) Insert(ctx context.Context, entity *E) error
- func (r GormRepository[M, E]) NewEntity() E
- func (r *GormRepository[M, E]) SetPreloadAssociations(association bool) *GormRepository[M, E]
- func (r *GormRepository[M, E]) Update(ctx context.Context, entity *E) error
- type Specification
- func And(specifications ...Specification) Specification
- func Equal[T any](field string, value T) Specification
- func GreaterOrEqual[T comparable](field string, value T) Specification
- func GreaterThan[T comparable](field string, value T) Specification
- func In[T any](field string, value []T) Specification
- func IsNull(field string) Specification
- func LessOrEqual[T comparable](field string, value T) Specification
- func LessThan[T comparable](field string, value T) Specification
- func Not(specification Specification) Specification
- func Or(specifications ...Specification) Specification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkSlice ¶
Types ¶
type GormRepository ¶
type GormRepository[M entity.Model[E], E entity.IEntity] struct { // contains filtered or unexported fields }
func NewRepository ¶
func (*GormRepository[M, E]) Count ¶
func (r *GormRepository[M, E]) Count(ctx context.Context, specifications ...Specification) (i int64, err error)
func (*GormRepository[M, E]) Delete ¶
func (r *GormRepository[M, E]) Delete(ctx context.Context, entity *E) error
func (*GormRepository[M, E]) DeleteByID ¶
func (*GormRepository[M, E]) DisablePreloadAssociations ¶
func (r *GormRepository[M, E]) DisablePreloadAssociations() *GormRepository[M, E]
func (*GormRepository[M, E]) EnablePreloadAssociations ¶
func (r *GormRepository[M, E]) EnablePreloadAssociations() *GormRepository[M, E]
func (*GormRepository[M, E]) Find ¶
func (r *GormRepository[M, E]) Find(ctx context.Context, specifications ...Specification) ([]E, error)
func (*GormRepository[M, E]) FindAll ¶
func (r *GormRepository[M, E]) FindAll(ctx context.Context) ([]E, error)
func (*GormRepository[M, E]) FindWithLimit ¶
func (r *GormRepository[M, E]) FindWithLimit(ctx context.Context, limit int, offset int, specifications ...Specification) ([]E, error)
func (GormRepository[M, E]) GetDB ¶
func (r GormRepository[M, E]) GetDB() *gorm.DB
func (*GormRepository[M, E]) Insert ¶
func (r *GormRepository[M, E]) Insert(ctx context.Context, entity *E) error
func (GormRepository[M, E]) NewEntity ¶
func (r GormRepository[M, E]) NewEntity() E
func (*GormRepository[M, E]) SetPreloadAssociations ¶
func (r *GormRepository[M, E]) SetPreloadAssociations(association bool) *GormRepository[M, E]
type Specification ¶
func And ¶
func And(specifications ...Specification) Specification
func Equal ¶
func Equal[T any](field string, value T) Specification
func GreaterOrEqual ¶
func GreaterOrEqual[T comparable](field string, value T) Specification
func GreaterThan ¶
func GreaterThan[T comparable](field string, value T) Specification
func In ¶
func In[T any](field string, value []T) Specification
func IsNull ¶
func IsNull(field string) Specification
func LessOrEqual ¶
func LessOrEqual[T comparable](field string, value T) Specification
func LessThan ¶
func LessThan[T comparable](field string, value T) Specification
func Not ¶
func Not(specification Specification) Specification
func Or ¶
func Or(specifications ...Specification) Specification
Click to show internal directories.
Click to hide internal directories.