dynamo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dynamo implements various design patterns for dynamodb and looks to simplify the aws api for aws-sdk-go-v2

Index

Constants

View Source
const (
	HashKeyName   = "pk"
	SortKeyName   = "sk"
	DomainKeyName = "dk"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) Item

func (c *Client) Item(ctx context.Context, key Keyable) (map[string]types.AttributeValue, error)

func (*Client) NewGetItemIn

func (c *Client) NewGetItemIn(k Keyable) *dynamodb.GetItemInput

func (*Client) NewPutInput

func (c *Client) NewPutInput(item map[string]types.AttributeValue, cond ...string) *dynamodb.PutItemInput

func (*Client) Put

func (c *Client) Put(ctx context.Context, item map[string]types.AttributeValue) error

func (*Client) TableName

func (c *Client) TableName() string

func (*Client) Write

func (c *Client) Write(ctx context.Context, row Writable) error

type FormatterError

type FormatterError interface {
	FormatForError() string
}

type Key

type Key struct {
	Hash          string `dynamodbav:"pk"`
	Sort          string `dynamodbav:"sk"`
	Domain        string `dynamodbav:"dk"`
	ExprNames     map[string]string
	ConditionExpr *string
}

func (*Key) ConditionExpression

func (k *Key) ConditionExpression() *string

func (*Key) ExpressionAttrNames

func (k *Key) ExpressionAttrNames() map[string]string

func (*Key) FormatForError

func (k *Key) FormatForError() string

func (*Key) Full

func (k *Key) Full() map[string]types.AttributeValue

type Keyable

type Keyable interface {
	Full() map[string]types.AttributeValue
	ConditionExpr() *string
	ExprAttrNames() map[string]string
	FormatterError
}

type Table

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

func NewTable

func NewTable(name, hash, sort string, idx map[string]string) (Table, error)

func (Table) Name

func (t Table) Name() string

type Writable

type Writable interface {
	ToItem() (map[string]types.AttributeValue, error)
	ToDBKey() map[string]types.AttributeValue
	ConditionExpr() *string
	ExprAttrNames() map[string]string
	FormatterError
}

Jump to

Keyboard shortcuts

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