Documentation
¶
Overview ¶
Package dynamodb converts AWS SDK v2 DynamoDB attributes to Go values.
UnmarshalAttribute decodes one attribute and UnmarshalItem decodes an item. Number preserves large integers using math/big rather than silently losing precision. AttributeError reports unsupported attribute or number forms.
Module boundary ¶
This optional SDK adapter delegates conversion policy to the dependency-free Commons package. UnmarshallDynamoDB accepts JSON-shaped wire attributes when SDK types are not available. This package does not fetch items or manage tables; use an application-owned SDK client for those operations.
For usage and compatibility details, see the user guide.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalAttribute ¶
func UnmarshalAttribute(input types.AttributeValue) (any, error)
UnmarshalAttribute uses the SDK's native binary/set decoding with shared numeric conversion.
func UnmarshalItem ¶
Example ¶
package main
import (
"fmt"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/rambow-cloud/powertools-lambda-go/commons/dynamodb"
)
func main() {
item, err := dynamodb.UnmarshalItem(map[string]types.AttributeValue{
"name": &types.AttributeValueMemberS{Value: "orders"},
"count": &types.AttributeValueMemberN{Value: "3"},
})
if err != nil {
panic(err)
}
fmt.Println(item["name"], item["count"])
}
Output: orders 3
Types ¶
type AttributeError ¶
type AttributeError = commons.DynamoDBAttributeError
AttributeError preserves the public error identity across raw and SDK adapters.