Documentation ¶
Overview ¶
Package attr provides utilities for converting between go and DynamoDB attribute values.
Only types that are required are supported. Conversion from cty types can cover a larger range of types.
Index ¶
- func FromBool(b bool) dynamodb.AttributeValue
- func FromCtyPath(path cty.Path) dynamodb.AttributeValue
- func FromCtyValue(v cty.Value) dynamodb.AttributeValue
- func FromExpression(expression resource.Expression) dynamodb.AttributeValue
- func FromFloat64(v float64) dynamodb.AttributeValue
- func FromInt64(v int64) dynamodb.AttributeValue
- func FromString(str string) dynamodb.AttributeValue
- func FromStringSet(list []string) dynamodb.AttributeValue
- func FromStringSlice(list []string) dynamodb.AttributeValue
- func ToBool(attr dynamodb.AttributeValue) (bool, error)
- func ToCtyPath(attr dynamodb.AttributeValue) (cty.Path, error)
- func ToCtyValue(attr dynamodb.AttributeValue, ty cty.Type) (cty.Value, error)
- func ToExpression(attr dynamodb.AttributeValue) (resource.Expression, error)
- func ToFloat64(attr dynamodb.AttributeValue) (float64, error)
- func ToInt64(attr dynamodb.AttributeValue) (int64, error)
- func ToString(attr dynamodb.AttributeValue) (string, error)
- func ToStringSet(attr dynamodb.AttributeValue) []string
- func ToStringSlice(attr dynamodb.AttributeValue) ([]string, error)
- type NotSetError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromCtyPath ¶
func FromCtyPath(path cty.Path) dynamodb.AttributeValue
FromCtyPath encodes a cty path to an attribute.
func FromCtyValue ¶
func FromCtyValue(v cty.Value) dynamodb.AttributeValue
FromCtyValue encodes a value from the cty type system to a DynamoDB attribute.
In case the value contains nested objects such as objects, they are nested into the returned attribute.
Unknown, dynamic and capsule values are not supported.
func FromExpression ¶
func FromExpression(expression resource.Expression) dynamodb.AttributeValue
FromExpression encodes a graph expression into an attribute.
func FromFloat64 ¶
func FromFloat64(v float64) dynamodb.AttributeValue
FromFloat64 creates a numeric attribute from a 64 bit float.
func FromInt64 ¶
func FromInt64(v int64) dynamodb.AttributeValue
FromInt64 creates a numeric attribute from a 64 bit integer.
func FromString ¶
func FromString(str string) dynamodb.AttributeValue
FromString creates a string attribute.
func FromStringSet ¶
func FromStringSet(list []string) dynamodb.AttributeValue
FromStringSet creates an unsorted set of strings.
The values are set in the same order as the incoming list, but values may be returned from DynamoDB in another order.
func FromStringSlice ¶
func FromStringSlice(list []string) dynamodb.AttributeValue
FromStringSlice creates an attribute with a sorted list of strings.
func ToBool ¶
func ToBool(attr dynamodb.AttributeValue) (bool, error)
ToBool returns the boolean value from an attribute.
func ToCtyPath ¶
func ToCtyPath(attr dynamodb.AttributeValue) (cty.Path, error)
ToCtyPath decodes an attribute to a cty path.
func ToCtyValue ¶
ToCtyValue decodes an attribute to a value in the cty type system.
The given type is used to determine how values are decoded. An error is returned if the type does not match.
func ToExpression ¶
func ToExpression(attr dynamodb.AttributeValue) (resource.Expression, error)
ToExpression decodes an attribute to a graph expression.
func ToFloat64 ¶
func ToFloat64(attr dynamodb.AttributeValue) (float64, error)
ToFloat64 parses a numeric attribute as a 64 bit float.
func ToInt64 ¶
func ToInt64(attr dynamodb.AttributeValue) (int64, error)
ToInt64 parses a numeric attribute as a 64 bit integer.
func ToString ¶
func ToString(attr dynamodb.AttributeValue) (string, error)
ToString returns the string from an attribute.
func ToStringSet ¶
func ToStringSet(attr dynamodb.AttributeValue) []string
ToStringSet returns a set of strings from an attribute.
As the set is not sorted, the order is not deterministic.
func ToStringSlice ¶
func ToStringSlice(attr dynamodb.AttributeValue) ([]string, error)
ToStringSlice returns a sorted list of strings.
Types ¶
type NotSetError ¶
NotSetError is returned when trying to read a value and the corresponding field is not set in the DynamoDB attribute value.
func (NotSetError) Error ¶
func (e NotSetError) Error() string