dynamodb

package
v0.0.0-...-474e430 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComparisonOperatorEQ = "EQ"
	ComparisonOperatorNE = "NE"
	ComparisonOperatorGT = "GT"
	ComparisonOperatorLT = "LT"
	ComparisonOperatorGE = "GE"
	ComparisonOperatorLE = "LE"
)
View Source
const (
	KeyTypeHash  = "HASH"
	KeyTypeRange = "RANGE"
)
View Source
const (
	ProjectionTypeAll      = "ALL"
	ProjectionTypeKeysOnly = "KEYS_ONLY"
)

Variables

This section is empty.

Functions

func Boolean

func Boolean(v bool) *bool

func Long

func Long(v int64) *int64

func Marshal

func Marshal(item map[string]interface{}) map[string]*SDK.AttributeValue

Convert map to DynamoDb Item data

func MarshalStringSlice

func MarshalStringSlice(item Any) []*string

Convert string slice to DynamoDb Item data

func NewAttributeDefinition

func NewAttributeDefinition(attrName, attrType string) *SDK.AttributeDefinition

Create new definition of table

func NewAttributeDefinitions

func NewAttributeDefinitions(attr ...*SDK.AttributeDefinition) []*SDK.AttributeDefinition

Convert multiple definition to single slice

func NewBoolAttribute

func NewBoolAttribute(attrName string) *SDK.AttributeDefinition

NewBoolAttribute returns a table AttributeDefinition for boolean

func NewByteAttribute

func NewByteAttribute(attrName string) *SDK.AttributeDefinition

NewByteAttribute returns a table AttributeDefinition for byte

func NewCondition

func NewCondition(value Any, operator string) SDK.Condition

Create new DynamoDB condition for Query operation

func NewExpected

func NewExpected() *SDK.ExpectedAttributeValue

Create new empty condition for put

func NewExpectedCondition

func NewExpectedCondition(value Any, operator string) *SDK.ExpectedAttributeValue

Create new condition for put

func NewGSI

func NewGSI(name string, schema []*SDK.KeySchemaElement, tp *SDK.ProvisionedThroughput, projection ...string) *SDK.GlobalSecondaryIndex

NewGSI returns initilized GlobalSecondaryIndex

func NewHashKeyElement

func NewHashKeyElement(keyName string) *SDK.KeySchemaElement

Create new single KeySchema for HashKey

func NewKeyElement

func NewKeyElement(keyName, keyType string) *SDK.KeySchemaElement

Create new single KeySchema

func NewKeySchema

func NewKeySchema(elements ...*SDK.KeySchemaElement) []*SDK.KeySchemaElement

Create new KeySchema slice

func NewLSI

func NewLSI(name string, schema []*SDK.KeySchemaElement, projection ...string) *SDK.LocalSecondaryIndex

NewLSI returns initilized LocalSecondaryIndex

func NewNumberAttribute

func NewNumberAttribute(attrName string) *SDK.AttributeDefinition

NewNumberAttribute returns a table AttributeDefinition for number

func NewProvisionedThroughput

func NewProvisionedThroughput(read, write int64) *SDK.ProvisionedThroughput

func NewRangeKeyElement

func NewRangeKeyElement(keyName string) *SDK.KeySchemaElement

Create new single KeySchema for RangeKey

func NewStringAttribute

func NewStringAttribute(attrName string) *SDK.AttributeDefinition

NewStringAttribute returns a table AttributeDefinition for string

func String

func String(v string) *string

func Unmarshal

func Unmarshal(item map[string]*SDK.AttributeValue) map[string]interface{}

Convert DynamoDB Item to map data

Types

type AmazonDynamoDB

type AmazonDynamoDB struct {
	TablePrefix string
	// contains filtered or unexported fields
}

wrapped struct for DynamoDB

func NewClient

func NewClient() *AmazonDynamoDB

Create new AmazonDynamoDB struct

func NewClientWithKeys

func NewClientWithKeys(k auth.Keys) *AmazonDynamoDB

Create new AmazonDynamoDB struct

func (*AmazonDynamoDB) CreateTable

func (d *AmazonDynamoDB) CreateTable(in *SDK.CreateTableInput) error

Create new DynamoDB table

func (*AmazonDynamoDB) DeleteTable

func (d *AmazonDynamoDB) DeleteTable(name string) error

Delete DynamoDB table

func (*AmazonDynamoDB) DescribeTable

func (d *AmazonDynamoDB) DescribeTable(name string) (*SDK.TableDescription, error)

get infomation of the table

func (*AmazonDynamoDB) GetTable

func (d *AmazonDynamoDB) GetTable(table string) (*DynamoTable, error)

get the DynamoDB table

func (*AmazonDynamoDB) ListTables

func (d *AmazonDynamoDB) ListTables() ([]*string, error)

get the list of DynamoDB table

func (*AmazonDynamoDB) PutAll

func (d *AmazonDynamoDB) PutAll() error

execute put operation for all tables in write spool

type Any

type Any interface{}

type DynamoIndex

type DynamoIndex struct {
	Name      string
	IndexType string
	KeySchema []*SDK.KeySchemaElement
}

DynamoIndex is wrapper struct for Index, used for storing indexes from GetTable's description

func NewDynamoIndex

func NewDynamoIndex(name, typ string, schema []*SDK.KeySchemaElement) *DynamoIndex

NewDynamoIndex returns initialized DynamoIndex

func (*DynamoIndex) GetHashKeyName

func (idx *DynamoIndex) GetHashKeyName() string

GetHashKeyName gets the name of hash key

func (*DynamoIndex) GetRangeKeyName

