Documentation ¶
Overview ¶
Package dynamoattr provides functions for marshaling and unmarshaling Go values to and from DynamoDB items (map[string]*dynamodb.AttributeValue).
The mapping between DynamodDB items and Go values is described in the Marshal and Unmarshal functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(v interface{}) (map[string]*dynamodb.AttributeValue, error)
Marshal returns a DynamoDB attribute map for the Go struct v.
Marshal traverses v recursively, encoding its structure into the returned attribute map. Marshal returns an error if it encounters a Go value that is incompatible with the attribute map data model.
The toplevel value v must be a struct: its fields are mapped into the toplevel attribute names. Struct attributes are named by their Go field name. This mapping can be overridden by specifying a field tag under the "dynamoattr" key. As a special case, fields renamed to "-" are ignored by Marshal. Structs are not permitted beyond the top level.
Unexported fields are skipped.
func Unmarshal ¶
func Unmarshal(attrs map[string]*dynamodb.AttributeValue, ptr interface{}) error
Unmarshal decodes an attribute map into the Go value ptr, which must be a pointer to a toplevel struct, compatible with the provided attribute mapping.
Attribute maps are decoded in the manner described by Marshal. Unmarshal returns an error If an attribute map is incompatible with the provided struct.
Types ¶
This section is empty.