fixtures

package
v0.21.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedisOpRpush = "RPUSH"
	RedisOpSet   = "SET"
)

Variables

This section is empty.

Functions

func GetValueId

func GetValueId(value interface{}) (interface{}, bool)

func KernelMiddlewareLoader

func KernelMiddlewareLoader(factory FixtureBuilderFactory) kernel.MiddlewareFactory

Types

type AutoNumbered

type AutoNumbered struct {
	// contains filtered or unexported fields
}

func NewAutoNumbered

func NewAutoNumbered() *AutoNumbered

func NewAutoNumberedFrom

func NewAutoNumberedFrom(initial uint) *AutoNumbered

func (*AutoNumbered) GetNext

func (n *AutoNumbered) GetNext() *uint

GetNext provides a fresh id for a fixture in case you don't want to assign specific ids Keep in mind that the ids are unique only in the scope of the same *AutoNumbered instance

type BlobFixturesSettings

type BlobFixturesSettings struct {
	BasePath   string
	ConfigName string
}

type DdbWriterOption

type DdbWriterOption func(settings *ddb.Settings)

func WithDdbModelIdApplication

func WithDdbModelIdApplication(application string) DdbWriterOption

type FixtureBuilder

type FixtureBuilder interface {
	Fixtures() []*FixtureSet
}

type FixtureBuilderFactory

type FixtureBuilderFactory func(ctx context.Context) (FixtureBuilder, error)

func SimpleFixtureBuilderFactory

func SimpleFixtureBuilderFactory(fixtureSets []*FixtureSet) FixtureBuilderFactory

type FixtureLoader

type FixtureLoader interface {
	Load(ctx context.Context, fixtureSets []*FixtureSet) error
}

func NewFixtureLoader

func NewFixtureLoader(ctx context.Context, config cfg.Config, logger log.Logger) FixtureLoader

type FixtureSet

type FixtureSet struct {
	Enabled  bool
	Purge    bool
	Writer   FixtureWriterFactory
	Fixtures []interface{}
}

type FixtureWriter

type FixtureWriter interface {
	Purge(ctx context.Context) error
	Write(ctx context.Context, fixture *FixtureSet) error
}

func NewBlobFixtureWriterWithInterfaces

func NewBlobFixtureWriterWithInterfaces(logger log.Logger, batchRunner blob.BatchRunner, purger *blobPurger, store blob.Store, basePath string) FixtureWriter

func NewConfigurableKvStoreFixtureWriterWithInterfaces

func NewConfigurableKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, store kvstore.KvStore[T]) FixtureWriter

func NewDynamoDbFixtureWriterWithInterfaces

func NewDynamoDbFixtureWriterWithInterfaces(logger log.Logger, factory ddbRepoFactory, purger *dynamodbPurger) FixtureWriter

func NewDynamoDbKvStoreFixtureWriterWithInterfaces

func NewDynamoDbKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, factory ddbKvstoreFactory[T], purger *dynamodbPurger) FixtureWriter

func NewMysqlFixtureWriterWithInterfaces

func NewMysqlFixtureWriterWithInterfaces(logger log.Logger, metadata *db_repo.Metadata, repo db_repo.Repository, purger *mysqlPurger) FixtureWriter

func NewMysqlPlainFixtureWriterWithInterfaces

func NewMysqlPlainFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlPlainMetaData, purger *mysqlPurger) FixtureWriter

func NewMysqlSqlxFixtureWriterWithInterfaces added in v0.21.5

func NewMysqlSqlxFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlSqlxMetaData, purger *mysqlPurger) FixtureWriter

func NewRedisFixtureWriterWithInterfaces

func NewRedisFixtureWriterWithInterfaces(logger log.Logger, client redis.Client, purger *redisPurger, operation *string) FixtureWriter

func NewRedisKvStoreFixtureWriterWithInterfaces

func NewRedisKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, store kvstore.KvStore[T], purger *redisPurger) FixtureWriter

type FixtureWriterFactory

type FixtureWriterFactory func(ctx context.Context, config cfg.Config, logger log.Logger) (FixtureWriter, error)

func BlobFixtureWriterFactory

func BlobFixtureWriterFactory(settings *BlobFixturesSettings) FixtureWriterFactory

func ConfigurableKvStoreFixtureWriterFactory

func ConfigurableKvStoreFixtureWriterFactory[T any](name string) FixtureWriterFactory

func DynamoDbFixtureWriterFactory

func DynamoDbFixtureWriterFactory(settings *ddb.Settings, options ...DdbWriterOption) FixtureWriterFactory

func DynamoDbKvStoreFixtureWriterFactory

func DynamoDbKvStoreFixtureWriterFactory[T any](modelId *mdl.ModelId) FixtureWriterFactory

func MysqlOrmFixtureWriterFactory

func MysqlOrmFixtureWriterFactory(metadata *db_repo.Metadata) FixtureWriterFactory

func MysqlPlainFixtureWriterFactory

func MysqlPlainFixtureWriterFactory(metadata *MysqlPlainMetaData) FixtureWriterFactory

func MysqlSqlxFixtureWriterFactory added in v0.21.5

func MysqlSqlxFixtureWriterFactory(metadata *MysqlSqlxMetaData) FixtureWriterFactory

func RedisFixtureWriterFactory

func RedisFixtureWriterFactory(name *string, operation *string) FixtureWriterFactory

func RedisKvStoreFixtureWriterFactory

func RedisKvStoreFixtureWriterFactory[T any](modelId *mdl.ModelId) FixtureWriterFactory

type KvStoreFixture

type KvStoreFixture struct {
	Key   interface{}
	Value interface{}
}

type MysqlPlainFixtureValues

type MysqlPlainFixtureValues []interface{}

type MysqlPlainMetaData

type MysqlPlainMetaData struct {
	TableName string
	Columns   []string
}

type MysqlSqlxMetaData added in v0.21.5

type MysqlSqlxMetaData struct {
	TableName string
}

type NamedFixture

type NamedFixture struct {
	Name  string
	Value interface{}
}

type NamedFixtureSet

type NamedFixtureSet []*NamedFixture

func GetNamedFixtures

func GetNamedFixtures(container interface{}) []NamedFixtureSet

func (*NamedFixtureSet) All

func (l *NamedFixtureSet) All() []interface{}

func (*NamedFixtureSet) CountIf

func (l *NamedFixtureSet) CountIf(f func(elem interface{}) bool) int

func (*NamedFixtureSet) FindAll

func (l *NamedFixtureSet) FindAll(f func(elem interface{}) bool) []interface{}

func (*NamedFixtureSet) FindFirst

func (l *NamedFixtureSet) FindFirst(f func(elem interface{}) bool) (interface{}, bool)

func (*NamedFixtureSet) GetValueById

func (l *NamedFixtureSet) GetValueById(id interface{}) interface{}

func (*NamedFixtureSet) GetValueByName

func (l *NamedFixtureSet) GetValueByName(name string) interface{}

func (*NamedFixtureSet) Len

func (l *NamedFixtureSet) Len() int

type RedisFixture

type RedisFixture struct {
	Key    string
	Value  interface{}
	Expiry time.Duration
}

Jump to

Keyboard shortcuts

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