dynamoboot

package
v0.0.0-...-3c51467 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDB

type DynamoDB struct {
	MigrationsTable string
	Migrations      []*Migration

	Client *dynamodb.Client
	Config *DynamodbConfig
	// contains filtered or unexported fields
}

func (*DynamoDB) Close

func (db *DynamoDB) Close() error

Close is needed for the AppService interface.

func (*DynamoDB) Configure

func (db *DynamoDB) Configure(env *goboot.AppEnv) error

Configure connects to DynamoDB.

func (*DynamoDB) CreateTable

func (db *DynamoDB) CreateTable(ctx context.Context, tableInput *dynamodb.CreateTableInput) error

CreateTable creates a table and waits until it is ready.

func (*DynamoDB) CreateTableIfNotExists

func (db *DynamoDB) CreateTableIfNotExists(ctx context.Context, tableInput *dynamodb.CreateTableInput) error

CreateTableIfNotExists creates a table if it does not exist and waits until it is ready.

func (*DynamoDB) Init

func (db *DynamoDB) Init() error

Init runs the DynamoDB migrations.

func (*DynamoDB) Migrate

func (db *DynamoDB) Migrate(ctx context.Context) error

func (*DynamoDB) Name

func (db *DynamoDB) Name() string

Name is needed for the AppService interface.

func (*DynamoDB) TableExists

func (db *DynamoDB) TableExists(ctx context.Context, tableName string) (bool, error)

type DynamodbConfig

type DynamodbConfig struct {
	// The AWS region to connection to
	Region string `yaml:"region"`

	// When true connects to a DynamoDB instance on localhost:8000
	Local bool `yaml:"local"`

	// Name of the table keeping track of migration history
	MigrationsTable string `yaml:"migrationsTable"`
}

type Migration

type Migration struct {
	ID      string
	Migrate func(db *DynamoDB) error
}

type MigrationRecord

type MigrationRecord struct {
	ID        string `dynamodbav:"id"`
	Timestamp string `dynamodbav:"timestamp"`
	Duration  int64  `dynamodbav:"duration"`
}

Jump to

Keyboard shortcuts

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