Documentation ¶
Overview ¶
Package table provides the table instance for operations on the DynamoDB table.
Index ¶
- Variables
- type PrimaryKey
- type Table
- func (t *Table) DeleteItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, ...) error
- func (t *Table) DeleteItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, ...) error
- func (t *Table) GetItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, v interface{}, ...) error
- func (t *Table) GetItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, ...) error
- func (t *Table) PutItem(v interface{}, opts ...option.PutItemInput) error
- func (t *Table) PutItemWithContext(ctx context.Context, v interface{}, opts ...option.PutItemInput) error
- func (t *Table) Query(slice interface{}, opts ...option.QueryInput) (map[string]*dynamodb.AttributeValue, error)
- func (t *Table) QueryWithContext(ctx context.Context, slice interface{}, opts ...option.QueryInput) (map[string]*dynamodb.AttributeValue, error)
- func (t *Table) UpdateItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, ...) (*dynamodb.UpdateItemOutput, error)
- func (t *Table) UpdateItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, ...) (*dynamodb.UpdateItemOutput, error)
- func (t *Table) WithHashKey(keyName, keyAttributeType string) *Table
- func (t *Table) WithRangeKey(keyName, keyAttributeType string) *Table
Constants ¶
This section is empty.
Variables ¶
var ErrItemNotFound = errors.New("dynamodb: item not found")
ErrItemNotFound will be returned when the item is not found.
Functions ¶
This section is empty.
Types ¶
type PrimaryKey ¶
type PrimaryKey struct { dynamodb.AttributeDefinition dynamodb.KeySchemaElement }
PrimaryKey represents primary key such as HASH and RANGE in DynamoDB.
type Table ¶
type Table struct { DynamoDB dynamodbiface.DynamoDBAPI Name *string // contains filtered or unexported fields }
A Table represents a DynamoDB table.
func New ¶
func New(d dynamodbiface.DynamoDBAPI, name string) *Table
New returns Table instance with table name name and schema.
func (*Table) DeleteItem ¶
func (t *Table) DeleteItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, opts ...option.DeleteItemInput) error
DeleteItem wraps DeleteItemWithContext using context.Background.
func (*Table) DeleteItemWithContext ¶ added in v1.0.2
func (t *Table) DeleteItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, opts ...option.DeleteItemInput) error
DeleteItemWithContext deletes the item in the table.
func (*Table) GetItem ¶
func (t *Table) GetItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, v interface{}, opts ...option.GetItemInput) error
GetItem wraps GetItemWithContext using context.Background.
func (*Table) GetItemWithContext ¶ added in v1.0.2
func (t *Table) GetItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, v interface{}, opts ...option.GetItemInput) error
GetItemWithContext get the item from the table and convert it to v.
func (*Table) PutItem ¶
func (t *Table) PutItem(v interface{}, opts ...option.PutItemInput) error
PutItem wraps PutItemWithContext using context.Background.
func (*Table) PutItemWithContext ¶ added in v1.0.2
func (t *Table) PutItemWithContext(ctx context.Context, v interface{}, opts ...option.PutItemInput) error
PutItemWithContext puts an item on the table.
func (*Table) Query ¶
func (t *Table) Query(slice interface{}, opts ...option.QueryInput) (map[string]*dynamodb.AttributeValue, error)
Query wraps QueryWithContext using context.Background.
func (*Table) QueryWithContext ¶ added in v1.0.2
func (t *Table) QueryWithContext(ctx context.Context, slice interface{}, opts ...option.QueryInput) (map[string]*dynamodb.AttributeValue, error)
QueryWithContext queries items to the table and convert it to v. v must be a slice of struct. If the Query operation does not return the last page, LastEvaluatedKey will be returned.
func (*Table) UpdateItem ¶
func (t *Table) UpdateItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, opts ...option.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
UpdateItem wraps UpdateItemWithContext using context.Background.
func (*Table) UpdateItemWithContext ¶ added in v1.0.2
func (t *Table) UpdateItemWithContext(ctx context.Context, hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, opts ...option.UpdateItemInput) (*dynamodb.UpdateItemOutput, error)
UpdateItemWithContext updates the item on the table.
func (*Table) WithHashKey ¶
WithHashKey specifies HASH key for the table. keyType must be "S", "N", or "B". See http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeDefinition.html
func (*Table) WithRangeKey ¶
WithRangeKey specifies RANGE key for the table. keyType must be "S", "N", or "B". See http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeDefinition.html