Documentation ¶
Index ¶
- Constants
- func GetValueId(value any) (any, bool)
- func KernelMiddlewareLoader(factory FixtureSetsFactory) kernel.MiddlewareFactory
- func NewBlobPurger(ctx context.Context, config cfg.Config, logger log.Logger, ...) (*blobPurger, error)
- func NewDynamodbPurger(ctx context.Context, config cfg.Config, logger log.Logger, ...) (*dynamodbPurger, error)
- func NewMysqlPurger(ctx context.Context, config cfg.Config, logger log.Logger, tableName string) (*mysqlPurger, error)
- func NewRedisPurger(ctx context.Context, config cfg.Config, logger log.Logger, name string) (*redisPurger, error)
- type AutoNumbered
- type BlobFixture
- type BlobFixturesSettings
- type DdbWriterOption
- type FixtureLoader
- type FixtureSet
- type FixtureSetFactory
- func BlobFixtureSetFactory[T any](settings *BlobFixturesSettings, data NamedFixtures[T], ...) FixtureSetFactory
- func ConfigurableKvStoreFixtureSetFactory[T any](name string, data NamedFixtures[*KvStoreFixture], options ...FixtureSetOption) FixtureSetFactory
- func DynamoDbFixtureSetFactory[T any](settings *ddb.Settings, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
- func DynamoDbKvStoreFixtureSetFactory[T any](modelId *mdl.ModelId, data NamedFixtures[*KvStoreFixture], ...) FixtureSetFactory
- func MysqlOrmFixtureSetFactory[T any](metadata *db_repo.Metadata, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
- func MysqlPlainFixtureSetFactory[T any](metadata *MysqlPlainMetaData, data NamedFixtures[T], ...) FixtureSetFactory
- func MysqlSqlxFixtureSetFactory[T any](metadata *MysqlSqlxMetaData, data NamedFixtures[T], ...) FixtureSetFactory
- func RedisFixtureSetFactory[T any](name string, operation string, data NamedFixtures[T], ...) FixtureSetFactory
- func RedisKvStoreFixtureSetFactory[T any](modelId *mdl.ModelId, data NamedFixtures[*KvStoreFixture], ...) FixtureSetFactory
- type FixtureSetOption
- type FixtureSetSettings
- type FixtureSetsFactory
- type FixtureWriter
- func NewBlobFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewBlobFixtureWriterWithInterfaces(logger log.Logger, batchRunner blob.BatchRunner, purger *blobPurger, ...) FixtureWriter
- func NewConfigurableKvStoreFixtureWriter[T any](ctx context.Context, config cfg.Config, logger log.Logger, name string) (FixtureWriter, error)
- func NewConfigurableKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, store kvstore.KvStore[T]) FixtureWriter
- func NewDynamoDbFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewDynamoDbFixtureWriterWithInterfaces(logger log.Logger, factory ddbRepoFactory, purger *dynamodbPurger) FixtureWriter
- func NewDynamoDbKvStoreFixtureWriter[T any](ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewDynamoDbKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, factory ddbKvstoreFactory[T], purger *dynamodbPurger) FixtureWriter
- func NewMysqlFixtureWriterWithInterfaces(logger log.Logger, metadata *db_repo.Metadata, repo db_repo.Repository, ...) FixtureWriter
- func NewMysqlOrmFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewMysqlPlainFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewMysqlPlainFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlPlainMetaData, ...) FixtureWriter
- func NewMysqlSqlxFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewMysqlSqlxFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlSqlxMetaData, ...) FixtureWriter
- func NewRedisFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, name string, ...) (FixtureWriter, error)
- func NewRedisFixtureWriterWithInterfaces(logger log.Logger, client redis.Client, purger *redisPurger, operation string) FixtureWriter
- func NewRedisKvStoreFixtureWriter[T any](ctx context.Context, config cfg.Config, logger log.Logger, ...) (FixtureWriter, error)
- func NewRedisKvStoreFixtureWriterWithInterfaces[T any](logger log.Logger, store kvstore.KvStore[T], purger *redisPurger) FixtureWriter
- type KvStoreFixture
- type MysqlPlainFixtureValues
- type MysqlPlainMetaData
- type MysqlSqlxMetaData
- type NamedFixture
- type NamedFixtures
- func (l NamedFixtures[T]) All() []any
- func (l NamedFixtures[T]) CountIf(f func(elem T) bool) int
- func (l NamedFixtures[T]) FindAll(f func(elem T) bool) []T
- func (l NamedFixtures[T]) FindFirst(f func(elem T) bool) (T, bool)
- func (l NamedFixtures[T]) GetValueById(id any) T
- func (l NamedFixtures[T]) GetValueByName(name string) T
- func (l NamedFixtures[T]) Len() int
- type Purger
- type RedisFixture
Constants ¶
View Source
const ( RedisOpRpush = "RPUSH" RedisOpSet = "SET" )
Variables ¶
This section is empty.
Functions ¶
func GetValueId ¶
func KernelMiddlewareLoader ¶
func KernelMiddlewareLoader(factory FixtureSetsFactory) kernel.MiddlewareFactory
func NewBlobPurger ¶ added in v0.24.0
func NewDynamodbPurger ¶ added in v0.24.0
func NewMysqlPurger ¶ added in v0.24.0
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 BlobFixture ¶ added in v0.24.0
type BlobFixture struct{}
BlobFixture is a dummy struct for writing nicely typed fixture sets, even though the blob fixture loader works a bit differently
type BlobFixturesSettings ¶
type DdbWriterOption ¶
func WithDdbModelIdApplication ¶
func WithDdbModelIdApplication(application string) DdbWriterOption
type FixtureLoader ¶
type FixtureLoader interface {
Load(ctx context.Context, fixtureSets []FixtureSet) error
}
func NewFixtureLoader ¶
type FixtureSet ¶
func NewSimpleFixtureSet ¶ added in v0.24.0
func NewSimpleFixtureSet[T any](fixtures NamedFixtures[T], writer FixtureWriter, options ...FixtureSetOption) FixtureSet
type FixtureSetFactory ¶ added in v0.24.0
type FixtureSetFactory func(ctx context.Context, config cfg.Config, logger log.Logger) (FixtureSet, error)
func BlobFixtureSetFactory ¶ added in v0.24.0
func BlobFixtureSetFactory[T any](settings *BlobFixturesSettings, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func ConfigurableKvStoreFixtureSetFactory ¶ added in v0.24.0
func ConfigurableKvStoreFixtureSetFactory[T any](name string, data NamedFixtures[*KvStoreFixture], options ...FixtureSetOption) FixtureSetFactory
func DynamoDbFixtureSetFactory ¶ added in v0.24.0
func DynamoDbFixtureSetFactory[T any](settings *ddb.Settings, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func DynamoDbKvStoreFixtureSetFactory ¶ added in v0.24.0
func DynamoDbKvStoreFixtureSetFactory[T any](modelId *mdl.ModelId, data NamedFixtures[*KvStoreFixture], options ...FixtureSetOption) FixtureSetFactory
func MysqlOrmFixtureSetFactory ¶ added in v0.24.0
func MysqlOrmFixtureSetFactory[T any](metadata *db_repo.Metadata, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func MysqlPlainFixtureSetFactory ¶ added in v0.24.0
func MysqlPlainFixtureSetFactory[T any](metadata *MysqlPlainMetaData, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func MysqlSqlxFixtureSetFactory ¶ added in v0.24.0
func MysqlSqlxFixtureSetFactory[T any](metadata *MysqlSqlxMetaData, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func RedisFixtureSetFactory ¶ added in v0.24.0
func RedisFixtureSetFactory[T any](name string, operation string, data NamedFixtures[T], options ...FixtureSetOption) FixtureSetFactory
func RedisKvStoreFixtureSetFactory ¶ added in v0.24.0
func RedisKvStoreFixtureSetFactory[T any](modelId *mdl.ModelId, data NamedFixtures[*KvStoreFixture], options ...FixtureSetOption) FixtureSetFactory
type FixtureSetOption ¶ added in v0.24.0
type FixtureSetOption func(settings *FixtureSetSettings)
func WithEnabled ¶ added in v0.24.0
func WithEnabled(enabled bool) FixtureSetOption
func WithPurge ¶ added in v0.24.0
func WithPurge(purge bool) FixtureSetOption
type FixtureSetSettings ¶ added in v0.24.0
func NewFixtureSetSettings ¶ added in v0.24.0
func NewFixtureSetSettings(options ...FixtureSetOption) *FixtureSetSettings
type FixtureSetsFactory ¶ added in v0.24.0
type FixtureSetsFactory func(ctx context.Context, config cfg.Config, logger log.Logger) ([]FixtureSet, error)
func NewFixtureSetsFactory ¶ added in v0.24.0
func NewFixtureSetsFactory(factories ...FixtureSetFactory) FixtureSetsFactory
type FixtureWriter ¶
type FixtureWriter interface { Purge(ctx context.Context) error Write(ctx context.Context, fixtures []any) error }
func NewBlobFixtureWriter ¶ added in v0.24.0
func NewBlobFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, settings *BlobFixturesSettings) (FixtureWriter, error)
func NewBlobFixtureWriterWithInterfaces ¶
func NewBlobFixtureWriterWithInterfaces(logger log.Logger, batchRunner blob.BatchRunner, purger *blobPurger, store blob.Store, basePath string) FixtureWriter
func NewConfigurableKvStoreFixtureWriter ¶ added in v0.24.0
func NewDynamoDbFixtureWriter ¶ added in v0.24.0
func NewDynamoDbFixtureWriterWithInterfaces ¶
func NewDynamoDbFixtureWriterWithInterfaces(logger log.Logger, factory ddbRepoFactory, purger *dynamodbPurger) FixtureWriter
func NewDynamoDbKvStoreFixtureWriter ¶ added in v0.24.0
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 NewMysqlOrmFixtureWriter ¶ added in v0.24.0
func NewMysqlPlainFixtureWriter ¶ added in v0.24.0
func NewMysqlPlainFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, metadata *MysqlPlainMetaData) (FixtureWriter, error)
func NewMysqlPlainFixtureWriterWithInterfaces ¶
func NewMysqlPlainFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlPlainMetaData, purger *mysqlPurger) FixtureWriter
func NewMysqlSqlxFixtureWriter ¶ added in v0.24.0
func NewMysqlSqlxFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, metadata *MysqlSqlxMetaData) (FixtureWriter, error)
func NewMysqlSqlxFixtureWriterWithInterfaces ¶ added in v0.21.5
func NewMysqlSqlxFixtureWriterWithInterfaces(logger log.Logger, client db.Client, metadata *MysqlSqlxMetaData, purger *mysqlPurger) FixtureWriter
func NewRedisFixtureWriter ¶ added in v0.24.0
func NewRedisKvStoreFixtureWriter ¶ added in v0.24.0
type KvStoreFixture ¶
type KvStoreFixture struct { Key interface{} Value interface{} }
type MysqlPlainFixtureValues ¶
type MysqlPlainFixtureValues []interface{}
type MysqlPlainMetaData ¶
type MysqlSqlxMetaData ¶ added in v0.21.5
type MysqlSqlxMetaData struct {
TableName string
}
type NamedFixture ¶
func NewNamedFixture ¶ added in v0.24.2
func NewNamedFixture[T any](name string, value T) *NamedFixture[T]
func NewNamedKvStoreFixture ¶ added in v0.24.2
func NewNamedKvStoreFixture[T any](name any, value T) *NamedFixture[*KvStoreFixture]
type NamedFixtures ¶ added in v0.24.0
type NamedFixtures[T any] []*NamedFixture[T]
func GetNamedFixtures ¶
func GetNamedFixtures(container any) []NamedFixtures[any]
func (NamedFixtures[T]) All ¶ added in v0.24.0
func (l NamedFixtures[T]) All() []any
All specifically returns a []any instead of a []T, so the fixture loader code doesn't complain that it can't cast a []T to []any
func (NamedFixtures[T]) CountIf ¶ added in v0.24.0
func (l NamedFixtures[T]) CountIf(f func(elem T) bool) int
func (NamedFixtures[T]) FindAll ¶ added in v0.24.0
func (l NamedFixtures[T]) FindAll(f func(elem T) bool) []T
func (NamedFixtures[T]) FindFirst ¶ added in v0.24.0
func (l NamedFixtures[T]) FindFirst(f func(elem T) bool) (T, bool)
func (NamedFixtures[T]) GetValueById ¶ added in v0.24.0
func (l NamedFixtures[T]) GetValueById(id any) T
func (NamedFixtures[T]) GetValueByName ¶ added in v0.24.0
func (l NamedFixtures[T]) GetValueByName(name string) T
func (NamedFixtures[T]) Len ¶ added in v0.24.0
func (l NamedFixtures[T]) Len() int
type RedisFixture ¶
Source Files ¶
- auto_numbered.go
- fixture_set_options.go
- kernel_middleware.go
- loader_noop.go
- named.go
- purger.go
- purger_blob.go
- purger_dynamodb.go
- purger_mysql.go
- purger_redis.go
- simple_fixture_set.go
- types.go
- writer_blob.go
- writer_configurable_kvstore.go
- writer_ddb.go
- writer_ddb_kvstore.go
- writer_ddb_options.go
- writer_mysql_orm.go
- writer_mysql_plain.go
- writer_mysql_sqlx.go
- writer_redis.go
- writer_redis_kvstore.go
Click to show internal directories.
Click to hide internal directories.