Documentation ¶
Index ¶
- func And(specifications ...repository.Specification) repository.Specification
- func Between[T any](field string, start T, end T) repository.Specification
- func Equal[T any](field string, value T) repository.Specification
- func EqualWithJoinEqual[T any](field string, value T, joins []string, preloads []string) repository.Specification
- func GreaterOrEqual[T comparable](field string, value T) repository.Specification
- func GreaterThan[T comparable](field string, value T) repository.Specification
- func IsNull(field string) repository.Specification
- func JoinAndEqual(joins []string, preloads []string) repository.Specification
- func LessOrEqual[T comparable](field string, value T) repository.Specification
- func LessThan[T comparable](field string, value T) repository.Specification
- func NewAtomicRepository(db *gorm.DB) *atomicRepository
- func Not(specification repository.Specification) repository.Specification
- func Or(specifications ...repository.Specification) repository.Specification
- type BaseRepository
- func (r *BaseRepository[E]) Delete(ctx context.Context, entity *E, specification repository.Specification) error
- func (r *BaseRepository[E]) DeleteByID(ctx context.Context, id uint) error
- func (r *BaseRepository[E]) FindAll(ctx context.Context, specification repository.Specification) ([]E, error)
- func (r *BaseRepository[E]) FindByID(ctx context.Context, id uint) (E, error)
- func (r *BaseRepository[E]) FindOne(ctx context.Context, specification repository.Specification) (E, error)
- func (r *BaseRepository[E]) InitializeTable(ctx context.Context, entity *E) error
- func (r *BaseRepository[E]) Insert(ctx context.Context, entity *E) error
- func (r *BaseRepository[E]) Paginated(ctx context.Context, specification repository.Specification, page, limit int) (repository.PaginatedResults[E], error)
- func (r *BaseRepository[E]) Save(ctx context.Context, entity *E) error
- func (r *BaseRepository[E]) Update(ctx context.Context, entity *E) error
- type WeatherHistoryRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
func And(specifications ...repository.Specification) repository.Specification
func Between ¶
func Between[T any](field string, start T, end T) repository.Specification
func Equal ¶
func Equal[T any](field string, value T) repository.Specification
func EqualWithJoinEqual ¶
func EqualWithJoinEqual[T any](field string, value T, joins []string, preloads []string) repository.Specification
func GreaterOrEqual ¶
func GreaterOrEqual[T comparable](field string, value T) repository.Specification
func GreaterThan ¶
func GreaterThan[T comparable](field string, value T) repository.Specification
func IsNull ¶
func IsNull(field string) repository.Specification
func JoinAndEqual ¶
func JoinAndEqual(joins []string, preloads []string) repository.Specification
func LessOrEqual ¶
func LessOrEqual[T comparable](field string, value T) repository.Specification
func LessThan ¶
func LessThan[T comparable](field string, value T) repository.Specification
func NewAtomicRepository ¶
func Not ¶
func Not(specification repository.Specification) repository.Specification
func Or ¶
func Or(specifications ...repository.Specification) repository.Specification
Types ¶
type BaseRepository ¶
type BaseRepository[E any] struct { // contains filtered or unexported fields }
func (*BaseRepository[E]) Delete ¶
func (r *BaseRepository[E]) Delete(ctx context.Context, entity *E, specification repository.Specification) error
Delete record by specification and entity
func (*BaseRepository[E]) DeleteByID ¶
func (r *BaseRepository[E]) DeleteByID(ctx context.Context, id uint) error
DeleteByID record by ID
func (*BaseRepository[E]) FindAll ¶
func (r *BaseRepository[E]) FindAll(ctx context.Context, specification repository.Specification) ([]E, error)
FindAll retrieve a record by specification
func (*BaseRepository[E]) FindByID ¶
func (r *BaseRepository[E]) FindByID(ctx context.Context, id uint) (E, error)
FindByID retrieve a record by id from a database
func (*BaseRepository[E]) FindOne ¶
func (r *BaseRepository[E]) FindOne(ctx context.Context, specification repository.Specification) (E, error)
func (*BaseRepository[E]) InitializeTable ¶
func (r *BaseRepository[E]) InitializeTable(ctx context.Context, entity *E) error
InitializeTable create table in db if doesn't exist
func (*BaseRepository[E]) Insert ¶
func (r *BaseRepository[E]) Insert(ctx context.Context, entity *E) error
Insert create new record in the database
func (*BaseRepository[E]) Paginated ¶
func (r *BaseRepository[E]) Paginated(ctx context.Context, specification repository.Specification, page, limit int) (repository.PaginatedResults[E], error)
Paginated select paginated data results
type WeatherHistoryRepository ¶
type WeatherHistoryRepository struct { *BaseRepository[entity.WeatherHistory] }
func NewWeatherHistoryRepository ¶
func NewWeatherHistoryRepository(db *gorm.DB) *WeatherHistoryRepository
Click to show internal directories.
Click to hide internal directories.