dynamodb

package
v0.0.0-...-d2b13b0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2013 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrTypeString    = "S"
	AttrTypeNumber    = "N"
	AttrTypeBinary    = "B"
	AttrTypeStringSet = "SS"
	AttrTypeNumberSet = "NS"
	AttrTypeBinarySet = "BS"
)
View Source
const (
	UpdatePut    = "PUT"
	UpdateDelete = "DELETE"
	UpdateAdd    = "ADD"
)
View Source
const (
	CondEQ         = "EQ"
	CondLE         = "LE"
	CondLT         = "LT"
	CondGE         = "GE"
	CondGT         = "GT"
	CondBeginsWith = "BEGINS_WITH"
	CondBetween    = "BETWEEN"
)
View Source
const (
	SelectAllAttributes          = "ALL_ATTRIBUTES"
	SelectAllProjectedAttributes = "ALL_PROJECTED_ATTRIBUTES"
	SelectCount                  = "COUNT"
	SelectSpecificAttributes     = "SPECIFIC_ATTRIBUTES"
)

Variables

This section is empty.

Functions

func IsSetAttribute

func IsSetAttribute(at AttributeType) bool

Types

type Attribute

type Attribute struct {
	Name  string
	Value AttributeValue
}

func (*Attribute) IsEmpty

func (a *Attribute) IsEmpty() bool

func (*Attribute) ToJson

func (a *Attribute) ToJson() string

type AttributeDef

type AttributeDef struct {
	Name string
	Type AttributeType
}

type AttributeType

type AttributeType string

type AttributeValue

type AttributeValue struct {
	Type     AttributeType
	Value    string
	ValueArr []string
}

func (*AttributeValue) IsEmpty

func (av *AttributeValue) IsEmpty() bool

func (*AttributeValue) ToJson

func (av *AttributeValue) ToJson() string

type DynamoDb

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

func New

func New(sc aws.SignatureCredentials, region string) *DynamoDb

func (*DynamoDb) CreateTable

func (d *DynamoDb) CreateTable(tableName string, hashKey *AttributeDef, rangeKey *AttributeDef, readCapacity int, writeCapacity int) error

func (*DynamoDb) DescribeTable

func (d *DynamoDb) DescribeTable(tableName string) (*Table, error)

func (*DynamoDb) Execute

func (d *DynamoDb) Execute(command string, inputJson string) (string, error)

func (*DynamoDb) GetItem

func (d *DynamoDb) GetItem(req *GetItemRequest) (*GetItemResponse, error)

func (*DynamoDb) ListTables

func (d *DynamoDb) ListTables(startTableName string, limit int) ([]string, string, error)

func (*DynamoDb) PutItem

func (d *DynamoDb) PutItem(req *PutItemRequest) error

func (*DynamoDb) Query

func (d *DynamoDb) Query(so *QueryRequest) (*QueryResponse, error)

func (*DynamoDb) Scan

func (d *DynamoDb) Scan(so *ScanRequest) (*ScanResponse, error)

func (*DynamoDb) UpdateItem

func (d *DynamoDb) UpdateItem(req *UpdateItemRequest) error

func (*DynamoDb) WaitForTableState

func (d *DynamoDb) WaitForTableState(tableName string, targetState string, interval time.Duration) error

type GetItemRequest

type GetItemRequest struct {
	TableName      string
	ConsistentRead bool
	HashKey        *Attribute
	RangeKey       *Attribute
	// contains filtered or unexported fields
}

func (*GetItemRequest) AddAttributeToGet

func (so *GetItemRequest) AddAttributeToGet(name string)

type GetItemResponse

type GetItemResponse struct {
	Attributes map[string]*AttributeValue
}

type PutItemRequest

type PutItemRequest struct {
	TableName string
	// contains filtered or unexported fields
}

func (*PutItemRequest) AddAttr

func (pir *PutItemRequest) AddAttr(name string, atype AttributeType, value string)

type QueryAttrRequest

type QueryAttrRequest struct {
	Attr1      *AttributeValue
	Attr2      *AttributeValue
	Comparison string
}

type QueryRequest

type QueryRequest struct {
	TableName      string
	IndexName      string
	Select         string
	Limit          int
	ConsistentRead bool
	// contains filtered or unexported fields
}

func (*QueryRequest) AddAttributeToGet

func (so *QueryRequest) AddAttributeToGet(name string)

func (*QueryRequest) AddCondition

func (so *QueryRequest) AddCondition(name string, attr1 *AttributeValue, attr2 *AttributeValue, comparison string)

type QueryResponse

type QueryResponse struct {
	Count int
	Items []map[string]*AttributeValue
}

type ScanAttrRequest

type ScanAttrRequest struct {
	Attr       AttributeValue
	Comparison string
}

type ScanRequest

type ScanRequest struct {
	TableName       string
	Limit           int
	ScanFilter      map[string]ScanAttrRequest
	StartHashKey    AttributeValue
	StartRangeKey   AttributeValue
	HashKey         string
	AttributesToGet []string
}

func (*ScanRequest) AddAttributeToGet

func (so *ScanRequest) AddAttributeToGet(name string)

func (*ScanRequest) AddScanFilter

func (so *ScanRequest) AddScanFilter(name string, attr AttributeValue, comparison string)

type ScanResponse

type ScanResponse struct {
	Count        int
	ScannedCount int
	Items        []map[string]*AttributeValue
}

type Table

type Table struct {
	Name   string
	Status string
}

type UpdateItemRequest

type UpdateItemRequest struct {
	TableName string
	HashKey   *Attribute
	RangeKey  *Attribute
	// contains filtered or unexported fields
}

func (*UpdateItemRequest) AddExpected

func (pir *UpdateItemRequest) AddExpected(exists bool, name string, atype AttributeType, value string)

func (*UpdateItemRequest) AddUpdate

func (pir *UpdateItemRequest) AddUpdate(action string, name string, atype AttributeType, value string)

Jump to

Keyboard shortcuts

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