repository

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2025 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultQuerySize = 100

Functions

This section is empty.

Types

type Identifiable

type Identifiable interface {
	ItemID() string
	SetItemID(string)
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func New

func New(pool *pgxpool.Pool, model database.ModelInterface) (*Repository, error)

func (*Repository) DeleteBy

func (repo *Repository) DeleteBy(field string, operator constants.ComparisonOperator, value interface{}) error

func (*Repository) DeleteById

func (repo *Repository) DeleteById(id string) error

func (*Repository) Find

func (repo *Repository) Find(order constants.SortOrder, size, offset int) (int, []interface{}, error)

func (*Repository) FindAll

func (repo *Repository) FindAll() ([]interface{}, error)

func (*Repository) FindByIds

func (repo *Repository) FindByIds(ids ...string) ([]interface{}, error)

func (*Repository) FindOneBy

func (repo *Repository) FindOneBy(criteria map[string]interface{}) (interface{}, error)

func (*Repository) FindOneById

func (repo *Repository) FindOneById(id string) (interface{}, error)

func (*Repository) GetNumberOfRows

func (repo *Repository) GetNumberOfRows() (int, error)

func (*Repository) Insert

func (repo *Repository) Insert(entity interface{}) (interface{}, error)

func (*Repository) Latest

func (repo *Repository) Latest() (interface{}, error)

func (*Repository) MapFromEntity

func (repo *Repository) MapFromEntity(model *database.Model) (interface{}, error)

func (*Repository) MapToEntity

func (repo *Repository) MapToEntity(entity interface{}) *database.Model

MapToEntity maps a domain model to a Database Model

func (*Repository) ScanRow

func (repo *Repository) ScanRow(row Row) (interface{}, error)

func (*Repository) TableName

func (repo *Repository) TableName() string

func (*Repository) UpdateById

func (repo *Repository) UpdateById(id string, update interface{}) (interface{}, error)

type Row

type Row interface {
	Scan(dest ...any) error
}

type RowScanner

type RowScanner interface {
	ScanRow(row Row) (interface{}, error)
}

type Temporal

type Temporal interface {
	CreatedAt() int64
	UpdatedAt() int64
	SetCreatedAt(time.Time)
	SetUpdatedAt(time.Time)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL