goamz: github.com/goamz/goamz/dynamodb Index | Files

package dynamodb

import "github.com/goamz/goamz/dynamodb"

Index

Package Files

attribute.go const.go dynamodb.go item.go marshaller.go query.go query_builder.go scan.go stream.go table.go update_item.go

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

func MarshalAttributes Uses

func MarshalAttributes(m interface{}) ([]Attribute, error)

func UnmarshalAttributes Uses

func UnmarshalAttributes(attributesRef *map[string]*Attribute, m interface{}) error

type Attribute Uses

type Attribute struct {
    Type      string
    Name      string
    Value     string
    SetValues []string
    Exists    string // exists on dynamodb? Values: "true", "false", or ""
}

func NewBinaryAttribute Uses

func NewBinaryAttribute(name string, value string) *Attribute

func NewBinarySetAttribute Uses

func NewBinarySetAttribute(name string, values []string) *Attribute

func NewNumericAttribute Uses

func NewNumericAttribute(name string, value string) *Attribute

func NewNumericSetAttribute Uses

func NewNumericSetAttribute(name string, values []string) *Attribute

func NewStringAttribute Uses

func NewStringAttribute(name string, value string) *Attribute

func NewStringSetAttribute Uses

func NewStringSetAttribute(name string, values []string) *Attribute

func (*Attribute) SetExists Uses

func (a *Attribute) SetExists(exists bool) *Attribute

func (*Attribute) SetType Uses

func (a *Attribute) SetType() bool

type AttributeComparison Uses

type AttributeComparison struct {
    AttributeName      string
    ComparisonOperator string
    AttributeValueList []Attribute // contains attributes with only types and names (value ignored)
}

func NewBinaryAttributeComparison Uses

func NewBinaryAttributeComparison(attributeName string, comparisonOperator string, value bool) *AttributeComparison

func NewEqualInt64AttributeComparison Uses

func NewEqualInt64AttributeComparison(attributeName string, equalToValue int64) *AttributeComparison

func NewEqualStringAttributeComparison Uses

func NewEqualStringAttributeComparison(attributeName string, equalToValue string) *AttributeComparison

func NewNumericAttributeComparison Uses

func NewNumericAttributeComparison(attributeName string, comparisonOperator string, value int64) *AttributeComparison

func NewStringAttributeComparison Uses

func NewStringAttributeComparison(attributeName string, comparisonOperator string, value string) *AttributeComparison

type AttributeDefinitionT Uses

type AttributeDefinitionT struct {
    Name string `json:"AttributeName"`
    Type string `json:"AttributeType"`
}

func (*AttributeDefinitionT) GetEmptyAttribute Uses

func (a *AttributeDefinitionT) GetEmptyAttribute() *Attribute

type BatchGetItem Uses

type BatchGetItem struct {
    Server *Server
    Keys   map[*Table][]Key
}

func (*BatchGetItem) AddTable Uses

func (batchGetItem *BatchGetItem) AddTable(t *Table, keys *[]Key) *BatchGetItem

func (*BatchGetItem) Execute Uses

func (batchGetItem *BatchGetItem) Execute() (map[string][]map[string]*Attribute, error)

type BatchWriteItem Uses

type BatchWriteItem struct {
    Server      *Server
    ItemActions map[*Table]map[string][][]Attribute
}

func (*BatchWriteItem) AddTable Uses

func (batchWriteItem *BatchWriteItem) AddTable(t *Table, itemActions *map[string][][]Attribute) *BatchWriteItem

func (*BatchWriteItem) Execute Uses

func (batchWriteItem *BatchWriteItem) Execute() (map[string]interface{}, error)

type Error Uses

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)

func (*Error) Error Uses

func (e *Error) Error() string

type GlobalSecondaryIndexT Uses

type GlobalSecondaryIndexT struct {
    IndexName             string
    IndexSizeBytes        int64
    ItemCount             int64
    KeySchema             []KeySchemaT
    Projection            ProjectionT
    ProvisionedThroughput ProvisionedThroughputT
}

type Key Uses

type Key struct {
    HashKey  string
    RangeKey string
}

type KeySchemaT Uses

type KeySchemaT struct {
    AttributeName string
    KeyType       string
}

type LocalSecondaryIndexT Uses

type LocalSecondaryIndexT struct {
    IndexName      string
    IndexSizeBytes int64
    ItemCount      int64
    KeySchema      []KeySchemaT
    Projection     ProjectionT
}

type PrimaryKey Uses

