Documentation
¶
Overview ¶
Package dynamodbav provides Marshal/Unmarshal utilities for DynamoDB, intended to complement the AWS Go SDK V2 github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue.
Index ¶
- func MarshalItem(v interface{}) (map[string]types.AttributeValue, error)
- func MarshalList[T any](vals []T) ([]map[string]types.AttributeValue, error)
- func UnmarshalItem[T any](item map[string]types.AttributeValue) (*T, error)
- func UnmarshalList[T any](items []map[string]types.AttributeValue) ([]T, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalItem ¶
func MarshalItem(v interface{}) (map[string]types.AttributeValue, error)
MarshalItem marshals a generic type into its DB representation. This function is just a simple wrapper around attributevalue.MarshalMap() but is included for completeness.
func MarshalList ¶
func MarshalList[T any](vals []T) ([]map[string]types.AttributeValue, error)
MarshalList marshals a list of values into a list of their DB representations.
func UnmarshalItem ¶
func UnmarshalItem[T any](item map[string]types.AttributeValue) (*T, error)
UnmarshalItem unmarshals a value from its DB represenations. The type to return must be specified as a generic parameter, for example:
val, err := dynamodbav.UnmarshalItem[MyType](out.Item)
func UnmarshalList ¶
func UnmarshalList[T any](items []map[string]types.AttributeValue) ([]T, error)
UnmarshalList unmarshals a list of values from their DB representations. The type to return must be specified as a generic parameter, for example:
vals, err := dynamodbav.UnmarshalList[MyType](out.Items)
Types ¶
This section is empty.