【发布时间】:2018-11-26 15:35:11
【问题描述】:
当我尝试使用下面的代码更新 DynamoDB 时,我得到
ValidationException: ExpressionAttributeValues contains invalid key: Syntax error; key: "approved"
我看不出它为什么无效
type TransactionUpdate struct {
Approved bool `json:"approved"`
Signer int `json:"signer"`
}
var TXkey Transaction
TXkey.TxID = sr.TxID
key, err := dynamodbattribute.MarshalMap(TXkey)
updateData, err := dynamodbattribute.MarshalMap(TransactionUpdate{
Approved: true,
Signer: 1,
})
updateString := "set approved=:a add signers :s"
input := &dynamodb.UpdateItemInput{
Key: key,
TableName: aws.String("Transactions"),
UpdateExpression: aws.String(updateString),
ExpressionAttributeValues: updateData,
ReturnValues: aws.String("ALL_NEW"),
}
result, err := svc.UpdateItem(input)
dynamodbattribute.UnmarshalMap(result.Attributes, &tx)
非常感谢任何帮助
【问题讨论】:
标签: go amazon-dynamodb