Documentation ¶
Index ¶
- Variables
- type ConditionCheck
- func (q *ConditionCheck) ConditionExpression(exp string) *ConditionCheck
- func (q *ConditionCheck) ExpressionAttributeName(name string, sub string) *ConditionCheck
- func (q *ConditionCheck) ExpressionAttributeValue(key string, val interface{}, layout ...string) *ConditionCheck
- func (c *ConditionCheck) TableName(name string) *ConditionCheck
- func (c *ConditionCheck) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
- type Config
- type DeleteItem
- func (q *DeleteItem) ConditionExpression(exp string) *DeleteItem
- func (q *DeleteItem) Exec() error
- func (q *DeleteItem) ExpressionAttributeName(name string, sub string) *DeleteItem
- func (q *DeleteItem) ExpressionAttributeValue(key string, val interface{}, layout ...string) *DeleteItem
- func (q *DeleteItem) TableName(name string) *DeleteItem
- func (q *DeleteItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
- type Dynago
- func (d *Dynago) ConditionCheck(item Keyer) *ConditionCheck
- func (d *Dynago) DeleteItem(item Keyer) *DeleteItem
- func (d *Dynago) GetItem(item Keyer) *GetItem
- func (d *Dynago) Marshal(v interface{}) (map[string]*dynamodb.AttributeValue, error)
- func (d *Dynago) PutItem(item Keyer) *PutItem
- func (d *Dynago) Query(items interface{}) *Query
- func (d *Dynago) Scan(items interface{}) *Scan
- func (d *Dynago) TransactionWriteItems() *TransactionWriteItems
- func (d *Dynago) Unmarshal(item map[string]*dynamodb.AttributeValue, v interface{}) error
- func (d *Dynago) UpdateItem(item Keyer) *UpdateItem
- type DynagoAPI
- type Float
- type GetItem
- type Keyer
- type PutItem
- func (q *PutItem) ConditionExpression(exp string) *PutItem
- func (q *PutItem) Exec() error
- func (q *PutItem) ExpressionAttributeName(name string, sub string) *PutItem
- func (q *PutItem) ExpressionAttributeValue(key string, val interface{}, layout ...string) *PutItem
- func (q *PutItem) TableName(table string) *PutItem
- func (q *PutItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
- type Query
- func (q *Query) ConsistentRead(val bool) *Query
- func (q *Query) ExclusiveStartKey(key map[string]*dynamodb.AttributeValue) *Query
- func (q *Query) Exec() error
- func (q *Query) ExpressionAttributeName(name string, sub string) *Query
- func (q *Query) ExpressionAttributeValue(key string, val interface{}, layout ...string) *Query
- func (q *Query) FilterExpression(exp string) *Query
- func (q *Query) IndexName(index string) *Query
- func (q *Query) KeyConditionExpression(exp string) *Query
- func (q *Query) Limit(limit int64) *Query
- func (q *Query) ProjectionExpression(exp string) *Query
- func (q *Query) ScanIndexForward(val bool) *Query
- func (q *Query) Select(attrs string) *Query
- func (q *Query) TableName(name string) *Query
- type Scan
- func (q *Scan) ConsistentRead(val bool) *Scan
- func (q *Scan) ExclusiveStartKey(key map[string]*dynamodb.AttributeValue) *Scan
- func (q *Scan) Exec() error
- func (q *Scan) ExpressionAttributeName(name string, sub string) *Scan
- func (q *Scan) ExpressionAttributeValue(key string, val interface{}, layout ...string) *Scan
- func (q *Scan) FilterExpression(exp string) *Scan
- func (q *Scan) IndexName(index string) *Scan
- func (q *Scan) Limit(limit int64) *Scan
- func (q *Scan) Output(output *ScanOutput) *Scan
- func (q *Scan) ProjectionExpression(exp string) *Scan
- func (q *Scan) Segment(segment int64) *Scan
- func (q *Scan) Select(attrs string) *Scan
- func (q *Scan) TableName(name string) *Scan
- func (q *Scan) TotalSegments(segments int64) *Scan
- type ScanOutput
- type TransactionWriteItemer
- type TransactionWriteItems
- type UpdateItem
- func (q *UpdateItem) ConditionExpression(exp string) *UpdateItem
- func (q *UpdateItem) Exec() error
- func (q *UpdateItem) ExpressionAttributeName(name string, sub string) *UpdateItem
- func (q *UpdateItem) ExpressionAttributeValue(key string, val interface{}, layout ...string) *UpdateItem
- func (q *UpdateItem) TableName(table string) *UpdateItem
- func (q *UpdateItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
- func (q *UpdateItem) UpdateExpression(exp string) *UpdateItem
Constants ¶
This section is empty.
Variables ¶
var ErrItemNotFound = errors.New("item not found")
ErrItemNotFound is returned when the item is not found.
Functions ¶
This section is empty.
Types ¶
type ConditionCheck ¶ added in v0.0.6
type ConditionCheck struct {
// contains filtered or unexported fields
}
ConditionCheck represents a request to perform a check that an item exists or to check the condition of specific attributes of the item.
func (*ConditionCheck) ConditionExpression ¶ added in v0.0.6
func (q *ConditionCheck) ConditionExpression(exp string) *ConditionCheck
ConditionExpression sets the ConditionExpression.
func (*ConditionCheck) ExpressionAttributeName ¶ added in v0.0.6
func (q *ConditionCheck) ExpressionAttributeName(name string, sub string) *ConditionCheck
ExpressionAttributeName sets an ExpressionAttributeName.
func (*ConditionCheck) ExpressionAttributeValue ¶ added in v0.0.6
func (q *ConditionCheck) ExpressionAttributeValue(key string, val interface{}, layout ...string) *ConditionCheck
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*ConditionCheck) TableName ¶ added in v0.0.6
func (c *ConditionCheck) TableName(name string) *ConditionCheck
TableName sets the table to be checked.
func (*ConditionCheck) TransactionWriteItem ¶ added in v0.0.6
func (c *ConditionCheck) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
TransactionWriteItem implements the TransactionWriteItemer interface.
type Config ¶
type Config struct { // AttrTagName specifies which tag is used for a DynamoDB // item attribute name. Defaults to "attr". AttrTagName string // FmtTagName specifies which tag is used to format the attribute // value. This is only used for String types. Defaults to "fmt". FmtTagName string // TypeTagName specifies which tag is used for DynamoDB type. // Defaults to "type". TypeTagName string // LayoutTagName specifies which tag is used for formatting time // values. Defaults to "layout". LayoutTagName string // AttrsToCopyTagName specifies which tag is used to determine // which other attributes should have same value. Defaults to // "copy". AttrsToCopyTagName string // AdditionalAttrs can be added for each dynamodb item. AdditionalAttrs func(map[string]*dynamodb.AttributeValue, reflect.Value) // DefaultTableName is the default table queried when not // specified. DefaultTableName string // DefaultConsistentRead is the default read consistency model. DefaultConsistentRead bool }
Config is used to customize struct tag names.
type DeleteItem ¶
type DeleteItem struct {
// contains filtered or unexported fields
}
DeleteItem represents a delete item operation.
func (*DeleteItem) ConditionExpression ¶ added in v0.0.3
func (q *DeleteItem) ConditionExpression(exp string) *DeleteItem
ConditionExpression sets the ConditionExpression.
func (*DeleteItem) ExpressionAttributeName ¶ added in v0.0.3
func (q *DeleteItem) ExpressionAttributeName(name string, sub string) *DeleteItem
ExpressionAttributeName sets a ExpressionAttributeName.
func (*DeleteItem) ExpressionAttributeValue ¶ added in v0.0.3
func (q *DeleteItem) ExpressionAttributeValue(key string, val interface{}, layout ...string) *DeleteItem
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*DeleteItem) TableName ¶ added in v0.0.3
func (q *DeleteItem) TableName(name string) *DeleteItem
TableName sets the table.
func (*DeleteItem) TransactionWriteItem ¶ added in v0.0.2
func (q *DeleteItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
TransactionWriteItem implements the TransactionWriteItemer interface.
type Dynago ¶
type Dynago struct {
// contains filtered or unexported fields
}
Dynago provides the API operation methods for making requests to Amazon DynamoDB. Dynago methods are safe to use concurrently.
func New ¶
func New(ddb dynamodbiface.DynamoDBAPI, config ...*Config) *Dynago
New creates a new Dynago client. An optional config can be passed in second argument.
func (*Dynago) ConditionCheck ¶ added in v0.0.6
func (d *Dynago) ConditionCheck(item Keyer) *ConditionCheck
ConditionCheck creates a ConditionCheck operation. The given item must have the primary key fields set.
func (*Dynago) DeleteItem ¶
func (d *Dynago) DeleteItem(item Keyer) *DeleteItem
DeleteItem creates a DeleteItem operation.
func (*Dynago) Marshal ¶
func (d *Dynago) Marshal(v interface{}) (map[string]*dynamodb.AttributeValue, error)
Marshal converts a Go struct into a DynamoDB item.
func (*Dynago) TransactionWriteItems ¶ added in v0.0.7
func (d *Dynago) TransactionWriteItems() *TransactionWriteItems
TransactionWriteItems returns a TransactionWriteItems operation.
func (*Dynago) Unmarshal ¶
func (d *Dynago) Unmarshal(item map[string]*dynamodb.AttributeValue, v interface{}) error
Unmarshal converts a DynamoDB item into a Go struct.
func (*Dynago) UpdateItem ¶ added in v0.0.6
func (d *Dynago) UpdateItem(item Keyer) *UpdateItem
UpdateItem returns an UpdateItem operation.
type DynagoAPI ¶ added in v0.0.7
type DynagoAPI interface { DeleteItem(Keyer) *DeleteItem PutItem(Keyer) *PutItem GetItem(Keyer) *GetItem Query(interface{}) *Query Scan(interface{}) *Scan UpdateItem(Keyer) *UpdateItem ConditionCheck(Keyer) *ConditionCheck TransactionWriteItems() *TransactionWriteItems Marshal(interface{}) (map[string]*dynamodb.AttributeValue, error) Unmarshal(map[string]*dynamodb.AttributeValue, interface{}) error }
DynagoAPI provides an interface to enable mocking the dynago.Dynago service client's API operations. This make unit testing your code easier.
type GetItem ¶
type GetItem struct {
// contains filtered or unexported fields
}
GetItem represents a GetItem operation.
func (*GetItem) ConsistentRead ¶ added in v0.0.3
ConsistentRead sets ConsistentRead.
func (*GetItem) ExpressionAttributeName ¶ added in v0.0.3
ExpressionAttributeName sets an ExpressionAttributeName.
func (*GetItem) ProjectionExpression ¶ added in v0.0.3
ProjectionExpression sets the ProjectionExpression.
type PutItem ¶
type PutItem struct {
// contains filtered or unexported fields
}
PutItem represents a PutItem operation.
func (*PutItem) ConditionExpression ¶ added in v0.0.3
ConditionExpression sets the ConditionExpression.
func (*PutItem) ExpressionAttributeName ¶ added in v0.0.3
ExpressionAttributeName sets an ExpressionAttributeName.
func (*PutItem) ExpressionAttributeValue ¶ added in v0.0.3
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*PutItem) TransactionWriteItem ¶ added in v0.0.2
func (q *PutItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
TransactionWriteItem implements the TransactionWriteItemer interface.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query represents a Query operation.
func (*Query) ConsistentRead ¶ added in v0.0.3
ConsistentRead sets ConsistentRead.
func (*Query) ExclusiveStartKey ¶ added in v0.0.3
func (q *Query) ExclusiveStartKey(key map[string]*dynamodb.AttributeValue) *Query
ExclusiveStartKey sets the ExclusiveStartKey.
func (*Query) ExpressionAttributeName ¶ added in v0.0.3
ExpressionAttributeName sets an ExpressionAttributeName.
func (*Query) ExpressionAttributeValue ¶
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*Query) FilterExpression ¶ added in v0.0.3
FilterExpression sets the FilterExpression.
func (*Query) KeyConditionExpression ¶
KeyConditionExpression sets the KeyConditionExpression.
func (*Query) ProjectionExpression ¶ added in v0.0.3
ProjectionExpression sets the ProjectionExpression.
func (*Query) ScanIndexForward ¶ added in v0.0.2
ScanIndexForward sets whether or not to scan index forward.
type Scan ¶ added in v0.0.3
type Scan struct {
// contains filtered or unexported fields
}
Scan represents a Scan operation.
func (*Scan) ConsistentRead ¶ added in v0.0.3
ConsistentRead sets ConsistentRead.
func (*Scan) ExclusiveStartKey ¶ added in v0.0.3
func (q *Scan) ExclusiveStartKey(key map[string]*dynamodb.AttributeValue) *Scan
ExclusiveStartKey sets the ExclusiveStartKey.
func (*Scan) ExpressionAttributeName ¶ added in v0.0.3
ExpressionAttributeName sets an ExpressionAttributeName.
func (*Scan) ExpressionAttributeValue ¶ added in v0.0.3
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*Scan) FilterExpression ¶ added in v0.0.3
FilterExpression sets the FilterExpression.
func (*Scan) Output ¶ added in v0.1.8
func (q *Scan) Output(output *ScanOutput) *Scan
func (*Scan) ProjectionExpression ¶ added in v0.0.3
ProjectionExpression sets the ProjectionExpression.
func (*Scan) TotalSegments ¶ added in v0.0.3
TotalSegments sets TotalSegments.
type ScanOutput ¶ added in v0.1.8
type ScanOutput struct {
LastEvaluatedKey map[string]*dynamodb.AttributeValue
}
ScanOutput represents the output of a scan command.
type TransactionWriteItemer ¶ added in v0.0.2
type TransactionWriteItemer interface {
TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
}
TransactionWriteItemer interface is to provide a dynamodb.TransactWriteItem.
type TransactionWriteItems ¶ added in v0.0.6
type TransactionWriteItems struct {
// contains filtered or unexported fields
}
TransactionWriteItems represents a TransactWriteItems operation.
func (*TransactionWriteItems) ClientRequestToken ¶ added in v0.0.6
func (i *TransactionWriteItems) ClientRequestToken(token string) *TransactionWriteItems
ClientRequestToken sets the ClientRequestToken.
func (*TransactionWriteItems) Exec ¶ added in v0.0.6
func (i *TransactionWriteItems) Exec() error
Exec executes the operation.
func (*TransactionWriteItems) Items ¶ added in v0.0.6
func (i *TransactionWriteItems) Items(items ...TransactionWriteItemer) *TransactionWriteItems
Items adds items to the transaction.
type UpdateItem ¶ added in v0.0.6
type UpdateItem struct {
// contains filtered or unexported fields
}
UpdateItem represents an UpdateItem operation.
func (*UpdateItem) ConditionExpression ¶ added in v0.0.6
func (q *UpdateItem) ConditionExpression(exp string) *UpdateItem
ConditionExpression sets the ConditionExpression.
func (*UpdateItem) Exec ¶ added in v0.0.6
func (q *UpdateItem) Exec() error
Exec executes the operation.
func (*UpdateItem) ExpressionAttributeName ¶ added in v0.0.6
func (q *UpdateItem) ExpressionAttributeName(name string, sub string) *UpdateItem
ExpressionAttributeName sets an ExpressionAttributeName.
func (*UpdateItem) ExpressionAttributeValue ¶ added in v0.0.6
func (q *UpdateItem) ExpressionAttributeValue(key string, val interface{}, layout ...string) *UpdateItem
ExpressionAttributeValue sets an ExpressionAttributeValue.
func (*UpdateItem) TableName ¶ added in v0.0.6
func (q *UpdateItem) TableName(table string) *UpdateItem
TableName sets the TableName.
func (*UpdateItem) TransactionWriteItem ¶ added in v0.0.6
func (q *UpdateItem) TransactionWriteItem() (*dynamodb.TransactWriteItem, error)
TransactionWriteItem implements the TransactionWriteItemer interface.
func (*UpdateItem) UpdateExpression ¶ added in v0.0.6
func (q *UpdateItem) UpdateExpression(exp string) *UpdateItem
UpdateExpression sets the UpdateExpression.