cachecontracts

package
v0.296.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache[ENT any, ID comparable](repository cachepkg.Repository[ENT, ID], opts ...Option[ENT, ID]) contract.Contract

func EntityRepository

func EntityRepository[ENT any, ID comparable](subject cachepkg.EntityRepository[ENT, ID], commitManager comproto.OnePhaseCommitProtocol, opts ...Option[ENT, 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[ENT, ID any] interface {
	cachepkg.Interface[ENT, ID]
	crud.Creator[ENT]
	crud.Saver[ENT]
	crud.ByIDFinder[ENT, ID]
	crud.AllFinder[ENT]
	crud.Updater[ENT]
	crud.ByIDDeleter[ID]
	crud.AllDeleter
}

type Config added in v0.217.0

type Config[ENT any, ID comparable] struct {
	// MakeID will help  create a valid ENT.ID.
	// In the cache, we work with entities which suppose to be already stored somewhere else
	// so the default use-case for testing the cache.EntityRepository is that entities already have a populated ID.
	// If a randomly generated value not good, you can overwrite this function.
	MakeID func(tb testing.TB) ID
	// CRUD [optional] contracts related configuration.
	CRUD crudcontracts.Config[ENT, 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[ENT any, ID comparable] interface {
	option.Option[Config[ENT, ID]]
}

func CRUDOption added in v0.217.0

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

Jump to

Keyboard shortcuts

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