model

package
v0.0.0-...-25be07c Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const EmptySortKeyField string = ""
View Source
const NilSortKey string = ""
View Source
const PrimaryIndex string = ""

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Partitions        map[string]Partition
	PartitionKeyField string
	SortKeyField      string
}

func (*Index) GetItemID

func (i *Index) GetItemID(key Key) (ItemID, error)

func (*Index) PutItemID

func (i *Index) PutItemID(key Key, id ItemID) error

type Item

type Item map[string]*dynamodb.AttributeValue

func (*Item) Map

func (i *Item) Map() map[string]*dynamodb.AttributeValue

type ItemID

type ItemID string

func NewItemID

func NewItemID() ItemID

type Key

type Key struct {
	Partition string
	Sort      string
	Index     string
}

func (*Key) String

func (k *Key) String() string

type Partition

type Partition map[string]ItemID

type Table

type Table struct {
	Mutex            *sync.Mutex       // Table level lock
	Items            map[ItemID]Item   // The items in the table
	PrimaryIndex     *Index            // The primary/default index for the table
	SecondaryIndices map[string]*Index // All secondary indexes for the table
}

func NewTable

func NewTable(partitionKeyField, sortKeyField string) *Table

func (*Table) DeleteItemByID

func (t *Table) DeleteItemByID(itemID ItemID) error

func (*Table) DeleteItemByInput

func (t *Table) DeleteItemByInput(input interface{}) error

func (*Table) DeleteItemByKey

func (t *Table) DeleteItemByKey(key Key) error

func (*Table) GetItemByID

func (t *Table) GetItemByID(itemID ItemID) (Item, error)

func (*Table) GetItemByInput

func (t *Table) GetItemByInput(input interface{}) (Item, error)

func (*Table) GetItemByKey

func (t *Table) GetItemByKey(key Key) (Item, error)

func (*Table) KeyFromInput

func (t *Table) KeyFromInput(input interface{}) Key

func (*Table) Lock

func (t *Table) Lock()

func (*Table) PutItemByInput

func (t *Table) PutItemByInput(input interface{}) error

func (*Table) PutItemByKey

func (t *Table) PutItemByKey(key Key, item Item) error

func (*Table) Unlock

func (t *Table) Unlock()

Jump to

Keyboard shortcuts

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