cachecontracts

package
v0.165.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[Entity any, ID comparable] func(testing.TB) CacheSubject[Entity, ID]

func (Cache[Entity, ID]) Benchmark

func (c Cache[Entity, ID]) Benchmark(b *testing.B)

func (Cache[Entity, ID]) Spec

func (c Cache[Entity, ID]) Spec(s *testcase.Spec)

func (Cache[Entity, ID]) Test

func (c Cache[Entity, ID]) Test(t *testing.T)

type CacheSubject

type CacheSubject[Entity any, ID comparable] struct {
	Cache      cacheCache[Entity, ID]
	Source     cacheSource[Entity, ID]
	Repository cache.Repository[Entity, ID]

	MakeContext func() context.Context
	MakeEntity  func() Entity

	// ChangeEntity is an optional configuration field
	// to express what Entity fields are allowed to be changed by the user of the Updater.
	// For example, if the changed  Entity field is ignored by the Update method,
	// you can match this by not changing the Entity field as part of the ChangeEntity function.
	ChangeEntity func(*Entity)
}

type EntityRepository

type EntityRepository[Entity, ID any] func(testing.TB) EntityRepositorySubject[Entity, ID]

func (EntityRepository[Entity, ID]) Benchmark

func (c EntityRepository[Entity, ID]) Benchmark(b *testing.B)

func (EntityRepository[Entity, ID]) Spec

func (c EntityRepository[Entity, ID]) Spec(s *testcase.Spec)

func (EntityRepository[Entity, ID]) Test

func (c EntityRepository[Entity, ID]) Test(t *testing.T)

type EntityRepositorySubject added in v0.132.0

type EntityRepositorySubject[Entity, ID any] struct {
	EntityRepository cache.EntityRepository[Entity, ID]
	CommitManager    comproto.OnePhaseCommitProtocol
	MakeContext      func() context.Context
	MakeEntity       func() Entity
	// ChangeEntity is an optional configuration field
	// to express what Entity fields are allowed to be changed by the user of the Updater.
	// For example, if the changed  Entity field is ignored by the Update method,
	// you can match this by not changing the Entity field as part of the ChangeEntity function.
	ChangeEntity func(*Entity)
}

type HitRepository added in v0.131.0

type HitRepository[EntID any] func(tb testing.TB) HitRepositorySubject[EntID]

func (HitRepository[EntID]) Benchmark added in v0.131.0

func (c HitRepository[EntID]) Benchmark(b *testing.B)

func (HitRepository[EntID]) Spec added in v0.131.0

func (c HitRepository[EntID]) Spec(s *testcase.Spec)

func (HitRepository[EntID]) Test added in v0.131.0

func (c HitRepository[EntID]) Test(t *testing.T)

type HitRepositorySubject added in v0.131.0

type HitRepositorySubject[EntID any] struct {
	Resource      cache.HitRepository[EntID]
	CommitManager comproto.OnePhaseCommitProtocol
	MakeContext   func() context.Context
	MakeHit       func() cache.Hit[EntID]
}

type Repository

type Repository[Entity, ID any] func(testing.TB) RepositorySubject[Entity, ID]

func (Repository[Entity, ID]) Benchmark

func (c Repository[Entity, ID]) Benchmark(b *testing.B)

func (Repository[Entity, ID]) Spec

func (c Repository[Entity, ID]) Spec(s *testcase.Spec)

func (Repository[Entity, ID]) Test

func (c Repository[Entity, ID]) Test(t *testing.T)

type RepositorySubject added in v0.132.0

type RepositorySubject[Entity, ID any] struct {
	Repository  cache.Repository[Entity, ID]
	MakeContext func() context.Context
	MakeEntity  func() Entity
	// ChangeEntity is an optional configuration field
	// to express what Entity fields are allowed to be changed by the user of the Updater.
	// For example, if the changed  Entity field is ignored by the Update method,
	// you can match this by not changing the Entity field as part of the ChangeEntity function.
	ChangeEntity func(*Entity)
}

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