Documentation ¶
Index ¶
- type AllDeleter
- type AllDeleterSubject
- type AllFinder
- type AllFinderSubject
- type ByIDDeleter
- type ByIDDeleterSubject
- type ByIDFinder
- type ByIDFinderSubject
- type Creator
- type CreatorSubject
- type Deleter
- type DeleterSubject
- type Finder
- type FinderSubject
- type OnePhaseCommitProtocol
- type OnePhaseCommitProtocolSubject
- type Purger
- type PurgerSubject
- type QueryMany
- type QueryManyFunc
- type QueryManySubject
- type QueryOne
- type QueryOneFunc
- type QueryOneSubject
- type Updater
- type UpdaterSubject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllDeleter ¶ added in v0.84.0
type AllDeleter[Entity, ID any] struct { MakeSubject func(testing.TB) AllDeleterSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity }
func (AllDeleter[Entity, ID]) Benchmark ¶ added in v0.84.0
func (c AllDeleter[Entity, ID]) Benchmark(b *testing.B)
func (AllDeleter[Entity, ID]) Spec ¶ added in v0.84.0
func (c AllDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (AllDeleter[Entity, ID]) Test ¶ added in v0.84.0
func (c AllDeleter[Entity, ID]) Test(t *testing.T)
type AllDeleterSubject ¶ added in v0.84.0
type AllDeleterSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.AllDeleter }
type AllFinder ¶ added in v0.84.0
type AllFinder[Entity, ID any] struct { MakeSubject func(testing.TB) AllFinderSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity }
AllFinder can return business entities from a given resource that implement it's test The "EntityTypeName" is a Empty struct for the specific entity (struct) type that should be returned.
NewEntityForTest used only for testing and should not be provided outside of testing
type AllFinderSubject ¶ added in v0.84.0
type AllFinderSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.AllFinder[Entity] }
type ByIDDeleter ¶ added in v0.84.0
type ByIDDeleter[Entity, ID any] struct { MakeSubject func(testing.TB) ByIDDeleterSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity }
func (ByIDDeleter[Entity, ID]) Benchmark ¶ added in v0.84.0
func (c ByIDDeleter[Entity, ID]) Benchmark(b *testing.B)
func (ByIDDeleter[Entity, ID]) Spec ¶ added in v0.84.0
func (c ByIDDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDDeleter[Entity, ID]) Test ¶ added in v0.84.0
func (c ByIDDeleter[Entity, ID]) Test(t *testing.T)
type ByIDDeleterSubject ¶ added in v0.84.0
type ByIDDeleterSubject[Entity, ID any] spechelper.CRD[Entity, ID]
type ByIDFinder ¶ added in v0.84.0
type ByIDFinder[Entity, ID any] struct { MakeSubject func(testing.TB) ByIDFinderSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity }
func (ByIDFinder[Entity, ID]) Benchmark ¶ added in v0.84.0
func (c ByIDFinder[Entity, ID]) Benchmark(b *testing.B)
func (ByIDFinder[Entity, ID]) Name ¶ added in v0.84.0
func (c ByIDFinder[Entity, ID]) Name() string
func (ByIDFinder[Entity, ID]) Spec ¶ added in v0.84.0
func (c ByIDFinder[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDFinder[Entity, ID]) Test ¶ added in v0.84.0
func (c ByIDFinder[Entity, ID]) Test(t *testing.T)
type ByIDFinderSubject ¶ added in v0.84.0
type ByIDFinderSubject[Entity, ID any] spechelper.CRD[Entity, ID]
type Creator ¶
type Creator[Entity, ID any] struct { MakeSubject func(testing.TB) CreatorSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity // SupportIDReuse is an optional configuration value that tells the contract // that recreating an entity with an ID which belongs to a previously deleted entity is accepted. SupportIDReuse bool // SupportRecreate is an optional configuration value that tells the contract // that deleting an Entity then recreating it with the same values is supported by the Creator. SupportRecreate bool }
type CreatorSubject ¶
type CreatorSubject[Entity, ID any] spechelper.CRD[Entity, ID]
type Deleter ¶
type DeleterSubject ¶
type DeleterSubject[Entity, ID any] interface { AllDeleterSubject[Entity, ID] ByIDDeleterSubject[Entity, ID] }
type Finder ¶
type FinderSubject ¶
type FinderSubject[Entity, ID any] interface { ByIDFinderSubject[Entity, ID] AllFinderSubject[Entity, ID] }
type OnePhaseCommitProtocol ¶ added in v0.72.0
type OnePhaseCommitProtocol[Entity, ID any] struct { MakeSubject func(testing.TB) OnePhaseCommitProtocolSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity }
func (OnePhaseCommitProtocol[Entity, ID]) Benchmark ¶ added in v0.72.0
func (c OnePhaseCommitProtocol[Entity, ID]) Benchmark(b *testing.B)
func (OnePhaseCommitProtocol[Entity, ID]) Spec ¶ added in v0.72.0
func (c OnePhaseCommitProtocol[Entity, ID]) Spec(s *testcase.Spec)
func (OnePhaseCommitProtocol[Entity, ID]) Test ¶ added in v0.72.0
func (c OnePhaseCommitProtocol[Entity, ID]) Test(t *testing.T)
type OnePhaseCommitProtocolSubject ¶ added in v0.72.0
type OnePhaseCommitProtocolSubject[Entity, ID any] struct { Resource spechelper.CRD[Entity, ID] CommitManager comproto.OnePhaseCommitProtocol }
type Purger ¶
type PurgerSubject ¶
type PurgerSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.Purger }
type QueryMany ¶ added in v0.92.0
type QueryMany[Entity, ID any] struct { MakeSubject func(testing.TB) QueryManySubject[Entity, ID] MakeContext func(testing.TB) context.Context // QueryName is the name of the test subject QueryOneFunc method of this contract specification. QueryName string // MakeIncludedEntity must return an entity that is matched by the QueryManyFunc MakeIncludedEntity func(testing.TB) Entity // MakeExcludedEntity [OPTIONAL] is an optional property, // that could be used ensure the query returns only the expected values. MakeExcludedEntity func(testing.TB) Entity // Specify allow further specification describing for a given QueryOne query function. // If none specified, this field will be ignored Specify func(testing.TB) }
type QueryManyFunc ¶ added in v0.92.0
QueryManyFunc is the generic representation of a query that meant to find many result. It is really similar to resources.Finder#FindAll, with the exception that the closure meant to know the query method name on the subject and the inputs it requires.
QueryOneFunc is generated through ToQuery factory function in QueryOne resource contract specification.
type QueryManySubject ¶ added in v0.92.0
type QueryManySubject[Entity, ID any] struct { // Resource is the resource that can contain entities. Resource spechelper.CRD[Entity, ID] // MakeQuery is the function that knows how to build up the QueryManyFunc. MakeQuery QueryManyFunc[Entity] }
type QueryOne ¶
type QueryOne[Entity, ID any] struct { MakeSubject func(testing.TB) QueryOneSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) Entity // QueryName is the name of the test subject QueryOneFunc method of this contract specification. QueryName string // Specify allow further specification describing for a given QueryOne query function. // If none specified, this field will be ignored Specify func(testing.TB) }
type QueryOneFunc ¶ added in v0.92.0
type QueryOneFunc[Entity any] func(tb testing.TB, ctx context.Context, ent Entity) (_ Entity, found bool, _ error)
QueryOneFunc is the generic representation of a query that meant to find one result. It is really similar to resources.Finder#FindByID, with the exception that the closure meant to know the query method name on the subject and the inputs it requires.
QueryOneFunc is generated through ToQuery factory function in QueryOne resource contract specification.
type QueryOneSubject ¶ added in v0.92.0
type QueryOneSubject[Entity, ID any] struct { // Resource is the resource that can contain entities. Resource spechelper.CRD[Entity, ID] // Query takes an entity ptr and returns with a closure that has the knowledge about how to query on the MakeSubject resource to find the entity. // // By convention, any preparation action that affect the resource must take place prior to returning the closure. // The QueryOneFunc closure should only have the Method call with the already mapped values. // Query will be evaluated in the beginning of the testing, // and executed after all the test Context preparation is done. Query QueryOneFunc[Entity] }
type Updater ¶
type Updater[Entity, ID any] struct { MakeSubject func(testing.TB) UpdaterSubject[Entity, ID] MakeContext func(testing.TB) context.Context MakeEntity func(testing.TB) 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(testing.TB, *Entity) }
Updater will request an update for a wrapped entity object in the Resource
type UpdaterSubject ¶
type UpdaterSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.Updater[Entity] }