crudtest

package
v0.298.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Eventually = assert.Retry{Strategy: &Waiter}
View Source
var Waiter = resilience.Waiter{
	WaitDuration: time.Millisecond,
	Timeout:      5 * time.Second,
}

Functions

func CountIs

func CountIs[T any](tb testing.TB, itr iter.Seq[T], expected int)

func Create

func Create[ENT, ID any](tb testing.TB, resource crud.Creator[ENT], ctx context.Context, ptr *ENT, opts ...Option[ENT, ID])

func Delete

func Delete[ENT, ID any](tb testing.TB, resource crud.ByIDDeleter[ID], ctx context.Context, ptr *ENT, opts ...Option[ENT, ID])

func DeleteAll

func DeleteAll[ENT, ID any](tb testing.TB, resource deleteAllDeleter[ENT, ID], ctx context.Context, opts ...Option[ENT, ID])

func HasEntity

func HasEntity[ENT, ID any](tb testing.TB, subject crud.ByIDFinder[ENT, ID], ctx context.Context, ptr *ENT, opts ...Option[ENT, ID])

func HasID

func HasID[ENT, ID any](tb testing.TB, ent *ENT, opts ...Option[ENT, ID]) (id ID)

func IsAbsent

func IsAbsent[ENT, ID any](tb testing.TB, resource crud.ByIDFinder[ENT, ID], ctx context.Context, id ID, opts ...Option[ENT, ID])

func IsPresent

func IsPresent[ENT, ID any](tb testing.TB, resource crud.ByIDFinder[ENT, ID], ctx context.Context, id ID, opts ...Option[ENT, ID]) *ENT

func Save added in v0.242.0

func Save[ENT, ID any](tb testing.TB, resource crud.Saver[ENT], ctx context.Context, ptr *ENT, opts ...Option[ENT, ID])

func Update

func Update[ENT, ID any](tb testing.TB, resource updater[ENT, ID], ctx context.Context, ptr *ENT, opts ...Option[ENT, ID])

Types

type Config added in v0.296.0

type Config[ENT, ID any] struct {
	IDA extid.Accessor[ENT, ID]
}

func (Config[ENT, ID]) Configure added in v0.296.0

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

type Helper added in v0.296.0

type Helper[ENT, ID any] struct {
	Waiter resilience.Waiter
	IDA    extid.Accessor[ENT, ID]
}

func (Helper[ENT, ID]) CountIs added in v0.296.0

func (a Helper[ENT, ID]) CountIs(tb testing.TB, iter iter.Seq[ENT], expected int)

func (Helper[ENT, ID]) Create added in v0.296.0

func (a Helper[ENT, ID]) Create(tb testing.TB, resource crud.Creator[ENT], ctx context.Context, ptr *ENT)

func (Helper[ENT, ID]) Delete added in v0.296.0

func (a Helper[ENT, ID]) Delete(tb testing.TB, resource crud.ByIDDeleter[ID], ctx context.Context, ptr *ENT)

func (Helper[ENT, ID]) DeleteAll added in v0.296.0

func (a Helper[ENT, ID]) DeleteAll(tb testing.TB, subject deleteAllDeleter[ENT, ID], ctx context.Context)

func (Helper[ENT, ID]) HasEntity added in v0.296.0

func (a Helper[ENT, ID]) HasEntity(tb testing.TB, subject crud.ByIDFinder[ENT, ID], ctx context.Context, ptr *ENT)

func (Helper[ENT, ID]) HasID added in v0.296.0

func (a Helper[ENT, ID]) HasID(tb testing.TB, ptr *ENT) ID

func (Helper[ENT, ID]) IsAbsent added in v0.296.0

func (a Helper[ENT, ID]) IsAbsent(tb testing.TB, subject crud.ByIDFinder[ENT, ID], ctx context.Context, id ID)

func (Helper[ENT, ID]) IsPresent added in v0.296.0

func (a Helper[ENT, ID]) IsPresent(tb testing.TB, resource crud.ByIDFinder[ENT, ID], ctx context.Context, id ID) *ENT

func (Helper[ENT, ID]) Save added in v0.296.0

func (a Helper[ENT, ID]) Save(tb testing.TB, resource crud.Saver[ENT], ctx context.Context, ptr *ENT)

func (Helper[ENT, ID]) Update added in v0.296.0

func (a Helper[ENT, ID]) Update(tb testing.TB, resource updater[ENT, ID], ctx context.Context, ptr *ENT)

type Option added in v0.296.0

type Option[ENT, ID any] option.Option[Config[ENT, ID]]

type Resource added in v0.296.0

type Resource[ENT, ID any] interface{}

Jump to

Keyboard shortcuts

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