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 ReqTransactGetItems
- type ReqTransactWriteItems
- type ReqUpdateItem
- type Transact
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrGetItemNotFound = errors.New("record not found")
)
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 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 }
Key: map[string]types.AttributeValue{"UserID": &types.AttributeValueMemberN{Value: "123"}}, UpdateExpression: aws.String("SET Nickname = :u"), ExpressionAttributeValues: map[string]types.AttributeValue{":u": &types.AttributeValueMemberN{Value: "sun"}}, ConditionExpression: "attribute_exists(UserID)",
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.