cachecontracts

package
v0.235.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache[Entity any, ID comparable](
	cache CacheSubject[Entity, ID],
	source cacheSource[Entity, ID],
	repository cachepkg.Repository[Entity, ID],
	opts ...Option[Entity, ID],
) contract.Contract

func EntityRepository

func EntityRepository[Entity any, ID comparable](subject cachepkg.EntityRepository[Entity, ID], commitManager comproto.OnePhaseCommitProtocol, opts ...Option[Entity, ID]) contract.Contract

func HitRepository

func HitRepository[EntID any](subject cachepkg.HitRepository[EntID], commitManager comproto.OnePhaseCommitProtocol, opts ...crudcontracts.Option[cachepkg.Hit[EntID], cachepkg.HitID]) contract.Contract

func Repository

func Repository[Entity any, ID comparable](subject cachepkg.Repository[Entity, ID], opts ...Option[Entity, ID]) contract.Contract

Types

type CacheSubject

type CacheSubject[Entity, ID any] interface {
	cachepkg.Interface[Entity, ID]
	crud.Creator[Entity]
	crud.ByIDFinder[Entity, ID]
	crud.AllFinder[Entity]
	crud.Updater[Entity]
	crud.ByIDDeleter[ID]
	crud.AllDeleter
}

type Config added in v0.217.0

type Config[E any, ID comparable] struct {
	CRUD crudcontracts.Config[E, ID]

	MakeCache func(cache.Source[E, ID], cache.Repository[E, ID]) CacheSubject[E, ID]
}

func (Config[E, ID]) Configure added in v0.217.0

func (c Config[E, ID]) Configure(t *Config[E, ID])

func (*Config[E, ID]) Init added in v0.217.0

func (c *Config[E, ID]) Init()

type Option added in v0.217.0

type Option[E any, ID comparable] interface {
	option.Option[Config[E, ID]]
}

func CRUDOption added in v0.217.0

func CRUDOption[E any, ID comparable](opts ...crudcontracts.Option[E, ID]) Option[E, ID]

type SpySource

type SpySource[Entity, ID any] struct {
	// contains filtered or unexported fields
}

func (*SpySource[Entity, ID]) FindByID

func (stub *SpySource[Entity, ID]) FindByID(ctx context.Context, id ID) (_ent Entity, _found bool, _err error)

Jump to

Keyboard shortcuts

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