Documentation
¶
Index ¶
- func CloseAllInstances(ctx context.Context) error
- func ListAllInstances(ctx context.Context) ([]string, error)
- type DynamoDBLocal
- func (d *DynamoDBLocal) AWSConfig() aws.Config
- func (d *DynamoDBLocal) Close() error
- func (d *DynamoDBLocal) CreateTable(ctx context.Context, tableName string) error
- func (d *DynamoDBLocal) DeleteTable(ctx context.Context, tableName string) error
- func (d *DynamoDBLocal) DynamoDBClient(opts ...func(*dynamodb.Options)) *dynamodb.Client
- func (d *DynamoDBLocal) EndpointURL() string
- func (d *DynamoDBLocal) Start(ctx context.Context) error
- func (d *DynamoDBLocal) Stop() error
- func (d *DynamoDBLocal) WaitForReady(ctx context.Context, timeout time.Duration) error
- type LocalDynamoOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAllInstances ¶
CloseAllInstances stops and removes all tagged local instances.
Types ¶
type DynamoDBLocal ¶
type DynamoDBLocal struct {
Name string
Port int
Image string
InMemory bool
// contains filtered or unexported fields
}
DynamoDBLocal controls a dockerized DynamoDB Local instance. It is intended for use in integration tests.
func NewLocalDynamoDB ¶
func NewLocalDynamoDB(name string, opts ...LocalDynamoOption) *DynamoDBLocal
NewLocalDynamoDB creates a new, not-yet-started DynamoDBLocal runner.
func (*DynamoDBLocal) AWSConfig ¶
func (d *DynamoDBLocal) AWSConfig() aws.Config
AWSConfig returns an AWS SDK config pointing at the local DynamoDB instance.
func (*DynamoDBLocal) Close ¶
func (d *DynamoDBLocal) Close() error
Close removes the container (force).
func (*DynamoDBLocal) CreateTable ¶
func (d *DynamoDBLocal) CreateTable( ctx context.Context, tableName string, ) error
CreateTable creates a DynamoDB table for the queue.
func (*DynamoDBLocal) DeleteTable ¶
func (d *DynamoDBLocal) DeleteTable(ctx context.Context, tableName string) error
DeleteTable deletes a DynamoDB table.
func (*DynamoDBLocal) DynamoDBClient ¶
func (d *DynamoDBLocal) DynamoDBClient(opts ...func(*dynamodb.Options)) *dynamodb.Client
DynamoDBClient returns a DynamoDB client configured to connect to the local instance.
func (*DynamoDBLocal) EndpointURL ¶
func (d *DynamoDBLocal) EndpointURL() string
EndpointURL returns the HTTP endpoint URL for this local instance.
func (*DynamoDBLocal) Start ¶
func (d *DynamoDBLocal) Start(ctx context.Context) error
Start launches the dockerized DynamoDB Local and waits for it to accept connections.
func (*DynamoDBLocal) Stop ¶
func (d *DynamoDBLocal) Stop() error
Stop stops the container (but leaves it around because of --rm it will remove).
func (*DynamoDBLocal) WaitForReady ¶
WaitForReady waits for DynamoDB Local to be ready to accept requests. It uses the ListTables API to verify the database is operational.
type LocalDynamoOption ¶
type LocalDynamoOption func(*DynamoDBLocal)
LocalDynamoOption allows customizing the local DynamoDB runner.
func WithImage ¶
func WithImage(img string) LocalDynamoOption
WithImage overrides the docker image (defaults to amazon/dynamodb-local:latest).
func WithInMemory ¶
func WithInMemory(enabled bool) LocalDynamoOption
WithInMemory toggles the -inMemory flag.
func WithPort ¶
func WithPort(port int) LocalDynamoOption
WithPort sets the host port to map to container.
func WithSharedDB ¶
func WithSharedDB(enabled bool) LocalDynamoOption
WithSharedDB toggles the -sharedDb flag.