mdynamodb

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetItemNotFound = errors.New("record not found")
)

Functions

func Init

func Init(cfg aws.Config)

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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