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 ¶
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 ¶
func (c AllDeleter[Entity, ID]) Benchmark(b *testing.B)
func (AllDeleter[Entity, ID]) Spec ¶
func (c AllDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (AllDeleter[Entity, ID]) Test ¶
func (c AllDeleter[Entity, ID]) Test(t *testing.T)
type AllDeleterSubject ¶
type AllDeleterSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.AllDeleter }
type AllFinder ¶
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 ¶
type AllFinderSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.AllFinder[Entity] }
type ByIDDeleter ¶
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 ¶
func (c ByIDDeleter[Entity, ID]) Benchmark(b *testing.B)
func (ByIDDeleter[Entity, ID]) Spec ¶
func (c ByIDDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDDeleter[Entity, ID]) Test ¶
func (c ByIDDeleter[Entity, ID]) Test(t *testing.T)
type ByIDDeleterSubject ¶
type ByIDDeleterSubject[Entity, ID any] spechelper.CRD[Entity, ID]
type ByIDFinder ¶
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 ¶
func (c ByIDFinder[Entity, ID]) Benchmark(b *testing.B)
func (ByIDFinder[Entity, ID]) Name ¶
func (c ByIDFinder[Entity, ID]) Name() string
func (ByIDFinder[Entity, ID]) Spec ¶
func (c ByIDFinder[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDFinder[Entity, ID]) Test ¶
func (c ByIDFinder[Entity, ID]) Test(t *testing.T)
type ByIDFinderSubject ¶
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 { spechelper.CRD[Entity, ID] crud.AllDeleter }
type Finder ¶
type FinderSubject ¶
type FinderSubject[Entity, ID any] interface { spechelper.CRD[Entity, ID] crud.AllFinder[Entity] }
type OnePhaseCommitProtocol ¶
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 ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Benchmark(b *testing.B)
func (OnePhaseCommitProtocol[Entity, ID]) Name ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Name() string
func (OnePhaseCommitProtocol[Entity, ID]) Spec ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Spec(s *testcase.Spec)
func (OnePhaseCommitProtocol[Entity, ID]) Test ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Test(t *testing.T)
type OnePhaseCommitProtocolSubject ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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] }