table

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 9 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 deletes the item in the table.

func (*Table) GetItem

func (t *Table) GetItem(hashKeyValue, rangeKeyValue *dynamodb.AttributeValue, v interface{}, opts ...option.GetItemInput) error

GetItem 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 puts an item on the table.

func (*Table) Query

func (t *Table) Query(slice interface{}, opts ...option.QueryInput) (map[string]*dynamodb.AttributeValue, error)

Query 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 updates the item on the table.

func (*Table) WithHashKey

func (t *Table) WithHashKey(keyName, keyAttribyteType 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