usecase

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 10 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package usecase wraps shared components to work with usecases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeleter

func NewDeleter(repo repository.Deleter) *deleter

func NewGetter

func NewGetter[R resource.Resource](repo repository.Getter[R], resType resource.Type) *getter[R]

func NewLister

func NewLister[R resource.Resource](repo repository.Lister[R], defaultOpts ...search.Option) *lister[R]

func NewSinglePatcher

func NewSinglePatcher[R resource.Resource](
	repo repository.Patcher[R],
	resType resource.Type,
	validationFunc func(context.Context, repository.PatchQuery) error,
	tx persistence.Transactioner,
	monitor monitoring.Monitor,
	defaultPatchOpts ...repository.PatchOption,
) *singlePatcher[R]

func NewUpdater

func NewUpdater[R resource.Resource](
	repo repository.Updater[R],
	validationFunc func(context.Context, R) error,
) *updater[R]

Types

type Creator

type Creator[R resource.Resource] interface {
	Create(ctx context.Context, r R) (R, error)
}

func NewCreator

func NewCreator[R resource.Resource](repo repository.Creator[R], validationFunc func(context.Context, R) error) Creator[R]

type CreatorBatch

type CreatorBatch[R resource.Resource] interface {
	CreateBatch(ctx context.Context, r []R) ([]R, error)
}

func NewCreatorBatch

func NewCreatorBatch[R resource.Resource](repo repository.CreatorBatch[R], validationFunc func(context.Context, []R) error) CreatorBatch[R]

type Deleter

type Deleter interface {
	Delete(context.Context, repository.DeleteType, ...search.Option) error
}

type Getter

type Getter[R resource.Resource] interface {
	Get(ctx context.Context, opts ...search.Option) (R, error)
}

type Lister

type Lister[R resource.Resource] interface {
	List(ctx context.Context, opts ...search.Option) (resource.ListResponse[R], error)
}

type Patcher

type Patcher[R any] interface {
	Patch(ctx context.Context, opts ...repository.PatchOption) (R, error)
}

type Updater

type Updater[R resource.Resource] interface {
	Update(ctx context.Context, req R) (R, error)
}

Directories

Path Synopsis
Package usecasetest provides test helpers for the generic usecase package
Package usecasetest provides test helpers for the generic usecase package

Jump to

Keyboard shortcuts

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