type PrimaryKey struct {
    KeyAttribute   *Attribute
    RangeAttribute *Attribute
}

func (*PrimaryKey) Clone Uses

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 Uses

func (k *PrimaryKey) HasRange() bool

type ProjectionT Uses

type ProjectionT struct {
    ProjectionType string
}

type ProvisionedThroughputT Uses

type ProvisionedThroughputT struct {
    NumberOfDecreasesToday int64
    ReadCapacityUnits      int64
    WriteCapacityUnits     int64
}

type Query Uses

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

func NewEmptyQuery Uses

func NewEmptyQuery() *Query

func NewQuery Uses

func NewQuery(t *Table) *Query

func (*Query) AddAttributesToGet Uses

func (q *Query) AddAttributesToGet(attributes []string)

func (*Query) AddConditionExpression Uses

func (q *Query) AddConditionExpression(expression string)

Add the ConditionExpression parameter, used in UpdateItem queries.

func (*Query) AddCreateRequestTable Uses

func (q *Query) AddCreateRequestTable(description TableDescriptionT)

func (*Query) AddDeleteRequestTable Uses

func (q *Query) AddDeleteRequestTable(description TableDescriptionT)

func (*Query) AddExclusiveStartShardId Uses

func (q *Query) AddExclusiveStartShardId(shardId string)

func (*Query) AddExclusiveStartStreamArn Uses

func (q *Query) AddExclusiveStartStreamArn(arn string)

func (*Query) AddExpected Uses

func (q *Query) AddExpected(attributes []Attribute)

func (*Query) AddExpressionAttributes Uses

func (q *Query) AddExpressionAttributes(attributes []Attribute)

func (*Query) AddGetRequestItems Uses

func (q *Query) AddGetRequestItems(tableKeys map[*Table][]Key)

func (*Query) AddIndex Uses

func (q *Query) AddIndex(value string)

func (*Query) AddItem Uses

func (q *Query) AddItem(attributes []Attribute)

The primary key must be included in attributes.

func (*Query) AddKey Uses

func (q *Query) AddKey(t *Table, key *Key)

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 Uses

func (q *Query) AddKeyConditions(comparisons []AttributeComparison)

func (*Query) AddLimit Uses

func (q *Query) AddLimit(limit int64)

func (*Query) AddParallelScanConfiguration Uses

func (q *Query) AddParallelScanConfiguration(segment int, totalSegments int)

func (*Query) AddReturnValues Uses

func (q *Query) AddReturnValues(returnValues ReturnValues)

Add the ReturnValues parameter, used in UpdateItem queries.

func (*Query) AddScanFilter Uses

func (q *Query) AddScanFilter(comparisons []AttributeComparison)

"ScanFilter":{

"AttributeName1":{"AttributeValueList":[{"S":"AttributeValue"}],"ComparisonOperator":"EQ"}

},

func (*Query) AddSelect Uses

func (q *Query) AddSelect(value string)

func (*Query) AddSequenceNumber Uses

func (q *Query) AddSequenceNumber(sequenceNumber string)

func (*Query) AddShardId Uses

func (q *Query) AddShardId(shardId string)

func (*Query) AddShardIterator Uses

func (q *Query) AddShardIterator(shardIterator string)

func (*Query) AddShardIteratorType Uses

func (q *Query) AddShardIteratorType(shardIteratorType string)

func (*Query) AddStreamArn Uses

func (q *Query) AddStreamArn(arn string)

func (*Query) AddUpdateExpression Uses

func (q *Query) AddUpdateExpression(expression string)

Add the UpdateExpression parameter, used in UpdateItem queries.

func (*Query) AddUpdateRequestTable Uses

func (q *Query) AddUpdateRequestTable(description TableDescriptionT)

func (*Query) AddUpdates Uses

func (q *Query) AddUpdates(attributes []Attribute, action string)

func (*Query) AddWriteRequestItems Uses

func (q *Query) AddWriteRequestItems(tableItems map[*Table]map[string][][]Attribute)

func (*Query) ConsistentRead Uses

func (q *Query) ConsistentRead(c bool)

func (*Query) ScanIndexDescending Uses

func (q *Query) ScanIndexDescending()

func (*Query) String Uses

func (q *Query) String() string

type RecordT Uses

type RecordT struct {
    AwsRegion    string
    EventID      string
    EventName    string
    EventSource  string
    EventVersion string
    StreamRecord *StreamRecordT
}

type ReturnValues Uses

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 Uses

type SequenceNumberRangeT struct {
    EndingSequenceNumber   string
    StartingSequenceNumber string
}

