Documentation ¶
Index ¶
- Constants
- func Boolean(v bool) *bool
- func Long(v int64) *int64
- func Marshal(item map[string]interface{}) map[string]*SDK.AttributeValue
- func MarshalStringSlice(item Any) []*string
- func NewAttributeDefinition(attrName, attrType string) *SDK.AttributeDefinition
- func NewAttributeDefinitions(attr ...*SDK.AttributeDefinition) []*SDK.AttributeDefinition
- func NewBoolAttribute(attrName string) *SDK.AttributeDefinition
- func NewByteAttribute(attrName string) *SDK.AttributeDefinition
- func NewCondition(value Any, operator string) SDK.Condition
- func NewExpected() *SDK.ExpectedAttributeValue
- func NewExpectedCondition(value Any, operator string) *SDK.ExpectedAttributeValue
- func NewGSI(name string, schema []*SDK.KeySchemaElement, tp *SDK.ProvisionedThroughput, ...) *SDK.GlobalSecondaryIndex
- func NewHashKeyElement(keyName string) *SDK.KeySchemaElement
- func NewKeyElement(keyName, keyType string) *SDK.KeySchemaElement
- func NewKeySchema(elements ...*SDK.KeySchemaElement) []*SDK.KeySchemaElement
- func NewLSI(name string, schema []*SDK.KeySchemaElement, projection ...string) *SDK.LocalSecondaryIndex
- func NewNumberAttribute(attrName string) *SDK.AttributeDefinition
- func NewProvisionedThroughput(read, write int64) *SDK.ProvisionedThroughput
- func NewRangeKeyElement(keyName string) *SDK.KeySchemaElement
- func NewStringAttribute(attrName string) *SDK.AttributeDefinition
- func String(v string) *string
- func Unmarshal(item map[string]*SDK.AttributeValue) map[string]interface{}
- type AmazonDynamoDB
- func (d *AmazonDynamoDB) CreateTable(ct *CreateTableInput) error
- func (d *AmazonDynamoDB) DeleteTable(name string) error
- func (d *AmazonDynamoDB) DeleteTableWithPrefix(name string) error
- func (d *AmazonDynamoDB) DescribeTable(name string) (*TableDescription, error)
- func (d *AmazonDynamoDB) DescribeTableWithPrefix(name string) (*TableDescription, error)
- func (d *AmazonDynamoDB) GetTable(table string) (*DynamoTable, error)
- func (d *AmazonDynamoDB) ListTables() ([]*string, error)
- func (d *AmazonDynamoDB) PutAll() error
- type Any
- type CreateTableInput
- func (ct *CreateTableInput) AddGSIN(name, hashKey string)
- func (ct *CreateTableInput) AddGSINN(name, hashKey, rangeKey string)
- func (ct *CreateTableInput) AddGSINS(name, hashKey, rangeKey string)
- func (ct *CreateTableInput) AddGSIS(name, hashKey string)
- func (ct *CreateTableInput) AddGSISN(name, hashKey, rangeKey string)
- func (ct *CreateTableInput) AddGSISS(name, hashKey, rangeKey string)
- func (ct *CreateTableInput) AddLSIN(name, keyName string)
- func (ct *CreateTableInput) AddLSIS(name, keyName string)
- func (ct *CreateTableInput) AddRangeKeyN(keyName string)
- func (ct *CreateTableInput) AddRangeKeyS(keyName string)
- func (ct *CreateTableInput) AttributeList() []*SDK.AttributeDefinition
- func (ct *CreateTableInput) HasGSI() bool
- func (ct *CreateTableInput) HasLSI() bool
- func (ct *CreateTableInput) HasRangeKey() bool
- func (ct *CreateTableInput) ListGSI() []*SDK.GlobalSecondaryIndex
- func (ct *CreateTableInput) ListLSI() []*SDK.LocalSecondaryIndex
- func (ct *CreateTableInput) SetThroughput(r, w int64)
- type DynamoError
- type DynamoIndex
- type DynamoItem
- func (item *DynamoItem) AddAttribute(name string, value Any)
- func (item *DynamoItem) AddCondition(name string, condition *SDK.ExpectedAttributeValue)
- func (item *DynamoItem) AddConditionEQ(name string, value Any)
- func (item *DynamoItem) AddConditionExist(name string)
- func (item *DynamoItem) AddConditionGE(name string, value Any)
- func (item *DynamoItem) AddConditionGT(name string, value Any)
- func (item *DynamoItem) AddConditionLE(name string, value Any)
- func (item *DynamoItem) AddConditionLT(name string, value Any)
- func (item *DynamoItem) AddConditionNE(name string, value Any)
- func (item *DynamoItem) AddConditionNotExist(name string)
- func (item *DynamoItem) CountDown(name string, num int)
- func (item *DynamoItem) CountUp(name string, num int)
- func (item *DynamoItem) GetAttribute(name string) Any
- type DynamoTable
- func (t *DynamoTable) AddItem(item *DynamoItem)
- func (t *DynamoTable) Delete(values ...Any) error
- func (t *DynamoTable) DeleteAll() error
- func (t *DynamoTable) Desc() (*TableDescription, error)
- func (t *DynamoTable) Get(values ...Any) ([]map[string]interface{}, error)
- func (t *DynamoTable) GetByIndex(idx string, values ...Any) ([]map[string]interface{}, error)
- func (t *DynamoTable) GetHashKeyName() string
- func (t *DynamoTable) GetOne(values ...Any) (map[string]interface{}, error)
- func (t *DynamoTable) GetRangeKeyName() string
- func (t *DynamoTable) NewQuery() *Query
- func (t *DynamoTable) Put() error
- func (t *DynamoTable) Query(in *SDK.QueryInput) ([]map[string]interface{}, error)
- func (t *DynamoTable) Scan() ([]map[string]interface{}, error)
- func (t *DynamoTable) UpdateReadThroughput(v int64) error
- func (t *DynamoTable) UpdateThroughput(r int64, w int64) error
- func (t *DynamoTable) UpdateWriteThroughput(v int64) error
- type Query
- func (q *Query) AndBETWEEN(key string, from, to interface{})
- func (q *Query) AndEQ(key string, val interface{})
- func (q *Query) AndGE(key string, val interface{})
- func (q *Query) AndGT(key string, val interface{})
- func (q *Query) AndLE(key string, val interface{})
- func (q *Query) AndLT(key string, val interface{})
- func (q *Query) Count() (*QueryResult, error)
- func (q *Query) HasCondition() bool
- func (q *Query) HasIndex() bool
- func (q *Query) HasLimit() bool
- func (q *Query) Index(v string)
- func (q *Query) Limit(i int64)
- func (q *Query) Query() (*QueryResult, error)
- type QueryCondition
- func (c *QueryCondition) Add(name string, condition SDK.Condition)
- func (c *QueryCondition) AddEQ(name string, value Any)
- func (c *QueryCondition) AddGE(name string, value Any)
- func (c *QueryCondition) AddGT(name string, value Any)
- func (c *QueryCondition) AddLE(name string, value Any)
- func (c *QueryCondition) AddLT(name string, value Any)
- func (c *QueryCondition) AddNE(name string, value Any)
- func (c *QueryCondition) UseIndex(name string)
- type QueryResult
- type TableDescription
- func (d TableDescription) GetItemCount() int64
- func (d TableDescription) GetKeyAttributes() map[string]string
- func (d TableDescription) GetNumberOfDecreasesToday() int64
- func (d TableDescription) GetReadCapacityUnits() int64
- func (d TableDescription) GetTableName() string
- func (d TableDescription) GetTableStatus() string
- func (d TableDescription) GetWriteCapacityUnits() int64
- func (d TableDescription) IsActive() bool
Constants ¶
const ( ComparisonOperatorEQ = "EQ" ComparisonOperatorNE = "NE" ComparisonOperatorGT = "GT" ComparisonOperatorLT = "LT" ComparisonOperatorGE = "GE" ComparisonOperatorLE = "LE" )
const ( KeyTypeHash = "HASH" KeyTypeRange = "RANGE" )
const ( ProjectionTypeAll = "ALL" ProjectionTypeKeysOnly = "KEYS_ONLY" )
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(item map[string]interface{}) map[string]*SDK.AttributeValue
Convert map to DynamoDb Item data
func MarshalStringSlice ¶
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 ¶
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
Types ¶
type AmazonDynamoDB ¶
type AmazonDynamoDB struct { TablePrefix string // contains filtered or unexported fields }
wrapped struct for DynamoDB
func NewClientWithKeys ¶
func NewClientWithKeys(k auth.Keys) *AmazonDynamoDB
Create new AmazonDynamoDB struct
func (*AmazonDynamoDB) CreateTable ¶
func (d *AmazonDynamoDB) CreateTable(ct *CreateTableInput) error
Create new DynamoDB table
func (*AmazonDynamoDB) DeleteTable ¶
func (d *AmazonDynamoDB) DeleteTable(name string) error
Delete DynamoDB table
func (*AmazonDynamoDB) DeleteTableWithPrefix ¶ added in v0.9.2
func (d *AmazonDynamoDB) DeleteTableWithPrefix(name string) error
Delete DynamoDB table
func (*AmazonDynamoDB) DescribeTable ¶
func (d *AmazonDynamoDB) DescribeTable(name string) (*TableDescription, error)
get infomation of the table
func (*AmazonDynamoDB) DescribeTableWithPrefix ¶ added in v0.9.2
func (d *AmazonDynamoDB) DescribeTableWithPrefix(name string) (*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 CreateTableInput ¶ added in v0.9.2
type CreateTableInput struct { Name string HashKey *SDK.KeySchemaElement RangeKey *SDK.KeySchemaElement LSI []*SDK.LocalSecondaryIndex GSI []*SDK.GlobalSecondaryIndex ReadCapacity int64 WriteCapacity int64 Attributes map[string]*SDK.AttributeDefinition }
CreateTableInput is wrapper struct for CreateTable operation
func NewCreateTableWithHashKeyN ¶ added in v0.9.2
func NewCreateTableWithHashKeyN(tableName, keyName string) *CreateTableInput
NewCreateTableWithHashKeyN returns create table request data for number hashkey
func NewCreateTableWithHashKeyS ¶ added in v0.9.2
func NewCreateTableWithHashKeyS(tableName, keyName string) *CreateTableInput
NewCreateTableWithHashKeyS returns create table request data for string hashkey
func (*CreateTableInput) AddGSIN ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSIN(name, hashKey string)
func (*CreateTableInput) AddGSINN ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSINN(name, hashKey, rangeKey string)
func (*CreateTableInput) AddGSINS ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSINS(name, hashKey, rangeKey string)
func (*CreateTableInput) AddGSIS ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSIS(name, hashKey string)
func (*CreateTableInput) AddGSISN ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSISN(name, hashKey, rangeKey string)
func (*CreateTableInput) AddGSISS ¶ added in v0.9.2
func (ct *CreateTableInput) AddGSISS(name, hashKey, rangeKey string)
func (*CreateTableInput) AddLSIN ¶ added in v0.9.2
func (ct *CreateTableInput) AddLSIN(name, keyName string)
func (*CreateTableInput) AddLSIS ¶ added in v0.9.2
func (ct *CreateTableInput) AddLSIS(name, keyName string)
func (*CreateTableInput) AddRangeKeyN ¶ added in v0.9.2
func (ct *CreateTableInput) AddRangeKeyN(keyName string)
func (*CreateTableInput) AddRangeKeyS ¶ added in v0.9.2
func (ct *CreateTableInput) AddRangeKeyS(keyName string)
func (*CreateTableInput) AttributeList ¶ added in v0.9.2
func (ct *CreateTableInput) AttributeList() []*SDK.AttributeDefinition
func (*CreateTableInput) HasGSI ¶ added in v0.9.2
func (ct *CreateTableInput) HasGSI() bool
func (*CreateTableInput) HasLSI ¶ added in v0.9.2
func (ct *CreateTableInput) HasLSI() bool
func (*CreateTableInput) HasRangeKey ¶ added in v0.9.2
func (ct *CreateTableInput) HasRangeKey() bool
func (*CreateTableInput) ListGSI ¶ added in v0.9.2
func (ct *CreateTableInput) ListGSI() []*SDK.GlobalSecondaryIndex
func (*CreateTableInput) ListLSI ¶ added in v0.9.2
func (ct *CreateTableInput) ListLSI() []*SDK.LocalSecondaryIndex
func (*CreateTableInput) SetThroughput ¶ added in v0.9.2
func (ct *CreateTableInput) SetThroughput(r, w int64)
type DynamoError ¶ added in v0.9.2
type DynamoError struct {
// contains filtered or unexported fields
}
func NewError ¶ added in v0.9.2
func NewError(msg string) *DynamoError
func NewErrorList ¶ added in v0.9.2
func NewErrorList(msgList []string) *DynamoError
func (*DynamoError) AddMessage ¶ added in v0.9.2
func (e *DynamoError) AddMessage(msg string)
func (DynamoError) Error ¶ added in v0.9.2
func (e DynamoError) Error() string
func (*DynamoError) HasError ¶ added in v0.9.2
func (e *DynamoError) HasError() bool
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 (*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) GetAttribute ¶ added in v0.9.2
func (item *DynamoItem) GetAttribute(name string) Any
Get a attribute from Item
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) 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() (*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) NewQuery ¶ added in v0.9.2
func (t *DynamoTable) NewQuery() *Query
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 Query ¶ added in v0.9.2
type Query struct {
// contains filtered or unexported fields
}
func (*Query) AndBETWEEN ¶ added in v0.9.2
func (*Query) Count ¶ added in v0.9.2
func (q *Query) Count() (*QueryResult, error)
func (*Query) HasCondition ¶ added in v0.9.2
func (*Query) Query ¶ added in v0.9.2
func (q *Query) Query() (*QueryResult, error)
type QueryCondition ¶
type QueryCondition struct {
// contains filtered or unexported fields
}
wrapped struct for condition on Query operation
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
type QueryResult ¶ added in v0.9.2
type QueryResult struct { Items []map[string]*SDK.AttributeValue LastEvaluatedKey map[string]*SDK.AttributeValue Count int64 ScannedCount int64 }
func (QueryResult) ToSliceMap ¶ added in v0.9.2
func (r QueryResult) ToSliceMap() []map[string]interface{}
type TableDescription ¶ added in v0.9.2
type TableDescription struct {
*SDK.TableDescription
}
TableDescription is wrapper struct fro SDK.TableDescription
func (TableDescription) GetItemCount ¶ added in v0.9.2
func (d TableDescription) GetItemCount() int64
func (TableDescription) GetKeyAttributes ¶ added in v0.9.2
func (d TableDescription) GetKeyAttributes() map[string]string
func (TableDescription) GetNumberOfDecreasesToday ¶ added in v0.9.2
func (d TableDescription) GetNumberOfDecreasesToday() int64
func (TableDescription) GetReadCapacityUnits ¶ added in v0.9.2
func (d TableDescription) GetReadCapacityUnits() int64
func (TableDescription) GetTableName ¶ added in v0.9.2
func (d TableDescription) GetTableName() string
func (TableDescription) GetTableStatus ¶ added in v0.9.2
func (d TableDescription) GetTableStatus() string
func (TableDescription) GetWriteCapacityUnits ¶ added in v0.9.2
func (d TableDescription) GetWriteCapacityUnits() int64
func (TableDescription) IsActive ¶ added in v0.9.2
func (d TableDescription) IsActive() bool