table

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Overview

Package table provides the table instance for operations on the DynamoDB table.

Index

Constants

This section is empty.

Variables

View Source
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

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

func (t *Table) WithHashKey(keyName, keyAttributeType string) *Table

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

func (t *Table) WithRangeKey(keyName, keyAttributeType string) *Table

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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