Documentation ¶
Overview ¶
Package dynamodb provides a wrapper for AWS DynamoDb to run CRUD actions in items.
Index ¶
Constants ¶
const DEFAULT_AWS_REGION = "eu-central-1"
const DEFAULT_TABLENAME = "<DynamoDbTableNotSet>"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoDbRepository ¶
type DynamoDbRepository struct { // Config contains the AWS config to access DynamoDb. Config *aws.Config // TableName defines the DynamoDb table which should be used. TableName *string // contains filtered or unexported fields }
DynamoDbRepository is a wrapper to AWS DynamoDb SDK.
func (*DynamoDbRepository) Add ¶
func (r *DynamoDbRepository) Add(item ItemKey) error
Add will create a new item or update an existing item in DynamoDb.
func (*DynamoDbRepository) Delete ¶
func (r *DynamoDbRepository) Delete(item ItemKey) error
Delete will try to delete an item from DynamoDb item identified by passed item key.
func (*DynamoDbRepository) Get ¶
func (r *DynamoDbRepository) Get(item ItemKey) error
Get will try to read an item from DynamDb by passed item key. Passed item have to be a pointer, because it will unmarshal DynamiDb item values into it.
type ItemIdentifier ¶
ItemIdentifier can be used in objects which should be persisted in DynamoDb.
func NewItemIdentifier ¶
func NewItemIdentifier(id, objectType string) *ItemIdentifier
NewItemIdentifier returns a new ItemIdentifier with passed id and object type.
func (*ItemIdentifier) GetId ¶
func (id *ItemIdentifier) GetId() string
GetId returns the id of a DynamoDb item.
func (*ItemIdentifier) GetObjectType ¶
func (id *ItemIdentifier) GetObjectType() string
GetObjectType returns the object type of a DynamoDb item.
type Repository ¶
type Repository interface { Add(ItemKey) error Get(ItemKey) error //Query(ListItemRequest) (ListItemResponse, error) //Scan(ListItemRequest) (ListItemResponse, error) Delete(ItemKey) error }
Repository provides CRUD access for DynamoDb items.
func NewRepository ¶
func NewRepository(conf config.Config, logger log.Logger) Repository
NewRepository creates a new DynamoDb repository by passed coinfig. By config you can defins the table name, region and endpoint for a local dynamodb.