Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyIdentifier = errs.New("identifier cannot be empty")
Functions ¶
This section is empty.
Types ¶
type CollectionLookupOptions ¶
type CollectionRepository ¶
type CollectionRepository interface {
Create(ctx context.Context, tx bun.Tx, collection *models.Collection) error
Rename(ctx context.Context, tx bun.Tx, identifier string, newName string) error
DeleteById(ctx context.Context, tx bun.Tx, identifier string) error
FindById(ctx context.Context, identifier string) (*models.Collection, error)
FindByName(ctx context.Context, name string) (*models.Collection, error)
// FindOne looks up a collection by either ID or name.
FindOne(ctx context.Context, opts CollectionLookupOptions) (*models.Collection, error)
FindAll(ctx context.Context, opts FindAllOptions) (models.Collections, error)
}
type FindAllOptions ¶
type FindAllOptions struct {
OrderBy []OrderBy
Pagination *Pagination
}
type ItemRepository ¶
type ItemRepository interface {
Create(ctx context.Context, tx bun.Tx, item *models.Item) error
Bump(
ctx context.Context,
tx bun.Tx,
identifier string,
sequenceId int64,
) error // Bump updates the sequence ID and updated_at timestamp of an item to move it to the top of the list.
DeleteById(ctx context.Context, tx bun.Tx, identifier string) error
FindLatest(ctx context.Context, collectionID string) (*models.Item, error)
FindById(ctx context.Context, identifier string, collectionId string) (*models.Item, error)
FindByHash(ctx context.Context, hash string, collectionId string) (*models.Item, error)
}
type Pagination ¶
type Repository ¶
type Repository interface {
Items() ItemRepository
Collections() CollectionRepository
}
Repository is the main interface for accessing all repositories. Some methods might require a transaction (bun.Tx) to be passed in if they modify data.
func NewRepository ¶
func NewRepository(db *bun.DB) Repository
Click to show internal directories.
Click to hide internal directories.