type Server Uses

type Server struct {
    Auth   aws.Auth
    Region aws.Region
}

func (*Server) CreateTable Uses

func (s *Server) CreateTable(tableDescription TableDescriptionT) (string, error)

func (*Server) DeleteTable Uses

func (s *Server) DeleteTable(tableDescription TableDescriptionT) (string, error)

func (*Server) DescribeStream Uses

func (s *Server) DescribeStream(arn, startShardId string) (*StreamDescriptionT, error)

func (*Server) DescribeTable Uses

func (s *Server) DescribeTable(name string) (*TableDescriptionT, error)

func (*Server) GetRecords Uses

func (s *Server) GetRecords(shardIterator string) (string, []*RecordT, error)

func (*Server) GetShardIterator Uses

func (s *Server) GetShardIterator(streamArn, shardId, shardIteratorType, sequenceNumber string) (string, error)

func (*Server) LimitedDescribeStream Uses

func (s *Server) LimitedDescribeStream(arn, startShardId string, limit int64) (*StreamDescriptionT, error)

func (*Server) LimitedGetRecords Uses

func (s *Server) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error)

func (*Server) LimitedListStreams Uses

func (s *Server) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)

func (*Server) LimitedListTableStreams Uses

func (s *Server) LimitedListTableStreams(table, startArn string, limit int64) ([]StreamListItemT, error)

func (*Server) ListStreams Uses

func (s *Server) ListStreams(startArn string) ([]StreamListItemT, error)

func (*Server) ListTableStreams Uses

func (s *Server) ListTableStreams(table, startArn string) ([]StreamListItemT, error)

func (*Server) ListTables Uses

func (s *Server) ListTables() ([]string, error)

func (*Server) NewStream Uses

func (s *Server) NewStream(streamArn string) *Stream

func (*Server) NewTable Uses

func (s *Server) NewTable(name string, key PrimaryKey) *Table

func (*Server) UpdateTable Uses

func (s *Server) UpdateTable(tableDescription TableDescriptionT) (string, error)

type ShardT Uses

type ShardT struct {
    ParentShardId       string
    SequenceNumberRange SequenceNumberRangeT
    ShardId             string
}

type Stream Uses

type Stream struct {
    Server *Server
    Arn    string
}

func (*Stream) DescribeStream Uses

func (s *Stream) DescribeStream(startShardId string) (*StreamDescriptionT, error)

func (*Stream) GetRecords Uses

func (s *Stream) GetRecords(shardIterator string) (string, []*RecordT, error)

func (*Stream) GetShardIterator Uses

func (s *Stream) GetShardIterator(shardId, shardIteratorType, sequenceNumber string) (string, error)

func (*Stream) LimitedDescribeStream Uses

func (s *Stream) LimitedDescribeStream(startShardId string, limit int64) (*StreamDescriptionT, error)

func (*Stream) LimitedGetRecords Uses

func (s *Stream) LimitedGetRecords(shardIterator string, limit int64) (string, []*RecordT, error)

type StreamDescriptionT Uses

type StreamDescriptionT struct {
    CreationDateTime     float64
    KeySchema            []KeySchemaT
    LastEvaluatedShardId string
    Shards               []ShardT
    StreamArn            string
    StreamLabel          string
    StreamStatus         string
    StreamViewType       string
    TableName            string
}

type StreamListItemT Uses

type StreamListItemT struct {
    StreamArn   string
    StreamLabel string
    TableName   string
}

type StreamRecordT Uses

type StreamRecordT struct {
    Keys           map[string]*Attribute
    NewImage       map[string]*Attribute
    OldImage       map[string]*Attribute
    SequenceNumber string
    StreamViewType string
    SizeBytes      int64
}

type StreamSpecificationT Uses

type StreamSpecificationT struct {
    StreamEnabled  bool
    StreamViewType string
}

type Table Uses

type Table struct {
    Server *Server
    Name   string
    Key    PrimaryKey
}

func (*Table) AddAttributes Uses

func (t *Table) AddAttributes(key *Key, attributes []Attribute) (bool, error)

func (*Table) BatchGetItems Uses

func (t *Table) BatchGetItems(keys []Key) *BatchGetItem

func (*Table) BatchWriteItems Uses

func (t *Table) BatchWriteItems(itemActions map[string][][]Attribute) *BatchWriteItem

func (*Table) ConditionalAddAttributes Uses

func (t *Table) ConditionalAddAttributes(key *Key, attributes, expected []Attribute) (bool, error)

