schema

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Name    string
	HashKey string
	SortKey string
	Global  bool
}

Index is the schema for a secondary index.

type Table

type Table struct {
	Name    string
	HashKey string
	SortKey string
	Indexes []Index
}

Table contains the schema for a DynamoDB table

func NewTable

func NewTable(desc *dynamodb.TableDescription) *Table

NewTable parses a dynamodb.TableDescription into a simplified Table schema nolint: dupl

func NewTableFromCreate

func NewTableFromCreate(desc *dynamodb.CreateTableInput) *Table

NewTableFromCreate parses a dynamodb.CreateTableInput into a simplified Table schema nolint: dupl

func (*Table) GetIndex

func (t *Table) GetIndex(name string) *Index

GetIndex returns an index with a matching name, or nil if not found.

func (*Table) HasIndex

func (t *Table) HasIndex(name string) bool

HasIndex returns true if the table contains an index with a matching name.

func (*Table) IsKey

func (t *Table) IsKey(name string) bool

IsKey returns whether the attribute is a hash or sort key.

type TableLoader

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

TableLoader is a loading cache of DynamoDB table schemas.

func NewTableLoader

func NewTableLoader(dynamo dynamodbiface.DynamoDBAPI) *TableLoader

func (*TableLoader) Get

func (l *TableLoader) Get(ctx context.Context, name string) (*Table, error)

Get retrieves a cached table schema, loading it from DynamoDB if not found. If multiple Get are issued against the same table concurrently, only a single request will be made to load the table.

Jump to

Keyboard shortcuts

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