Versions in this module Expand all Collapse all v1 v1.0.0 Apr 27, 2026 Changes in this version + var ErrDuplicateKey = errors.New("data: duplicate key") + var ErrInvalidFilter = errors.New("data: invalid filter") + var ErrRecordNotFound = errors.New("data: record not found") + func ContextWithTransaction[TX any](ctx context.Context, tx Transaction[TX]) (context.Context, error) + type Condition struct + Field string + Operator Operator + Value any + func (c Condition) Validate() error + type Filter struct + Conditions []Condition + Logic LogicalOperator + func NewFilter(logic LogicalOperator, conditions ...Condition) (Filter, error) + func (f Filter) Validate() error + type LogicalOperator string + const LogicalAnd + const LogicalDefault + const LogicalOr + type Operator string + const OperatorContains + const OperatorEqual + const OperatorGreaterThan + const OperatorGreaterThanOrEqual + const OperatorIn + const OperatorIsNotNull + const OperatorIsNull + const OperatorLessThan + const OperatorLessThanOrEqual + const OperatorNotEqual + type Page struct + Items []T + Page int + PageSize int + Total int + type Repository interface + Delete func(ctx context.Context, id ID) error + FindAll func(ctx context.Context) ([]T, error) + FindByID func(ctx context.Context, id ID) (*T, error) + FindWhere func(ctx context.Context, filter Filter) ([]T, error) + Paginate func(ctx context.Context, page, size int) (Page[T], error) + Save func(ctx context.Context, entity *T) error + WithTransaction func(tx Transaction[TX]) Repository[T, ID, TX] + type Transaction interface + Unwrap func() TX + func TransactionFromContext[TX any](ctx context.Context) (Transaction[TX], bool) + type TransactionManager interface + WithinTransaction func(ctx context.Context, fn func(context.Context, Transaction[TX]) error) error