data

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRecordNotFound = errors.New("record not found")

Functions

This section is empty.

Types

type CRUDStore

type CRUDStore[T any] struct {
	DB bun.IDB
}

func (CRUDStore[T]) Delete

func (c CRUDStore[T]) Delete(ctx context.Context, model *T) error

func (CRUDStore[T]) FindAll

func (c CRUDStore[T]) FindAll(ctx context.Context, sc ...SelectCriteria) ([]T, error)

func (CRUDStore[T]) FindOne

func (c CRUDStore[T]) FindOne(ctx context.Context, sc ...SelectCriteria) (T, error)

func (CRUDStore[T]) Save

func (c CRUDStore[T]) Save(ctx context.Context, model *T) error

func (CRUDStore[T]) Update

func (c CRUDStore[T]) Update(ctx context.Context, model *T) error

type ICRUDStore

type ICRUDStore[T any] interface {
	FindAll(context.Context, ...SelectCriteria) ([]T, error)
	FindOne(context.Context, ...SelectCriteria) (T, error)
	Delete(context.Context, *T) error
	Save(context.Context, *T) error
	Update(context.Context, *T) error
}

func New

func New[T any](db bun.IDB) ICRUDStore[T]

type SelectCriteria

type SelectCriteria func(*bun.SelectQuery) *bun.SelectQuery

Jump to

Keyboard shortcuts

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