dynamodb

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dynamodb provides a library that uses DynamoDB to store your go types. This package implements memzy.Backend

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("Item not found")

ErrNotFound is returned if you try to get an item that doesn't exist

View Source
var (
	// ErrNullClient is returned if you try to create an iterator with a null client
	ErrNullClient = fmt.Errorf("Cannot create an Iter with a null client")
)

Functions

func UnmarshalStreamImage

func UnmarshalStreamImage(attribute map[string]events.DynamoDBAttributeValue, out interface{}) error

UnmarshalStreamImage converts events.DynamoDBAttributeValue to struct HT https://stackoverflow.com/questions/49129534/unmarshal-mapstringdynamodbattributevalue-into-a-struct

Types

type Client

type Client struct {
	Service   dynamodbiface.DynamoDBAPI
	TableName *string
}

Client provides a connection to dynamo

func New

func New(t string) *Client

New returns a pointer to a Client

func (*Client) GetItem

func (c *Client) GetItem(v interface{}, key map[string]interface{}) error

GetItem retrieves a go object from the table, using a consistent read

func (*Client) NewIter

func (c *Client) NewIter(args ...interface{}) memzy.Iter

NewIter returns a pointer to an Iter. It also performs an initial scan so it is ready to go, this probably should be avoided.

func (*Client) PutItem

func (c *Client) PutItem(v interface{}) error

PutItem stores your go object in the table

type Iter

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

Iter provides a convenient interface for iterating over the elements returned from paginated list API calls. Successive calls to the Next method will step through each item in the list, fetching pages of items as needed. Iterators are not thread-safe, so they should not be consumed across multiple goroutines.

func (*Iter) Current

func (it *Iter) Current(v interface{}) error

Current returns the most recent item visited by a call to Next.

func (*Iter) Err

func (it *Iter) Err() error

Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.

func (*Iter) Next

func (it *Iter) Next() bool

Next advances the Iter to the next item in the list, which will then be available through the Current method. It returns false when the iterator stops at the end of the list.

Jump to

Keyboard shortcuts

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