dynamodb

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 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 ConvertAVValue added in v0.2.5

func ConvertAVValue(data map[string]types.AttributeValue) (map[string]AVer, error)

func ConvertAVValues added in v0.2.5

func ConvertAVValues(data []map[string]types.AttributeValue) ([]map[string]AVer, error)

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 AVBool added in v0.2.5

type AVBool struct {
	BOOL bool
}

func (AVBool) IsAV added in v0.2.5

func (b AVBool) IsAV() bool

type AVByte added in v0.2.5

type AVByte struct {
	B []byte
}

func (AVByte) IsAV added in v0.2.5

func (b AVByte) IsAV() bool

type AVByteSet added in v0.2.5

type AVByteSet struct {
	BS [][]byte
}

func (AVByteSet) IsAV added in v0.2.5

func (bs AVByteSet) IsAV() bool

type AVList added in v0.2.5

type AVList struct {
	L []any
}

func (AVList) IsAV added in v0.2.5

func (l AVList) IsAV() bool

type AVMap added in v0.2.5

type AVMap struct {
	M map[string]any
}

func (AVMap) IsAV added in v0.2.5

func (m AVMap) IsAV() bool

type AVNull added in v0.2.5

type AVNull struct {
	NULL bool
}

func (AVNull) IsAV added in v0.2.5

func (n AVNull) IsAV() bool

type AVNumber added in v0.2.5

type AVNumber struct {
	N string
}

func (AVNumber) IsAV added in v0.2.5

func (n AVNumber) IsAV() bool

type AVNumberSet added in v0.2.5

type AVNumberSet struct {
	NS []string
}

func (AVNumberSet) IsAV added in v0.2.5

func (ns AVNumberSet) IsAV() bool

type AVString added in v0.2.5

type AVString struct {
	S string
}

func (AVString) IsAV added in v0.2.5

func (s AVString) IsAV() bool

type AVStringSet added in v0.2.5

type AVStringSet struct {
	SS []string
}

func (AVStringSet) IsAV added in v0.2.5

func (ss AVStringSet) IsAV() bool

type AVer added in v0.2.5

type AVer interface {
	IsAV() bool
}

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