Documentation
¶
Index ¶
- Variables
- func Init(cfg aws.Config)
- func NewItemDao(tableName string) *dynamodbItem
- func NewTableDao(tableName string) *dynamodbTable
- type ReqBatchGetItem
- type ReqBatchWriteItem
- type ReqDeleteItem
- type ReqGetItem
- type ReqPutItem
- type ReqQueryInput
- type ReqTransactGetItems
- type ReqTransactWriteItems
- type ReqUpdateItem
- type Transact
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRecordNotFound = errors.New("record not found") ErrQueryThanOne = errors.New("query than one") )
Functions ¶
func NewItemDao ¶
func NewItemDao(tableName string) *dynamodbItem
func NewTableDao ¶
func NewTableDao(tableName string) *dynamodbTable
Types ¶
type ReqBatchGetItem ¶
type ReqBatchGetItem struct {
RequestItems map[string]types.KeysAndAttributes
}
itemDao.ReqBatchGetItem = mdynamodb.ReqBatchGetItem{ RequestItems: map[string]types.KeysAndAttributes{ "User": { Keys: []map[string]types.AttributeValue{ { "UserID": &types.AttributeValueMemberN{ Value: "123", }, }, }, }, }, }
type ReqBatchWriteItem ¶
type ReqBatchWriteItem struct {
RequestItems map[string][]types.WriteRequest
}
type ReqDeleteItem ¶
type ReqDeleteItem struct { Key map[string]types.AttributeValue ConditionExpression *string ExpressionAttributeNames map[string]string ExpressionAttributeValues map[string]types.AttributeValue ReturnValues types.ReturnValue }
Key: map[string]types.AttributeValue{"UserID": &types.AttributeValueMemberN{Value: "123"}},
type ReqGetItem ¶
type ReqGetItem struct { Key map[string]types.AttributeValue ConsistentRead *bool }
dao.ReqGetItem = mdynamodb.ReqGetItem{ Key: map[string]types.AttributeValue{ "UserID": &types.AttributeValueMemberN{Value: cast.ToString(req.UserID)}, }, }
type ReqPutItem ¶
type ReqPutItem struct { ItemMap map[string]types.AttributeValue ConditionExpression *string ExpressionAttributeNames map[string]string ExpressionAttributeValues map[string]types.AttributeValue }
ItemMap: map[string]types.AttributeValue{"UserID": &types.AttributeValueMemberN{Value: "123"}}, ConditionExpression: "attribute_not_exists(UserID)",
type ReqQueryInput ¶ added in v1.0.5
type ReqQueryInput struct { IndexName *string KeyConditionExpression *string FilterExpression *string ExpressionAttributeNames map[string]string ExpressionAttributeValues map[string]types.AttributeValue ExclusiveStartKey map[string]types.AttributeValue Limit *int32 ScanIndexForward *bool Select types.Select }
type ReqTransactGetItems ¶
type ReqTransactGetItems struct {
TransactItems []types.TransactGetItem
}
transcatDao.ReqTransactGetItems = mdynamodb.ReqTransactGetItems{ TransactItems: []types.TransactGetItem{ { Get: &types.Get{ Key: map[string]types.AttributeValue{"UserID": &types.AttributeValueMemberN{Value: "123"}}, TableName: aws.String("User"), ProjectionExpression: aws.String("UserID"), }, }, }, }
type ReqTransactWriteItems ¶
type ReqTransactWriteItems struct { TransactItems []types.TransactWriteItem ClientRequestToken *string }
type ReqUpdateItem ¶
type ReqUpdateItem struct { Key map[string]types.AttributeValue ConditionExpression *string UpdateExpression *string ExpressionAttributeNames map[string]string ExpressionAttributeValues map[string]types.AttributeValue ReturnValues types.ReturnValue }
exp, err := expression.NewBuilder().
WithUpdate(expression.Set(expression.Name("LastLoginAt"), expression.Value(time.Now().Unix()))). WithCondition(expression.AttributeExists(expression.Name("UserID"))). Build()
Key: map[string]types.AttributeValue{"UserID": &types.AttributeValueMemberN{Value: "123"}}, UpdateExpression: exp.Update(), ExpressionAttributeNames: exp.Names(), ExpressionAttributeValues: exp.Values(), ConditionExpression: exp.Condition(),
type Transact ¶
type Transact struct { }
func NewTransactDao ¶
func NewTransactDao() *Transact
func (*Transact) TransactGetItems ¶
func (item *Transact) TransactGetItems(req ReqTransactGetItems) (*dynamodb.TransactGetItemsOutput, error)
func (*Transact) TransactWriteItems ¶
func (item *Transact) TransactWriteItems(req ReqTransactWriteItems) (*dynamodb.TransactWriteItemsOutput, error)
Click to show internal directories.
Click to hide internal directories.