I am querying a value in dynamodb but I get the error "The supplied key element does not match the schema".
{
"id": {
"S": "c8f8fd5d-a483-4a4e-8adf-75c4134678cc"
},
"phone": {
"S": "+57308394111288"
},
}
Golang
params := &dynamodb.GetItemInput{
Key: map[string]*dynamodb.AttributeValue{
"phone": { // Required
S: aws.String(phone),
},
},
TableName: aws.String(TableName),
}
thanks per messages.solved this way
filt := expression.Name("phone").Equal(expression.Value(phone))
expr, err := expression.NewBuilder().WithFilter(filt).Build()
params := &dynamodb.ScanInput{
ExpressionAttributeNames: expr.Names(),
ExpressionAttributeValues: expr.Values(),
FilterExpression: expr.Filter(),
ProjectionExpression: expr.Projection(),
TableName: aws.String(tableName),
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.