dynamodb

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoItems = errors.New("no items found")
)

Functions

func FlattenAttrList added in v0.2.0

func FlattenAttrList(data []map[string]types.AttributeValue) ([]map[string]any, error)

FlattenAttrList - flattens the given attribute value list.

func FlattenAttrValue added in v0.2.0

func FlattenAttrValue(data map[string]types.AttributeValue) (map[string]any, error)

FlattenAttrValue - flattens the given attribute value map. Removes the "Value" attribute from the AttributeValueMember struct and returns the value as a map[string]any.

func JSONStringify

func JSONStringify(v any) string

JSONStringify - returns a json string representation of the given value

func ScanIterator added in v0.2.0

func ScanIterator(ctx context.Context, scanner Scanner) func(input *ddb.ScanInput) (*ddb.ScanOutput, error, bool)

ScanIterator - Creates an iterator function for a DynamoDB scan function. The iterator function will return the next page of results on each call, until there are no more results. If the iterator is done, the output will be nil and, the last return value will be true.

Example:

next := dynamodb.ScanIterator(ctx, scanner)

input := &ddb.ScanInput{
    TableName: aws.String("my-table"),
}

output, err, done := next(input)

Types

type Client

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

Client - dynamodb client to query the table (get,put,query,scan)

func NewClient

func NewClient(ctx context.Context, region string, endpoint string) (*Client, error)

NewClient - creates a new opinionated dynamodb client

func NewWith

func NewWith(ctx context.Context, configOpts func(*config.LoadOptions) error, dbOpts ...func(*ddb.Options)) (*Client, error)

NewWith - creates a new dynamodb client with exposed functional options. Use this client if you wish to have flexibility with some of the more advanced options.

func (*Client) BatchDeleteItems

func (c *Client) BatchDeleteItems(ctx context.Context, tableName string, keys []map[string]types.AttributeValue) (*ddb.BatchWriteItemOutput, error)

BatchDeleteItems - deletes items in a batch Note, max size is 25 items within a batch

func (*Client) Put added in v0.2.0

func (c *Client) Put(ctx context.Context, input *ddb.PutItemInput) (*ddb.PutItemOutput, error)

Put - puts an item into a dynamodb table

func (*Client) Scan

func (c *Client) Scan(ctx context.Context, input *ddb.ScanInput) (*ddb.ScanOutput, error)

Scan - scans a dynamodb table

type Scanner added in v0.2.0

type Scanner interface {
	Scan(ctx context.Context, input *ddb.ScanInput) (*ddb.ScanOutput, error)
}

Jump to

Keyboard shortcuts

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