Documentation
¶
Index ¶
- type AbstractRepository
- type BaseRepository
- type ComplexRepository
- type Counter
- type CrudRepository
- type Deleter
- type Finder
- type GenericRepository
- type Getter
- type GormDbDriver
- type GormRepository
- func (repo GormRepository[E]) Count(ctx context.Context, specifications ...Specification) (i int64, err error)
- func (repo GormRepository[E]) Delete(ctx context.Context, entity *E) error
- func (repo GormRepository[E]) DeleteById(ctx context.Context, id any) error
- func (repo GormRepository[E]) Find(ctx context.Context, specifications ...Specification) ([]E, error)
- func (repo GormRepository[E]) Get(ctx context.Context, id any) (E, error)
- func (repo GormRepository[E]) Insert(ctx context.Context, entity *E) error
- func (repo GormRepository[E]) List(ctx context.Context) ([]E, error)
- func (repo GormRepository[E]) Update(ctx context.Context, entity *E) error
- type Inserter
- type Lister
- type MigrationInvoker
- type Repository
- type Specification
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractRepository ¶
type AbstractRepository[E any] interface { CrudRepository[E] Finder[E] Counter[E] }
type BaseRepository ¶
type BaseRepository[E any] struct { }
func (BaseRepository[E]) GetEntityType ¶
func (repo BaseRepository[E]) GetEntityType() reflect.Type
type ComplexRepository ¶
type ComplexRepository[E any] interface { Find(ctx context.Context, specifications ...Specification) ([]E, error) FindWithLimit(ctx context.Context, limit int, offset int, specifications ...Specification) ([]E, error) Count(ctx context.Context, specifications ...Specification) (i int64, err error) }
type Counter ¶
type Counter[E any] interface { Repository[E] Count(ctx context.Context, specifications ...Specification) (i int64, err error) }
type CrudRepository ¶
type Finder ¶
type Finder[E any] interface { Repository[E] Find(ctx context.Context, specifications ...Specification) ([]E, error) }
type GenericRepository ¶
type GenericRepository[E any] interface { Insert(ctx context.Context, entity *E) error Delete(ctx context.Context, entity *E) error DeleteById(ctx context.Context, id any) error Update(ctx context.Context, entity *E) error Get(ctx context.Context, id any) (E, error) List(ctx context.Context) ([]E, error) }
type GormDbDriver ¶
type GormDbDriver string
const ( InMemory GormDbDriver = "file::memory:?cache=shared" Sqlite GormDbDriver = "retailer.db?cache=shared" )
type GormRepository ¶
type GormRepository[E any] struct { BaseRepository[E] // contains filtered or unexported fields }
func NewGormRepository ¶
func NewGormRepository[E any](driver GormDbDriver, migrate MigrationInvoker, config *gorm.Config) *GormRepository[E]
func (GormRepository[E]) Count ¶
func (repo GormRepository[E]) Count(ctx context.Context, specifications ...Specification) (i int64, err error)
func (GormRepository[E]) Delete ¶
func (repo GormRepository[E]) Delete(ctx context.Context, entity *E) error
func (GormRepository[E]) DeleteById ¶
func (repo GormRepository[E]) DeleteById(ctx context.Context, id any) error
func (GormRepository[E]) Find ¶
func (repo GormRepository[E]) Find(ctx context.Context, specifications ...Specification) ([]E, error)
func (GormRepository[E]) Get ¶
func (repo GormRepository[E]) Get(ctx context.Context, id any) (E, error)
func (GormRepository[E]) Insert ¶
func (repo GormRepository[E]) Insert(ctx context.Context, entity *E) error
type Inserter ¶
type Inserter[E any] interface { Repository[E] Insert(ctx context.Context, entity *E) error }
type MigrationInvoker ¶
type Repository ¶
type Specification ¶
Click to show internal directories.
Click to hide internal directories.