Documentation ¶
Index ¶
- Constants
- Variables
- func IsNotFound(err error) bool
- func SaveRecord(ctx context.Context, api MigrationApi, tableName string, ...) (err error)
- type Attribute
- type Attributes
- type FilesMigrate
- type IndexOption
- type KeySchema
- type Keys
- type Migrate
- type Migration
- type MigrationApi
- type Projection
- type ProvisionedThroughput
- type Resource
- type Resources
- type SaveFunc
- type Schema
- type SchemaBuilder
- func (b *SchemaBuilder) Attributes(attrs ...Attribute) *SchemaBuilder
- func (b *SchemaBuilder) BillingMode(mode types.BillingMode) *SchemaBuilder
- func (b *SchemaBuilder) Build(ctx context.Context, api MigrationApi, opt ...TableSchemaOption) (*dynamodb.CreateTableOutput, error)
- func (b *SchemaBuilder) Get() Schema
- func (b *SchemaBuilder) GlobalSecondaryIndex(indexes ...SecondaryIndex) *SchemaBuilder
- func (b *SchemaBuilder) Keys(keys ...KeySchema) *SchemaBuilder
- func (b *SchemaBuilder) LocalSecondaryIndex(indexes ...SecondaryIndex) *SchemaBuilder
- func (b *SchemaBuilder) TableClass(class types.TableClass) *SchemaBuilder
- func (b *SchemaBuilder) Throughput(read, write int64) *SchemaBuilder
- func (b *SchemaBuilder) TimeToLive(attr string, enabled bool) *SchemaBuilder
- type SchemaBuilders
- type SchemaMigrate
- type Schemas
- type SecondaryIndex
- type SecondaryIndexes
- type TableSchema
- func (t TableSchema) Create(ctx context.Context, api MigrationApi) (out *dynamodb.CreateTableOutput, err error)
- func (t TableSchema) Delete(ctx context.Context, api MigrationApi) (out *dynamodb.DeleteTableOutput, err error)
- func (t TableSchema) Exists(ctx context.Context, api MigrationApi) (out *dynamodb.DescribeTableOutput, err error)
- func (t TableSchema) Update(ctx context.Context, api MigrationApi, desc types.TableDescription) (out *dynamodb.UpdateTableOutput, err error)
- type TableSchemaOption
- type Template
- type TimeToLiveSpecification
Constants ¶
View Source
const DynamoDB = "AWS::DynamoDB::Table"
View Source
const MigrationTable = "dynamo_migrations"
Variables ¶
View Source
var ErrTableAlreadyExists = errors.New("table already exists")
Functions ¶
func IsNotFound ¶ added in v0.1.17
func SaveRecord ¶
Types ¶
type Attribute ¶
type Attribute struct { Type types.ScalarAttributeType `json:"AttributeType" yaml:"AttributeType"` Name string `json:"AttributeName" yaml:"AttributeName"` }
func NewBinaryAttribute ¶ added in v0.1.12
func NewNumberAttribute ¶ added in v0.1.12
func NewStringAttribute ¶ added in v0.1.12
func (Attribute) Definition ¶
func (attr Attribute) Definition() types.AttributeDefinition
type Attributes ¶
type Attributes []Attribute
func (Attributes) Definitions ¶
func (attrs Attributes) Definitions() []types.AttributeDefinition
func (Attributes) Map ¶
func (attrs Attributes) Map() map[string]types.ScalarAttributeType
type FilesMigrate ¶
type FilesMigrate struct {
// contains filtered or unexported fields
}
type IndexOption ¶ added in v0.1.12
type IndexOption func(si *SecondaryIndex)
func WithIndexProjection ¶ added in v0.1.12
func WithIndexProjection(t types.ProjectionType, attrs ...string) IndexOption
func WithIndexThroughput ¶ added in v0.1.12
func WithIndexThroughput(read, write int64) IndexOption
type KeySchema ¶
type KeySchema struct { Type types.KeyType `json:"KeyType" yaml:"KeyType"` Name string `json:"AttributeName" yaml:"AttributeName"` }
func NewHashKey ¶ added in v0.1.12
func NewRangeKey ¶ added in v0.1.12
func (KeySchema) Element ¶
func (k KeySchema) Element() *types.KeySchemaElement
type Keys ¶
type Keys []KeySchema
func (Keys) Elements ¶
func (keys Keys) Elements() []types.KeySchemaElement
type Migrate ¶
type Migrate interface { Read(ctx context.Context) (schemas []Schema, err error) Run(ctx context.Context, save SaveFunc) error }
func New ¶
func New(api MigrationApi, dirPath ...string) Migrate
func Parse ¶
func Parse(api MigrationApi, schema string) Migrate
type MigrationApi ¶
type MigrationApi interface { DescribeTable(ctx context.Context, params *dynamodb.DescribeTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTableOutput, error) CreateTable(ctx context.Context, params *dynamodb.CreateTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.CreateTableOutput, error) UpdateTimeToLive(ctx context.Context, params *dynamodb.UpdateTimeToLiveInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateTimeToLiveOutput, error) UpdateTable(ctx context.Context, params *dynamodb.UpdateTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateTableOutput, error) DescribeTimeToLive(ctx context.Context, params *dynamodb.DescribeTimeToLiveInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTimeToLiveOutput, error) DeleteTable(ctx context.Context, params *dynamodb.DeleteTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteTableOutput, error) GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error) PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error) }
type Projection ¶
type Projection struct { Type types.ProjectionType `json:"ProjectionType" yaml:"ProjectionType"` AttributeNames []string `json:"NonKeyAttributes" yaml:"NonKeyAttributes"` }
func NewProjection ¶ added in v0.1.12
func NewProjection(t types.ProjectionType, attrs ...string) *Projection
func (Projection) Element ¶
func (p Projection) Element() *types.Projection
type ProvisionedThroughput ¶
type ProvisionedThroughput struct { Read int64 `json:"ReadCapacityUnits" yaml:"ReadCapacityUnits"` Write int64 `json:"WriteCapacityUnits" yaml:"WriteCapacityUnits"` }
func (ProvisionedThroughput) Element ¶
func (t ProvisionedThroughput) Element() *types.ProvisionedThroughput
func (ProvisionedThroughput) Update ¶
func (t ProvisionedThroughput) Update(desc types.TableDescription) *types.ProvisionedThroughput
type Resource ¶
type Resource struct { Type string `json:"Type" yaml:"Type"` Properties TableSchema `json:"Properties" yaml:"Properties"` }
type Schema ¶
type Schema struct { Table TableSchema `json:"schema" yaml:"schema"` Records []map[string]interface{} `json:"records" yaml:"records"` // contains filtered or unexported fields }
type SchemaBuilder ¶ added in v0.1.11
type SchemaBuilder struct {
// contains filtered or unexported fields
}
func NewSchema ¶ added in v0.1.11
func NewSchema(name string) *SchemaBuilder
func (*SchemaBuilder) Attributes ¶ added in v0.1.11
func (b *SchemaBuilder) Attributes(attrs ...Attribute) *SchemaBuilder
func (*SchemaBuilder) BillingMode ¶ added in v0.1.11
func (b *SchemaBuilder) BillingMode(mode types.BillingMode) *SchemaBuilder
func (*SchemaBuilder) Build ¶ added in v0.1.11
func (b *SchemaBuilder) Build(ctx context.Context, api MigrationApi, opt ...TableSchemaOption) (*dynamodb.CreateTableOutput, error)
func (*SchemaBuilder) Get ¶ added in v0.1.12
func (b *SchemaBuilder) Get() Schema
func (*SchemaBuilder) GlobalSecondaryIndex ¶ added in v0.1.11
func (b *SchemaBuilder) GlobalSecondaryIndex(indexes ...SecondaryIndex) *SchemaBuilder
func (*SchemaBuilder) Keys ¶ added in v0.1.11
func (b *SchemaBuilder) Keys(keys ...KeySchema) *SchemaBuilder
func (*SchemaBuilder) LocalSecondaryIndex ¶ added in v0.1.11
func (b *SchemaBuilder) LocalSecondaryIndex(indexes ...SecondaryIndex) *SchemaBuilder
func (*SchemaBuilder) TableClass ¶ added in v0.1.11
func (b *SchemaBuilder) TableClass(class types.TableClass) *SchemaBuilder
func (*SchemaBuilder) Throughput ¶ added in v0.1.11
func (b *SchemaBuilder) Throughput(read, write int64) *SchemaBuilder
func (*SchemaBuilder) TimeToLive ¶ added in v0.1.11
func (b *SchemaBuilder) TimeToLive(attr string, enabled bool) *SchemaBuilder
type SchemaBuilders ¶ added in v0.1.12
type SchemaBuilders []*SchemaBuilder
func (SchemaBuilders) Build ¶ added in v0.1.12
func (b SchemaBuilders) Build(ctx context.Context, api MigrationApi, opt ...TableSchemaOption) ([]*dynamodb.CreateTableOutput, error)
type SchemaMigrate ¶
type SchemaMigrate struct {
// contains filtered or unexported fields
}
type Schemas ¶ added in v0.1.12
type Schemas []Schema
func GetSchemas ¶ added in v0.1.12
func GetSchemas(builders ...*SchemaBuilder) Schemas
type SecondaryIndex ¶
type SecondaryIndex struct { Name string `json:"IndexName" yaml:"IndexName"` Keys Keys `json:"KeySchema" yaml:"KeySchema"` Projection *Projection `json:"Projection" yaml:"Projection"` Throughput *ProvisionedThroughput `json:"ProvisionedThroughput,omitempty" yaml:"ProvisionedThroughput,omitempty"` }
func NewSecondaryIndex ¶ added in v0.1.12
func NewSecondaryIndex(name string, keys Keys, opts ...IndexOption) SecondaryIndex
func (SecondaryIndex) CreateGlobal ¶
func (s SecondaryIndex) CreateGlobal() types.GlobalSecondaryIndex
func (SecondaryIndex) CreateLocal ¶
func (s SecondaryIndex) CreateLocal() types.LocalSecondaryIndex
type SecondaryIndexes ¶
type SecondaryIndexes []SecondaryIndex
func (SecondaryIndexes) GlobalIndexes ¶
func (indexes SecondaryIndexes) GlobalIndexes() []types.GlobalSecondaryIndex
func (SecondaryIndexes) LocalIndexes ¶
func (indexes SecondaryIndexes) LocalIndexes() []types.LocalSecondaryIndex
func (SecondaryIndexes) UpdateGlobals ¶
func (indexes SecondaryIndexes) UpdateGlobals(desc types.TableDescription) []types.GlobalSecondaryIndexUpdate
type TableSchema ¶
type TableSchema struct { TableName string `json:"TableName" yaml:"TableName"` Attributes Attributes `json:"AttributeDefinitions" yaml:"AttributeDefinitions"` Keys Keys `json:"KeySchema" yaml:"KeySchema"` Throughput ProvisionedThroughput `json:"ProvisionedThroughput" yaml:"ProvisionedThroughput"` BillingMode types.BillingMode `json:"BillingMode" yaml:"BillingMode"` GlobalSecondaryIndex SecondaryIndexes `json:"GlobalSecondaryIndexes,omitempty" yaml:"GlobalSecondaryIndexes,omitempty"` LocalSecondaryIndex SecondaryIndexes `json:"LocalSecondaryIndexes,omitempty" yaml:"LocalSecondaryIndexes,omitempty"` TableClass types.TableClass `json:"TableClass" yaml:"TableClass"` TimeToLive *TimeToLiveSpecification `json:"TimeToLiveSpecification,omitempty" yaml:"TimeToLiveSpecification,omitempty"` // contains filtered or unexported fields }
func (TableSchema) Create ¶
func (t TableSchema) Create(ctx context.Context, api MigrationApi) (out *dynamodb.CreateTableOutput, err error)
func (TableSchema) Delete ¶
func (t TableSchema) Delete(ctx context.Context, api MigrationApi) (out *dynamodb.DeleteTableOutput, err error)
func (TableSchema) Exists ¶
func (t TableSchema) Exists(ctx context.Context, api MigrationApi) (out *dynamodb.DescribeTableOutput, err error)
func (TableSchema) Update ¶
func (t TableSchema) Update(ctx context.Context, api MigrationApi, desc types.TableDescription) (out *dynamodb.UpdateTableOutput, err error)
type TableSchemaOption ¶ added in v0.1.12
type TableSchemaOption func(ts *TableSchema)
func WithTableNamePrefix ¶ added in v0.1.12
func WithTableNamePrefix(prefix string) TableSchemaOption
type TimeToLiveSpecification ¶
type TimeToLiveSpecification struct { AttributeName string `json:"AttributeName" yaml:"AttributeName"` Enabled bool `json:"Enabled" yaml:"Enabled"` }
func (TimeToLiveSpecification) Element ¶
func (s TimeToLiveSpecification) Element() *types.TimeToLiveSpecification
Click to show internal directories.
Click to hide internal directories.