func (*Table) ConditionalDeleteAttributes Uses

func (t *Table) ConditionalDeleteAttributes(key *Key, attributes, expected []Attribute) (bool, error)

func (*Table) ConditionalDeleteItem Uses

func (t *Table) ConditionalDeleteItem(key *Key, expected []Attribute) (bool, error)

func (*Table) ConditionalPutItem Uses

func (t *Table) ConditionalPutItem(hashKey, rangeKey string, attributes, expected []Attribute) (bool, error)

func (*Table) ConditionalUpdateAttributes Uses

func (t *Table) ConditionalUpdateAttributes(key *Key, attributes, expected []Attribute) (bool, error)

func (*Table) CountQuery Uses

func (t *Table) CountQuery(attributeComparisons []AttributeComparison) (int64, error)

func (*Table) DeleteAttributes Uses

func (t *Table) DeleteAttributes(key *Key, attributes []Attribute) (bool, error)

func (*Table) DeleteItem Uses

func (t *Table) DeleteItem(key *Key) (bool, error)

func (*Table) DescribeTable Uses

func (t *Table) DescribeTable() (*TableDescriptionT, error)

func (*Table) FetchResults Uses

func (t *Table) FetchResults(query *Query) ([]map[string]*Attribute, error)

func (*Table) GetItem Uses

func (t *Table) GetItem(key *Key) (map[string]*Attribute, error)

func (*Table) GetItemConsistent Uses

func (t *Table) GetItemConsistent(key *Key, consistentRead bool) (map[string]*Attribute, error)

func (*Table) LimitedListStreams Uses

func (t *Table) LimitedListStreams(startArn string, limit int64) ([]StreamListItemT, error)

func (*Table) LimitedQuery Uses

func (t *Table) LimitedQuery(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error)

func (*Table) LimitedQueryDescending Uses

func (t *Table) LimitedQueryDescending(attributeComparisons []AttributeComparison, limit int64) ([]map[string]*Attribute, error)

func (*Table) LimitedQueryOnIndex Uses

func (t *Table) LimitedQueryOnIndex(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error)

func (*Table) LimitedQueryOnIndexDescending Uses

func (t *Table) LimitedQueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string, limit int64) ([]map[string]*Attribute, error)

func (*Table) ListStreams Uses

func (t *Table) ListStreams(startArn string) ([]StreamListItemT, error)

func (*Table) ParallelScan Uses

func (t *Table) ParallelScan(attributeComparisons []AttributeComparison, segment int, totalSegments int) ([]map[string]*Attribute, error)

func (*Table) PutItem Uses

func (t *Table) PutItem(hashKey string, rangeKey string, attributes []Attribute) (bool, error)

func (*Table) Query Uses

func (t *Table) Query(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)

func (*Table) QueryOnIndex Uses

func (t *Table) QueryOnIndex(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error)

func (*Table) QueryOnIndexDescending Uses

func (t *Table) QueryOnIndexDescending(attributeComparisons []AttributeComparison, indexName string) ([]map[string]*Attribute, error)

func (*Table) Scan Uses

func (t *Table) Scan(attributeComparisons []AttributeComparison) ([]map[string]*Attribute, error)

func (*Table) UpdateAttributes Uses

func (t *Table) UpdateAttributes(key *Key, attributes []Attribute) (bool, error)

func (*Table) UpdateItem Uses

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 Uses

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 Uses

func (t *TableDescriptionT) BuildPrimaryKey() (pk PrimaryKey, err error)

type UpdateItem Uses

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

func (*UpdateItem) ConditionExpression Uses

func (u *UpdateItem) ConditionExpression(expression string) *UpdateItem

Specify a check condition for conditional updates.

func (*UpdateItem) Execute Uses

func (u *UpdateItem) Execute() (*UpdateResult, error)

Execute this query.

func (*UpdateItem) ExpressionAttributes Uses

func (u *UpdateItem) ExpressionAttributes(attributes ...Attribute) *UpdateItem

Specify attribute substitutions to be used in expressions.

func (*UpdateItem) ReturnValues Uses

func (u *UpdateItem) ReturnValues(returnValues ReturnValues) *UpdateItem

Specify how return values are to be provided.

func (*UpdateItem) UpdateExpression Uses

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"))

type UpdateResult Uses

type UpdateResult struct {
    Attributes map[string]*Attribute
}

Package dynamodb imports 17 packages (graph) and is imported by 5 packages. Updated 2016-07-18. Refresh now. Tools for package owners.