bobtesting

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineFactory

func DefineFactory[T models.Model](cb func() T)

func RunWithDatabase

func RunWithDatabase[T testing.TB](t T, name string, cb func(t T, tx *sqlx.Tx)) bool

func SetMigrate

func SetMigrate(cb func(db *sqlx.DB) error)

Types

type CountFactory

type CountFactory[T models.Model] struct {
	// contains filtered or unexported fields
}

func (*CountFactory[T]) Create

func (f *CountFactory[T]) Create(tx *sqlx.Tx) []T

type Factory

type Factory[T models.Model] struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory[T models.Model]() *Factory[T]

func (*Factory[T]) Count

func (f *Factory[T]) Count(count int) *CountFactory[T]

func (*Factory[T]) Create

func (f *Factory[T]) Create(tx *sqlx.Tx) T

func (*Factory[T]) State

func (f *Factory[T]) State(s State[T]) *Factory[T]

type Runner

type Runner[T any] interface {
	Run(name string, cb func(t T)) bool
}

type State

type State[T models.Model] interface {
	Apply(T) T
}

func StateFunc

func StateFunc[T models.Model](apply func(T) T) State[T]

Jump to

Keyboard shortcuts

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