dynamodbstore

package
v0.0.0-...-de07bbb Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegion   = "us-east-1"
	DefaultHashKey  = "key"
	DefaultRangeKey = "partition"
)

Variables

This section is empty.

Functions

func IsKey

func IsKey(key string) bool

func MakeCreateTableInput

func MakeCreateTableInput(tableName string, readCapacity, writeCapacity int64, opts ...Option) *dynamodb.CreateTableInput

MakeCreateTableInput is a utility tool to write the default table definition for creating the aws tables

func RawEvents

func RawEvents(record *dynamo.Record) ([][]byte, error)

Changes returns an ordered list of changes from the *dynamo.Record; will never return nil

func TableName

func TableName(eventSource string) (string, error)

TableName extracts a table name from a dynamodb event source arn arn:aws:dynamodb:us-west-2:528688496454:table/table-local-orgs/stream/2017-03-14T04:49:34.930

func VersionAndAt

func VersionAndAt(key string) (int, eventsource.EpochMillis, error)

Types

type Option

type Option func(*Store)

func WithDebug

func WithDebug(w io.Writer) Option

WithDebug provides additional debugging information

func WithDynamoDB

func WithDynamoDB(api *dynamodb.DynamoDB) Option

WithDynamoDB allows the caller to specify a pre-configured reference to DynamoDB

func WithEventPerItem

func WithEventPerItem(eventsPerItem int) Option

WithEventPerItem allows you to specify the number of events to be stored per dynamodb record; defaults to 1

func WithHashKey

func WithHashKey(hashKey string) Option

WithHashKey specifies the alternate hash key to use

func WithRangeKey

func WithRangeKey(rangeKey string) Option

WithRangeKey specifies the alternate range key (sort key) to use

func WithRegion

func WithRegion(region string) Option

WithRegion specifies the AWS Region to connect to

func WithStreams

func WithStreams() Option

WithStreams is an option only used by the MakeCreateTableInput that indicates the table should be created with DynamoDB streams enabled

type Store

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

Store represents a dynamodb backed eventsource.Store

func New

func New(tableName string, opts ...Option) (*Store, error)

func (*Store) Fetch

func (s *Store) Fetch(ctx context.Context, aggregateID string, version int) (eventsource.History, error)

func (*Store) Save

func (s *Store) Save(ctx context.Context, aggregateID string, records ...eventsource.Record) error

Save implements the eventsource.Store interface

Jump to

Keyboard shortcuts

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