func (idx *DynamoIndex) GetRangeKeyName() string

GetRangeKeyName gets the name of range key if exist

type DynamoItem

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

wrapped struct for DynamoDB Item (data of each row in RDB concept)

func NewItem

func NewItem() *DynamoItem

Create new empty Item

func (*DynamoItem) AddAttribute

func (item *DynamoItem) AddAttribute(name string, value Any)

Add a attribute to the Item

func (*DynamoItem) AddCondition

func (item *DynamoItem) AddCondition(name string, condition *SDK.ExpectedAttributeValue)

Add a condition for put

func (*DynamoItem) AddConditionEQ

func (item *DynamoItem) AddConditionEQ(name string, value Any)

Add a EQUAL condition for put

func (*DynamoItem) AddConditionExist

func (item *DynamoItem) AddConditionExist(name string)

Add a EXIST condition for put

func (*DynamoItem) AddConditionGE

func (item *DynamoItem) AddConditionGE(name string, value Any)

Add a GREATER THAN or EQUAL condition for put

func (*DynamoItem) AddConditionGT

func (item *DynamoItem) AddConditionGT(name string, value Any)

Add a GREATER THAN condition for put

func (*DynamoItem) AddConditionLE

func (item *DynamoItem) AddConditionLE(name string, value Any)

Add a LESS THAN or EQUAL condition for put

func (*DynamoItem) AddConditionLT

func (item *DynamoItem) AddConditionLT(name string, value Any)

Add a LESS THAN condition for put

func (*DynamoItem) AddConditionNE

func (item *DynamoItem) AddConditionNE(name string, value Any)

Add a NOT EQUAL condition for put

func (*DynamoItem) AddConditionNotExist

func (item *DynamoItem) AddConditionNotExist(name string)

Add a NOT EXIST condition for put

func (*DynamoItem) CountDown

func (item *DynamoItem) CountDown(name string, num int)

Atomic Counter

func (*DynamoItem) CountUp

func (item *DynamoItem) CountUp(name string, num int)

Atomic Counter

type DynamoTable

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

DynamoTable is a wapper struct for DynamoDB table

func (*DynamoTable) AddItem

func (t *DynamoTable) AddItem(item *DynamoItem)

AddItem adds an item to the write-waiting list (writeItem)

func (*DynamoTable) Delete

func (t *DynamoTable) Delete(values ...Any) error

delete item

func (*DynamoTable) DeleteAll

func (t *DynamoTable) DeleteAll() error

[CAUTION] only used this for developing, this performs scan all item and delete it each one by one

func (*DynamoTable) Desc

func (t *DynamoTable) Desc() (*SDK.TableDescription, error)

func (*DynamoTable) Get

func (t *DynamoTable) Get(values ...Any) ([]map[string]interface{}, error)

perform GetOne() or Query()

func (*DynamoTable) GetByIndex

func (t *DynamoTable) GetByIndex(idx string, values ...Any) ([]map[string]interface{}, error)

query using LSI or GSI

func (*DynamoTable) GetHashKeyName

func (t *DynamoTable) GetHashKeyName() string

get the name of hash key

func (*DynamoTable) GetOne

func (t *DynamoTable) GetOne(values ...Any) (map[string]interface{}, error)

GetOne retrieves a single item by GetOne(HashKey [, RangeKey])

func (*DynamoTable) GetRangeKeyName

func (t *DynamoTable) GetRangeKeyName() string

get the name of range key if exist

func (*DynamoTable) Put

func (t *DynamoTable) Put() error

excecute write operation in the write-waiting list (writeItem)

func (*DynamoTable) Query

func (t *DynamoTable) Query(in *SDK.QueryInput) ([]map[string]interface{}, error)

get mapped-items with Query operation

func (*DynamoTable) Scan

func (t *DynamoTable) Scan() ([]map[string]interface{}, error)

get mapped-items with Scan operation

func (*DynamoTable) UpdateReadThroughput

func (t *DynamoTable) UpdateReadThroughput(v int64) error

func (*DynamoTable) UpdateThroughput

func (t *DynamoTable) UpdateThroughput(r int64, w int64) error

func (*DynamoTable) UpdateWriteThroughput

func (t *DynamoTable) UpdateWriteThroughput(v int64) error

type QueryCondition

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

wrapped struct for condition on Query operation

func NewQueryCondition

func NewQueryCondition() *QueryCondition

Create new QueryCondition struct

func (*QueryCondition) Add

func (c *QueryCondition) Add(name string, condition SDK.Condition)

Add a condition for Query operation

func (*QueryCondition) AddEQ

func (c *QueryCondition) AddEQ(name string, value Any)

Add a EQUAL condition for Query operation

func (*QueryCondition) AddGE

func (c *QueryCondition) AddGE(name string, value Any)

Add a GREATER THAN or EQUAL condition for Query operation

func (*QueryCondition) AddGT

func (c *QueryCondition) AddGT(name string, value Any)

Add a GREATER THAN condition for Query operation

func (*QueryCondition) AddLE

func (c *QueryCondition) AddLE(name string, value Any)

Add a LESS THAN or EQUAL condition for Query operation

func (*QueryCondition) AddLT

func (c *QueryCondition) AddLT(name string, value Any)

Add a LESS THAN condition for Query operation

func (*QueryCondition) AddNE

func (c *QueryCondition) AddNE(name string, value Any)

Add a NOT EQUAL condition for Query operation

func (*QueryCondition) UseIndex

func (c *QueryCondition) UseIndex(name string)

Set an Indexname for Query operation

Jump to

Keyboard shortcuts

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