Documentation ¶
Overview ¶
Package suite provides a suite for running compatibility tests.
Index ¶
- func Run(tb testing.TB, opts ...Option)
- type CustomerRepositoryConstructor
- type DatabaseContext
- type DatabaseExecer
- type ExecerContext
- type Option
- func WithCustomerRepositoryConstructor(c CustomerRepositoryConstructor) Option
- func WithDatabaseDSN(dsn string) Option
- func WithDatabaseDriver(driver string) Option
- func WithDatabasePlaceholderFormat(format squirrel.PlaceholderFormat) Option
- func WithFeatureFilesLocation(loc string) Option
- func WithTestContainerRequests(requests ...testcontainers.StartGenericContainerRequest) Option
- type PreparerContext
- type QueryerContext
- type Suite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomerRepositoryConstructor ¶
type CustomerRepositoryConstructor func(db DatabaseExecer, c clock.Clock) customer.Repository
CustomerRepositoryConstructor is constructor to create a new repository using DatabaseContext.
type DatabaseContext ¶
type DatabaseContext interface { PreparerContext ExecerContext QueryerContext }
DatabaseContext is a set of PreparerContext, ExecerContext, QueryerContext.
type DatabaseExecer ¶
type DatabaseExecer interface { Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRow(ctx context.Context, query string, args ...interface{}) (*sql.Row, error) }
DatabaseExecer executes query depends on what it has.
type ExecerContext ¶
type ExecerContext interface {
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
}
ExecerContext executes a query without returning any rows.
type Option ¶
type Option func(*suite)
Option sets up the test suite.
func WithCustomerRepositoryConstructor ¶
func WithCustomerRepositoryConstructor(c CustomerRepositoryConstructor) Option
WithCustomerRepositoryConstructor sets the constructor.
func WithDatabaseDSN ¶
WithDatabaseDSN sets the database dsn.
func WithDatabaseDriver ¶
WithDatabaseDriver sets the database driver.
func WithDatabasePlaceholderFormat ¶
func WithDatabasePlaceholderFormat(format squirrel.PlaceholderFormat) Option
WithDatabasePlaceholderFormat sets the database placeholder format.
func WithFeatureFilesLocation ¶
WithFeatureFilesLocation sets the feature files location.
func WithTestContainerRequests ¶
func WithTestContainerRequests(requests ...testcontainers.StartGenericContainerRequest) Option
WithTestContainerRequests appends container requests.
type PreparerContext ¶
type PreparerContext interface {
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
}
PreparerContext creates a prepared statement for later queries or executions.