Documentation
¶
Index ¶
- Constants
- func UnixDateTimeToTime(dateTime float64) time.Time
- type AttributeDefinition
- type AttributeValue
- type AttributeValueUpdate
- type Capacity
- type Condition
- type ConsumedCapacity
- type CreateTableReq
- type CreateTableResp
- type DeleteItemReq
- type DeleteItemResp
- type DeleteTableReq
- type DeleteTableResp
- type DescribeTableReq
- type DescribeTableResp
- type DynamoDB
- func (this *DynamoDB) CreateTable(req *CreateTableReq) (*CreateTableResp, error)
- func (this *DynamoDB) DeleteItem(req *DeleteItemReq) (*DeleteItemResp, error)
- func (this *DynamoDB) DeleteTable(req *DeleteTableReq) (*DeleteTableResp, error)
- func (this *DynamoDB) DescribeTable(req *DescribeTableReq) (*DescribeTableResp, error)
- func (this *DynamoDB) GetItem(req *GetItemReq) (*GetItemResp, error)
- func (this *DynamoDB) Init(cred *common.Credentials) (*DynamoDB, error)
- func (this *DynamoDB) ListTables(req *ListTablesReq) (*ListTablesResp, error)
- func (this *DynamoDB) PutItem(req *PutItemReq) (*PutItemResp, error)
- func (this *DynamoDB) Query(req *QueryReq) (*QueryResp, error)
- func (this *DynamoDB) Scan(req *ScanReq) (*ScanResp, error)
- func (this *DynamoDB) UpdateItem(req *UpdateItemReq) (*UpdateItemResp, error)
- type DynamoDBReq
- type DynamoDBResp
- type Error
- type ExpectedAttributeValue
- type GetItemReq
- type GetItemResp
- type GlobalSecondaryIndex
- type GlobalSecondaryIndexDescription
- type ItemCollectionMetrics
- type KeySchemaElement
- type ListTablesReq
- type ListTablesResp
- type LocalSecondaryIndex
- type LocalSecondaryIndexDescription
- type Projection
- type ProvisionedThroughput
- type ProvisionedThroughputDescription
- type PutItemReq
- type PutItemResp
- type QueryReq
- type QueryResp
- type ScanReq
- type ScanResp
- type TableDescription
- type UpdateItemReq
- type UpdateItemResp
Constants ¶
const (
DynamoDB_API_VERSION = "20120810"
)
Variables ¶
This section is empty.
Functions ¶
func UnixDateTimeToTime ¶
/ Unix date time to systme time
Types ¶
type AttributeDefinition ¶
type AttributeValue ¶
type AttributeValueUpdate ¶
type AttributeValueUpdate struct { Action string // ADD | PUT | DELETE Value AttributeValue }
type Condition ¶
type Condition struct { ComparisonOperator string // EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN AttributeValueList []AttributeValue }
type ConsumedCapacity ¶
type ConsumedCapacity struct { CapacityUnits float64 GlobalSecondaryIndexes map[string]Capacity LocalSecondaryIndexes map[string]Capacity Table Capacity TableName string }
ref: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ConsumedCapacity.html
type CreateTableReq ¶
type CreateTableReq struct { DynamoDBReq `json:"-"` TableName string KeySchema []KeySchemaElement AttributeDefinitions []AttributeDefinition GlobalSecondaryIndexes []GlobalSecondaryIndex `json:",omitempty"` LocalSecondaryIndexes []LocalSecondaryIndex `json:",omitempty"` ProvisionedThroughput ProvisionedThroughput }
func (*CreateTableReq) Init ¶
func (this *CreateTableReq) Init() *CreateTableReq
type CreateTableResp ¶
type CreateTableResp struct { DynamoDBResp `json:"-"` TableDescription TableDescription }
==================================== CreateTableResp
func (*CreateTableResp) Init ¶
func (this *CreateTableResp) Init(req *CreateTableReq, resp *http.Response) (*CreateTableResp, error)
type DeleteItemReq ¶
type DeleteItemReq struct { DynamoDBReq `json:"-"` TableName string Key map[string]AttributeValue ConditionalOperator string `json:",omitempty"` // "AND", "OR" Expected map[string]ExpectedAttributeValue `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE ReturnItemCollectionMetrics string `json:",omitempty"` // "SIZE", "NONE" ReturnValues string `json:",omitempty"` // NONE | ALL_OLD | UPDATED_OLD | ALL_NEW | UPDATED_NEW }
func (*DeleteItemReq) Init ¶
func (this *DeleteItemReq) Init() *DeleteItemReq
type DeleteItemResp ¶
type DeleteItemResp struct { DynamoDBResp `json:"-"` Attributes map[string]AttributeValue ConsumedCapacity ConsumedCapacity ItemCollectionMetrics ItemCollectionMetrics }
==================================== DeleteItemResp
func (*DeleteItemResp) Init ¶
func (this *DeleteItemResp) Init(req *DeleteItemReq, resp *http.Response) (*DeleteItemResp, error)
type DeleteTableReq ¶
type DeleteTableReq struct { DynamoDBReq `json:"-"` TableName string }
func (*DeleteTableReq) Init ¶
func (this *DeleteTableReq) Init() *DeleteTableReq
type DeleteTableResp ¶
type DeleteTableResp struct { DynamoDBResp `json:"-"` TableDescription TableDescription }
==================================== DeleteTableResp
func (*DeleteTableResp) Init ¶
func (this *DeleteTableResp) Init(req *DeleteTableReq, resp *http.Response) (*DeleteTableResp, error)
type DescribeTableReq ¶
type DescribeTableReq struct { DynamoDBReq `json:"-"` TableName string `json:"TableName"` }
======================================= DescribeTableReq
func (*DescribeTableReq) Init ¶
func (this *DescribeTableReq) Init() *DescribeTableReq
type DescribeTableResp ¶
type DescribeTableResp struct { DynamoDBResp `json:"-"` TableDescription TableDescription `json:"Table"` }
func (*DescribeTableResp) Init ¶
func (this *DescribeTableResp) Init(req *DescribeTableReq, resp *http.Response) (*DescribeTableResp, error)
type DynamoDB ¶
type DynamoDB struct {
common.AWSService
}
*
ref: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/API.html
func NewDynamoDB ¶
func NewDynamoDB(cred *common.Credentials) (*DynamoDB, error)
func (*DynamoDB) CreateTable ¶
func (this *DynamoDB) CreateTable(req *CreateTableReq) (*CreateTableResp, error)
func (*DynamoDB) DeleteItem ¶
func (this *DynamoDB) DeleteItem(req *DeleteItemReq) (*DeleteItemResp, error)
func (*DynamoDB) DeleteTable ¶
func (this *DynamoDB) DeleteTable(req *DeleteTableReq) (*DeleteTableResp, error)
func (*DynamoDB) DescribeTable ¶
func (this *DynamoDB) DescribeTable(req *DescribeTableReq) (*DescribeTableResp, error)
func (*DynamoDB) GetItem ¶
func (this *DynamoDB) GetItem(req *GetItemReq) (*GetItemResp, error)
func (*DynamoDB) ListTables ¶
func (this *DynamoDB) ListTables(req *ListTablesReq) (*ListTablesResp, error)
func (*DynamoDB) PutItem ¶
func (this *DynamoDB) PutItem(req *PutItemReq) (*PutItemResp, error)
func (*DynamoDB) UpdateItem ¶
func (this *DynamoDB) UpdateItem(req *UpdateItemReq) (*UpdateItemResp, error)
type DynamoDBReq ¶
type DynamoDBReq struct {
common.AWSRequest
}
type DynamoDBResp ¶
type DynamoDBResp struct { common.AWSResponse Error *Error // response error code from server }
func (*DynamoDBResp) Init ¶
func (this *DynamoDBResp) Init(req *DynamoDBReq, resp *http.Response) (*DynamoDBResp, error)
type Error ¶
type Error struct { Type string `json:"__type"` Message string `json` Exception string `json:"-"` // parse from type }
*
DynamoDB error handle: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html
type ExpectedAttributeValue ¶
type ExpectedAttributeValue struct { AttributeValueList []AttributeValue `json:",omitempty"` ComparisonOperator string // EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN }
ref: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ExpectedAttributeValue.html
type GetItemReq ¶
type GetItemReq struct { DynamoDBReq `json:"-"` TableName string `json:"TableName"` Key map[string]AttributeValue `json:"Key"` AttributesToGet []string `json:",omitempty"` ConsistentRead bool `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE }
doc: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
func (*GetItemReq) Init ¶
func (this *GetItemReq) Init() *GetItemReq
type GetItemResp ¶
type GetItemResp struct { DynamoDBResp `json:"-"` Attributes map[string]AttributeValue `json:"Item"` ConsumedCapacity ConsumedCapacity }
==================================== GetItemResp
func (*GetItemResp) Init ¶
func (this *GetItemResp) Init(req *GetItemReq, resp *http.Response) (*GetItemResp, error)
type GlobalSecondaryIndex ¶
type GlobalSecondaryIndex struct { IndexName string KeySchema []KeySchemaElement Projection Projection ProvisionedThroughput ProvisionedThroughput }
type GlobalSecondaryIndexDescription ¶
type GlobalSecondaryIndexDescription struct { IndexName string // 3 <= Len(IndexName) <= 255 IndexSizeBytes int64 IndexStatus string // "CREATING", "UPDATING", "DELETING", "ACTIVE" ItemCount int64 KeySchema []KeySchemaElement Projection Projection ProvisionedThroughput ProvisionedThroughputDescription }
type ItemCollectionMetrics ¶
type ItemCollectionMetrics struct { ItemCollectionKey map[string]AttributeValue SizeEstimateRangeGB []float64 }
type KeySchemaElement ¶
type ListTablesReq ¶
type ListTablesReq struct { DynamoDBReq `json:"-"` ExclusiveStartTableName string `json:",omitempty"` Limit uint `json:",string,omitempty"` }
========================== ListTablesReq
func (*ListTablesReq) Init ¶
func (this *ListTablesReq) Init() *ListTablesReq
func (*ListTablesReq) WithExclusiveStartTableName ¶
func (this *ListTablesReq) WithExclusiveStartTableName(exclusive string) *ListTablesReq
type ListTablesResp ¶
type ListTablesResp struct { DynamoDBResp `json:"-"` TableNames []string LastEvaluatedTableName string }
================================= ListTablesResp
func (*ListTablesResp) Init ¶
func (this *ListTablesResp) Init(req *ListTablesReq, resp *http.Response) (*ListTablesResp, error)
type LocalSecondaryIndex ¶
type LocalSecondaryIndex struct { IndexName string KeySchema []KeySchemaElement Projection Projection }
type LocalSecondaryIndexDescription ¶
type LocalSecondaryIndexDescription struct { IndexName string // 3 <= Len(IndexName) <= 255 IndexSizeBytes int64 ItemCount int64 KeySchema []KeySchemaElement Projection Projection }
type Projection ¶
type ProvisionedThroughput ¶
type ProvisionedThroughputDescription ¶
type ProvisionedThroughputDescription struct { LastDecreaseDateTime float64 LastIncreaseDateTime float64 NumberOfDecreasesToday int64 ReadCapacityUnits int64 WriteCapacityUnits int64 }
func (*ProvisionedThroughputDescription) LastDecreaseTime ¶
func (this *ProvisionedThroughputDescription) LastDecreaseTime() time.Time
func (*ProvisionedThroughputDescription) LastIncreaseTime ¶
func (this *ProvisionedThroughputDescription) LastIncreaseTime() time.Time
type PutItemReq ¶
type PutItemReq struct { DynamoDBReq `json:"-"` TableName string Attributes map[string]AttributeValue `json:"Item"` ConditionalOperator string `json:",omitempty"` // "AND", "OR" Expected map[string]ExpectedAttributeValue `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE ReturnItemCollectionMetrics string `json:",omitempty"` // "SIZE", "NONE" ReturnValues string `json:",omitempty"` // NONE | ALL_OLD | UPDATED_OLD | ALL_NEW | UPDATED_NEW }
func (*PutItemReq) Init ¶
func (this *PutItemReq) Init() *PutItemReq
type PutItemResp ¶
type PutItemResp struct { DynamoDBResp `json:"-"` Attributes map[string]AttributeValue ConsumedCapacity ConsumedCapacity ItemCollectionMetrics ItemCollectionMetrics }
func (*PutItemResp) Init ¶
func (this *PutItemResp) Init(req *PutItemReq, resp *http.Response) (*PutItemResp, error)
type QueryReq ¶
type QueryReq struct { DynamoDBReq TableName string `json:"TableName"` KeyConditions map[string]Condition Select string `json:",omitempty"` // ALL_ATTRIBUTES | ALL_PROJECTED_ATTRIBUTES | SPECIFIC_ATTRIBUTES | COUNT AttributesToGet []string `json:",omitempty"` IndexName string `json:",omitempty"` ConsistentRead bool ScanIndexForward bool ConditionalOperator string `json:",omitempty"` // "AND", "OR" // A logical operator to apply to the conditions in the QueryFilter map QueryFilter map[string]Condition `json:",omitempty"` Limit int `json:",omitempty"` ExclusiveStartKey map[string]AttributeValue `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE }
==================================== QueryReq ref: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
type QueryResp ¶
type QueryResp struct { DynamoDBResp `json:"-"` Count int ScannedCount int Items []map[string]AttributeValue LastEvaluatedKey map[string]AttributeValue ConsumedCapacity ConsumedCapacity }
type ScanReq ¶
type ScanReq struct { DynamoDBReq `json:"-"` TableName string `json:"TableName"` Select string `json:",omitempty"` // ALL_ATTRIBUTES | ALL_PROJECTED_ATTRIBUTES | SPECIFIC_ATTRIBUTES | COUNT AttributesToGet []string `json:",omitempty"` ExclusiveStartKey map[string]AttributeValue `json:",omitempty"` Limit int `json:",omitempty"` ConditionalOperator string `json:",omitempty"` // "AND", "OR" ScanFilter map[string]Condition `json:",omitempty"` TotalSegments int `json:",omitempty"` Segment int `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE }
type ScanResp ¶
type ScanResp struct { DynamoDBResp `json:"-"` Count int ScannedCount int Items []map[string]AttributeValue LastEvaluatedKey map[string]AttributeValue ConsumedCapacity ConsumedCapacity }
================================== ScanResp
type TableDescription ¶
type TableDescription struct { TableName string // 3 <= Len(TableName) <= 255 TableSizeBytes int64 TableStatus string // "CREATING", "UPDATING", "DELETING", "ACTIVE" ItemCount int64 CreationDateTime float64 AttributeDefinitions []AttributeDefinition KeySchema []KeySchemaElement LocalSecondaryIndexes []LocalSecondaryIndexDescription ProvisionedThroughput ProvisionedThroughputDescription GlobalSecondaryIndexes []GlobalSecondaryIndexDescription }
================================= DescribeTableResp ref: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TableDescription.html
func (*TableDescription) CreationTime ¶
func (this *TableDescription) CreationTime() time.Time
type UpdateItemReq ¶
type UpdateItemReq struct { DynamoDBReq `json:"-"` TableName string Key map[string]AttributeValue AttributeUpdates map[string]AttributeValueUpdate ConditionalOperator string `json:",omitempty"` // "AND", "OR" Expected map[string]ExpectedAttributeValue `json:",omitempty"` ReturnConsumedCapacity string `json:",omitempty"` // INDEXES | TOTAL | NONE ReturnItemCollectionMetrics string `json:",omitempty"` // "SIZE", "NONE" ReturnValues string `json:",omitempty"` // NONE | ALL_OLD | UPDATED_OLD | ALL_NEW | UPDATED_NEW }
func (*UpdateItemReq) Init ¶
func (this *UpdateItemReq) Init() *UpdateItemReq
type UpdateItemResp ¶
type UpdateItemResp struct { DynamoDBResp `json:"-"` Attributes map[string]AttributeValue ConsumedCapacity ConsumedCapacity ItemCollectionMetrics ItemCollectionMetrics }
==================================== UpdateItemResp
func (*UpdateItemResp) Init ¶
func (this *UpdateItemResp) Init(req *UpdateItemReq, resp *http.Response) (*UpdateItemResp, error)