Documentation
¶
Index ¶
- Constants
- Variables
- func UnmarshalAttributes(attributesRef *map[string]*Attribute, m interface{}) error
- type Attribute
- func MarshalAttributes(m interface{}) ([]Attribute, error)
- func NewBinaryAttribute(name string, value string) *Attribute
- func NewBinarySetAttribute(name string, values []string) *Attribute
- func NewNumericAttribute(name string, value string) *Attribute
- func NewNumericSetAttribute(name string, values []string) *Attribute
- func NewStringAttribute(name string, value string) *Attribute
- func NewStringSetAttribute(name string, values []string) *Attribute
- type AttributeComparison
- func NewBinaryAttributeComparison(attributeName string, comparisonOperator string, value bool) *AttributeComparison
- func NewEqualInt64AttributeComparison(attributeName string, equalToValue int64) *AttributeComparison
- func NewEqualStringAttributeComparison(attributeName string, equalToValue string) *AttributeComparison
- func NewNumericAttributeComparison(attributeName string, comparisonOperator string, value int64) *AttributeComparison
- func NewStringAttributeComparison(attributeName string, comparisonOperator string, value string) *AttributeComparison
- type AttributeDefinitionT
- type BatchGetItem
- type BatchWriteItem
- type Error
- type GlobalSecondaryIndexT
- type Key
- type KeySchemaT
- type LocalSecondaryIndexT
- type PrimaryKey
- type ProjectionT
- type ProvisionedThroughputT
- type Query
- func (q *Query) AddAttributesToGet(attributes []string)
- func (q *Query) AddConditionExpression(expression string)
- func (q *Query) AddCreateRequestTable(description TableDescriptionT)
- func (q *Query) AddDeleteRequestTable(description TableDescriptionT)
- func (q *Query) AddExclusiveStartShardId(shardId string)
- func (q *Query) AddExclusiveStartStreamArn(arn string)
- func (q *Query) AddExpected(attributes []Attribute)
- func (q *Query) AddExpressionAttributes(attributes []Attribute)
- func (q *Query) AddGetRequestItems(tableKeys map[*Table][]Key)
- func (q *Query) AddIndex(value string)
- func (q *Query) AddItem(attributes []Attribute)
- func (q *Query) AddKey(t *Table, key *Key)
- func (q *Query) AddKeyConditions(comparisons []AttributeComparison)
- func (q *Query) AddLimit(limit int64)
- func (q *Query) AddParallelScanConfiguration(segment int, totalSegments int)
- func (q *Query) AddReturnValues(returnValues ReturnValues)
- func (q *Query) AddScanFilter(comparisons []AttributeComparison)
- func (q *Query) AddSelect(value string)
- func (q *Query) AddSequenceNumber(sequenceNumber string)
- func (q *Query) AddShardId(shardId string)
- func (q *Query) AddShardIterator(shardIterator string)
- func (q *Query) AddShardIteratorType(shardIteratorType string)
- func (q *Query) AddStreamArn(arn string)
- func (q *Query) AddUpdateExpression(expression string)
- func (q *Query) AddUpdateRequestTable(description TableDescriptionT)
- func (q *Query) AddUpdates(attributes []Attribute, action string)
- func (q *Query) AddWriteRequestItems(tableItems map[*Table]map[string][][]Attribute)
- func (q *Query) ConsistentRead(c bool)
- func (q *Query) ScanIndexDescending()
- func (q *Query) String() string
- type RecordT
- type ReturnValues
- type SequenceNumberRangeT
- type Server
- func (s *Server) CreateTable(tableDescription TableDescriptionT) (string, error)
- func (s *Server) DeleteTable(tableDescription TableDescriptionT) (string, error)
- func (s *Server) DescribeStream(arn, startShardId string) (*StreamDescriptionT, error)
- func (s *Server) DescribeTable(name string) (*TableDescriptionT, error)
- func (s *Server) GetRecords(shardIterator string) (string, []*RecordT, error)
- func (s *Server) GetShardIterator(streamArn, shardId, shardIteratorType, sequenceNumber string) (string, error)
- func (s *Server) LimitedDescribeStream(arn, startShardId string, limit int64) (*StreamDescriptionT, error)
- func (s *Server) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error)
- func (s *Server) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)
- func (s *Server) LimitedListTableStreams(table, startArn string, limit int64) ([]StreamListItemT, error)
- func (s *Server) ListStreams(startArn string) ([]StreamListItemT, error)
- func (s *Server) ListTableStreams(table, startArn string) ([]StreamListItemT, error)
- func (s *Server) ListTables() ([]string, error)
- func (s *Server) NewStream(streamArn string) *Stream
- func (s *Server) NewTable(name string, key PrimaryKey) *Table
- func (s *Server) UpdateTable(tableDescription TableDescriptionT) (string, error)
- type ShardT
- type Stream
- func (s *Stream) DescribeStream(startShardId string) (*StreamDescriptionT, error)
- func (s *Stream) GetRecords(shardIterator string) (string, []*RecordT, error)
- func (s *Stream) GetShardIterator(shardId, shardIteratorType, sequenceNumber string) (string, error)
- func (s *Stream) LimitedDescribeStream(startShardId string, limit int64) (*StreamDescriptionT, error)
- func (s *Stream) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error)
- type StreamDescriptionT
- type StreamListItemT
- type StreamRecordT
- type StreamSpecificationT
- type Table
- func (t *Table) AddAttributes(key *Key, attributes []Attribute) (bool, error)
- func (t *Table) BatchGetItems(keys []Key) *BatchGetItem
- func (t *Table) BatchWriteItems(itemActions map[string][][]Attribute) *BatchWriteItem
- func (t *Table) ConditionalAddAttributes(key *Key, attributes, expected []Attribute) (bool, error)
- func (t *Table) ConditionalDeleteAttributes(key *Key, attributes, expected []Attribute) (bool, error)
- func (t *Table) ConditionalDeleteItem(key *Key, expected []Attribute) (bool, error)
- func (t *Table) ConditionalPutItem(hashKey, rangeKey string, attributes, expected []Attribute) (bool, error)
- func (t *Table) ConditionalUpdateAttributes(key *Key, attributes, expected []Attribute) (bool, error)
- func (t *Table) CountQuery(attributeComparisons []AttributeComparison) (int64, error)
- func (t *Table) DeleteAttributes(key *Key, attributes []Attribute) (bool, error)
- func (t *Table) DeleteItem(key *Key) (bool, error)
- func (t *Table) DescribeTable() (*TableDescriptionT, error)
- func (t *Table) FetchResults(query *Query) ([]map[string]*Attribute, error)
- func (t *Table) GetItem(key *Key) (map[string]*Attribute, error)
- func (t *Table) GetItemConsistent(key *Key, consistentRead bool) (map[string]*Attribute, error)
- func (t *Table) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)
- func (t *Table) LimitedQuery(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error)
- func (t *Table) LimitedQueryDescending(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error)
- func (t *Table) LimitedQueryOnIndex(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error)
- func (t *Table) LimitedQueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error)
- func (t *Table) ListStreams(startArn string) ([]StreamListItemT, error)
- func (t *Table) ParallelScan(attributeComparisons []AttributeComparison, segment int, totalSegments int) ([]map[string]*Attribute, error)
- func (t *Table) PutItem(hashKey string, rangeKey string, attributes []Attribute) (bool, error)
- func (t *Table) Query(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)
- func (t *Table) QueryOnIndex(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error)
- func (t *Table) QueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error)
- func (t *Table) Scan(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)
- func (t *Table) UpdateAttributes(key *Key, attributes []Attribute) (bool, error)
- func (t *Table) UpdateItem(key *Key) *UpdateItem
- type TableDescriptionT
- type UpdateItem
- func (u *UpdateItem) ConditionExpression(expression string) *UpdateItem
- func (u *UpdateItem) Execute() (*UpdateResult, error)
- func (u *UpdateItem) ExpressionAttributes(attributes ...Attribute) *UpdateItem
- func (u *UpdateItem) ReturnValues(returnValues ReturnValues) *UpdateItem
- func (u *UpdateItem) UpdateExpression(expression string, attributes ...Attribute) *UpdateItem
- type UpdateResult
Constants ¶
const ( TYPE_STRING = "S" TYPE_NUMBER = "N" TYPE_BINARY = "B" TYPE_STRING_SET = "SS" TYPE_NUMBER_SET = "NS" TYPE_BINARY_SET = "BS" COMPARISON_EQUAL = "EQ" COMPARISON_NOT_EQUAL = "NE" COMPARISON_LESS_THAN_OR_EQUAL = "LE" COMPARISON_LESS_THAN = "LT" COMPARISON_GREATER_THAN_OR_EQUAL = "GE" COMPARISON_GREATER_THAN = "GT" COMPARISON_ATTRIBUTE_EXISTS = "NOT_NULL" COMPARISON_ATTRIBUTE_DOES_NOT_EXIST = "NULL" COMPARISON_CONTAINS = "CONTAINS" COMPARISON_DOES_NOT_CONTAIN = "NOT_CONTAINS" COMPARISON_BEGINS_WITH = "BEGINS_WITH" COMPARISON_IN = "IN" COMPARISON_BETWEEN = "BETWEEN" )
const ( // DynamoDBAPIPrefix is the versioned prefix for DynamoDB API commands. DynamoDBAPIPrefix = "DynamoDB_20120810." // DynamoDBStreamsAPIPrefix is the versioned prefix for DynamoDB Streams API commands. DynamoDBStreamsAPIPrefix = "DynamoDBStreams_20120810." )
Variables ¶
var ErrNoRecords = errors.New("No records")
var ErrNotFound = errors.New("Item not found")
Specific error constants
Functions ¶
func UnmarshalAttributes ¶
Types ¶
type Attribute ¶
type Attribute struct { Type string Name string Value string SetValues []string Exists string // exists on dynamodb? Values: "true", "false", or "" }
func MarshalAttributes ¶
func NewBinaryAttribute ¶
func NewBinarySetAttribute ¶
func NewNumericAttribute ¶
func NewNumericSetAttribute ¶
func NewStringAttribute ¶
func NewStringSetAttribute ¶
type AttributeComparison ¶
type AttributeComparison struct { AttributeName string ComparisonOperator string AttributeValueList []Attribute // contains attributes with only types and names (value ignored) }
func NewBinaryAttributeComparison ¶
func NewBinaryAttributeComparison(attributeName string, comparisonOperator string, value bool) *AttributeComparison
func NewEqualInt64AttributeComparison ¶
func NewEqualInt64AttributeComparison(attributeName string, equalToValue int64) *AttributeComparison
func NewEqualStringAttributeComparison ¶
func NewEqualStringAttributeComparison(attributeName string, equalToValue string) *AttributeComparison
func NewNumericAttributeComparison ¶
func NewNumericAttributeComparison(attributeName string, comparisonOperator string, value int64) *AttributeComparison
func NewStringAttributeComparison ¶
func NewStringAttributeComparison(attributeName string, comparisonOperator string, value string) *AttributeComparison
type AttributeDefinitionT ¶
type AttributeDefinitionT struct { Name string `json:"AttributeName"` Type string `json:"AttributeType"` }
func (*AttributeDefinitionT) GetEmptyAttribute ¶
func (a *AttributeDefinitionT) GetEmptyAttribute() *Attribute
type BatchGetItem ¶
func (*BatchGetItem) AddTable ¶
func (batchGetItem *BatchGetItem) AddTable(t *Table, keys *[]Key) *BatchGetItem
type BatchWriteItem ¶
func (*BatchWriteItem) AddTable ¶
func (batchWriteItem *BatchWriteItem) AddTable(t *Table, itemActions *map[string][][]Attribute) *BatchWriteItem
func (*BatchWriteItem) Execute ¶
func (batchWriteItem *BatchWriteItem) Execute() (map[string]interface{}, error)
type Error ¶
type Error struct { StatusCode int // HTTP status code (200, 403, ...) Status string Code string // Dynamodb error code ("MalformedQueryString", ...) Message string // The human-oriented error message }
Error represents an error in an operation with Dynamodb (following goamz/s3)
type GlobalSecondaryIndexT ¶
type GlobalSecondaryIndexT struct { IndexName string IndexSizeBytes int64 ItemCount int64 KeySchema []KeySchemaT Projection ProjectionT ProvisionedThroughput ProvisionedThroughputT }
type KeySchemaT ¶
type LocalSecondaryIndexT ¶
type LocalSecondaryIndexT struct { IndexName string IndexSizeBytes int64 ItemCount int64 KeySchema []KeySchemaT Projection ProjectionT }
type PrimaryKey ¶
func (*PrimaryKey) Clone ¶
func (k *PrimaryKey) Clone(h string, r string) []Attribute
Useful when you may have many goroutines using a primary key, so they don't fuxor up your values.
func (*PrimaryKey) HasRange ¶
func (k *PrimaryKey) HasRange() bool
type ProjectionT ¶
type ProjectionT struct {
ProjectionType string
}
type ProvisionedThroughputT ¶
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func NewEmptyQuery ¶
func NewEmptyQuery() *Query
func (*Query) AddAttributesToGet ¶
func (*Query) AddConditionExpression ¶
Add the ConditionExpression parameter, used in UpdateItem queries.
func (*Query) AddCreateRequestTable ¶
func (q *Query) AddCreateRequestTable(description TableDescriptionT)
func (*Query) AddDeleteRequestTable ¶
func (q *Query) AddDeleteRequestTable(description TableDescriptionT)
func (*Query) AddExclusiveStartShardId ¶
func (*Query) AddExclusiveStartStreamArn ¶
func (*Query) AddExpected ¶
func (*Query) AddExpressionAttributes ¶
func (*Query) AddGetRequestItems ¶
func (*Query) AddKey ¶
This way of specifing the key is used when doing a Get. If rangeKey is "", it is assumed to not want to be used
func (*Query) AddKeyConditions ¶
func (q *Query) AddKeyConditions(comparisons []AttributeComparison)
func (*Query) AddParallelScanConfiguration ¶
func (*Query) AddReturnValues ¶
func (q *Query) AddReturnValues(returnValues ReturnValues)
Add the ReturnValues parameter, used in UpdateItem queries.
func (*Query) AddScanFilter ¶
func (q *Query) AddScanFilter(comparisons []AttributeComparison)
"ScanFilter":{ "AttributeName1":{"AttributeValueList":[{"S":"AttributeValue"}],"ComparisonOperator":"EQ"} },
func (*Query) AddSequenceNumber ¶
func (*Query) AddShardId ¶
func (*Query) AddShardIterator ¶
func (*Query) AddShardIteratorType ¶
func (*Query) AddStreamArn ¶
func (*Query) AddUpdateExpression ¶
Add the UpdateExpression parameter, used in UpdateItem queries.
func (*Query) AddUpdateRequestTable ¶
func (q *Query) AddUpdateRequestTable(description TableDescriptionT)
func (*Query) AddUpdates ¶
func (*Query) AddWriteRequestItems ¶
func (*Query) ConsistentRead ¶
func (*Query) ScanIndexDescending ¶
func (q *Query) ScanIndexDescending()
type ReturnValues ¶
type ReturnValues string
const ( NONE ReturnValues = "NONE" ALL_OLD ReturnValues = "ALL_HOLD" UPDATED_OLD ReturnValues = "UPDATED_OLD" ALL_NEW ReturnValues = "ALL_NEW" UPDATED_NEW ReturnValues = "UPDATED_NEW" )
type SequenceNumberRangeT ¶
type Server ¶
func (*Server) CreateTable ¶
func (s *Server) CreateTable(tableDescription TableDescriptionT) (string, error)
func (*Server) DeleteTable ¶
func (s *Server) DeleteTable(tableDescription TableDescriptionT) (string, error)
func (*Server) DescribeStream ¶
func (s *Server) DescribeStream(arn, startShardId string) (*StreamDescriptionT, error)
func (*Server) DescribeTable ¶
func (s *Server) DescribeTable(name string) (*TableDescriptionT, error)
func (*Server) GetRecords ¶
func (*Server) GetShardIterator ¶
func (*Server) LimitedDescribeStream ¶
func (s *Server) LimitedDescribeStream(arn, startShardId string, limit int64) (*StreamDescriptionT, error)
func (*Server) LimitedGetRecords ¶
func (*Server) LimitedListStreams ¶
func (s *Server) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)
func (*Server) LimitedListTableStreams ¶
func (s *Server) LimitedListTableStreams(table, startArn string, limit int64) ([]StreamListItemT, error)
func (*Server) ListStreams ¶
func (s *Server) ListStreams(startArn string) ([]StreamListItemT, error)
func (*Server) ListTableStreams ¶
func (s *Server) ListTableStreams(table, startArn string) ([]StreamListItemT, error)
func (*Server) ListTables ¶
func (*Server) UpdateTable ¶
func (s *Server) UpdateTable(tableDescription TableDescriptionT) (string, error)
type ShardT ¶
type ShardT struct { ParentShardId string SequenceNumberRange SequenceNumberRangeT ShardId string }
type Stream ¶
func (*Stream) DescribeStream ¶
func (s *Stream) DescribeStream(startShardId string) (*StreamDescriptionT, error)
func (*Stream) GetRecords ¶
func (*Stream) GetShardIterator ¶
func (*Stream) LimitedDescribeStream ¶
func (s *Stream) LimitedDescribeStream(startShardId string, limit int64) (*StreamDescriptionT, error)
type StreamDescriptionT ¶
type StreamListItemT ¶
type StreamRecordT ¶
type StreamSpecificationT ¶
type Table ¶
type Table struct { Server *Server Name string Key PrimaryKey }
func (*Table) AddAttributes ¶
func (*Table) BatchGetItems ¶
func (t *Table) BatchGetItems(keys []Key) *BatchGetItem
func (*Table) BatchWriteItems ¶
func (t *Table) BatchWriteItems(itemActions map[string][][]Attribute) *BatchWriteItem
func (*Table) ConditionalAddAttributes ¶
func (*Table) ConditionalDeleteAttributes ¶
func (*Table) ConditionalDeleteItem ¶
func (*Table) ConditionalPutItem ¶
func (*Table) ConditionalUpdateAttributes ¶
func (*Table) CountQuery ¶
func (t *Table) CountQuery(attributeComparisons []AttributeComparison) (int64, error)
func (*Table) DeleteAttributes ¶
func (*Table) DescribeTable ¶
func (t *Table) DescribeTable() (*TableDescriptionT, error)
func (*Table) FetchResults ¶
func (*Table) GetItemConsistent ¶
func (*Table) LimitedListStreams ¶
func (t *Table) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)
func (*Table) LimitedQuery ¶
func (*Table) LimitedQueryDescending ¶
func (*Table) LimitedQueryOnIndex ¶
func (*Table) LimitedQueryOnIndexDescending ¶
func (*Table) ListStreams ¶
func (t *Table) ListStreams(startArn string) ([]StreamListItemT, error)
func (*Table) ParallelScan ¶
func (*Table) Query ¶
func (t *Table) Query(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)
func (*Table) QueryOnIndex ¶
func (*Table) QueryOnIndexDescending ¶
func (*Table) Scan ¶
func (t *Table) Scan(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)
func (*Table) UpdateAttributes ¶
func (*Table) UpdateItem ¶
func (t *Table) UpdateItem(key *Key) *UpdateItem
Construct an update item query.
The query can be composed via chaining and then executed via Execute()
Usage:
update := table.UpdateItem(key) .ReturnValues(dynamodb.UPDATED_NEW) .UpdateExpression("SET Counter = Counter + :incr") .UpdateCondition("Counter < :checkVal") .ExpressionAttributes(NewNumberAttribute(":incr", "1"), NewNumberAttribute(":checkVal", 42)) result, err := update.Execute() if err == nil { log.Printf("Counter is now %v", result.Attributes["Counter"].Value) }
type TableDescriptionT ¶
type TableDescriptionT struct { AttributeDefinitions []AttributeDefinitionT CreationDateTime float64 ItemCount int64 KeySchema []KeySchemaT GlobalSecondaryIndexes []GlobalSecondaryIndexT LocalSecondaryIndexes []LocalSecondaryIndexT ProvisionedThroughput ProvisionedThroughputT StreamSpecification StreamSpecificationT TableName string TableSizeBytes int64 TableStatus string LatestStreamArn string LatestStreamLabel string }
func (*TableDescriptionT) BuildPrimaryKey ¶
func (t *TableDescriptionT) BuildPrimaryKey() (pk PrimaryKey, err error)
type UpdateItem ¶
type UpdateItem struct {
// contains filtered or unexported fields
}
func (*UpdateItem) ConditionExpression ¶
func (u *UpdateItem) ConditionExpression(expression string) *UpdateItem
Specify a check condition for conditional updates.
func (*UpdateItem) Execute ¶
func (u *UpdateItem) Execute() (*UpdateResult, error)
Execute this query.
func (*UpdateItem) ExpressionAttributes ¶
func (u *UpdateItem) ExpressionAttributes(attributes ...Attribute) *UpdateItem
Specify attribute substitutions to be used in expressions.
func (*UpdateItem) ReturnValues ¶
func (u *UpdateItem) ReturnValues(returnValues ReturnValues) *UpdateItem
Specify how return values are to be provided.
func (*UpdateItem) UpdateExpression ¶
func (u *UpdateItem) UpdateExpression(expression string, attributes ...Attribute) *UpdateItem
Specify an update expression and optional attribute settings at the same time.
update.UpdateExpression("SET Foo = Foo + :incr", dynamodb.NewNumberAttribute(":incr", "7"))
is equivalent to
update.UpdateExpression("SET Foo = Foo + :incr") .ExpressionAttributes(NewNumberAttribute(":incr", "7"))