Documentation ¶
Overview ¶
Package ddbconv can be used to convert between dynamodb.AttributeValue and the Go type system Some of these functions provide little more than improved readability.
Index ¶
- func DecodeBinary(attr dynamodb.AttributeValue) []byte
- func DecodeBinarySet(attr dynamodb.AttributeValue) [][]byte
- func DecodeBool(attr dynamodb.AttributeValue) bool
- func DecodeInt(av dynamodb.AttributeValue) int
- func DecodeIntSet(attr dynamodb.AttributeValue) []int
- func DecodeList(attr dynamodb.AttributeValue) []dynamodb.AttributeValue
- func DecodeMap(attr dynamodb.AttributeValue) map[string]dynamodb.AttributeValue
- func DecodeNumber(av dynamodb.AttributeValue) dynamodbattribute.Number
- func DecodeString(attr dynamodb.AttributeValue) string
- func DecodeStringSet(attr dynamodb.AttributeValue) []string
- func EncodeBinary(val []byte) dynamodb.AttributeValue
- func EncodeBinarySet(val [][]byte) dynamodb.AttributeValue
- func EncodeBool(val bool) dynamodb.AttributeValue
- func EncodeInt(val int) dynamodb.AttributeValue
- func EncodeIntSet(vals []int) dynamodb.AttributeValue
- func EncodeList(val []dynamodb.AttributeValue) dynamodb.AttributeValue
- func EncodeMap(val map[string]dynamodb.AttributeValue) dynamodb.AttributeValue
- func EncodeNumber(n dynamodbattribute.Number) dynamodb.AttributeValue
- func EncodeString(val string) dynamodb.AttributeValue
- func EncodeStringSet(val []string) dynamodb.AttributeValue
- func FloatToNumber(f float64) dynamodbattribute.Number
- func IntToNumber(i int) dynamodbattribute.Number
- func IsNull(attr dynamodb.AttributeValue) bool
- func TryDecodeBool(attr dynamodb.AttributeValue) (val, ok bool)
- func TryDecodeInt(av dynamodb.AttributeValue) (int, bool)
- func TryDecodeNumber(av dynamodb.AttributeValue) (result dynamodbattribute.Number, ok bool)
- func TryDecodeString(attr dynamodb.AttributeValue) (result string, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBinary ¶
func DecodeBinary(attr dynamodb.AttributeValue) []byte
DecodeBinary converts an AttributeValue into a []byte, which will be empty if the value is not a Binary (B).
func DecodeBinarySet ¶
func DecodeBinarySet(attr dynamodb.AttributeValue) [][]byte
DecodeBinarySet converts an AttributeValue into a [][]byte, which will be empty if the value is not a BinarySet (BS).
func DecodeBool ¶
func DecodeBool(attr dynamodb.AttributeValue) bool
DecodeBool converts an AttributeValue into a bool, and will panic if the value is not a Boolean (BOOL).
func DecodeInt ¶
func DecodeInt(av dynamodb.AttributeValue) int
DecodeInt converts an AttributeValue into an int, and will panic if the value is not an integral Number, if it is a NULL, or if it will not fit in an int without losing precision.
func DecodeIntSet ¶
func DecodeIntSet(attr dynamodb.AttributeValue) []int
DecodeIntSet converts an AttributeValue into an []int, which will be empty if the value is not a NumberSet (NS), or if any value in the set is not an integral number that will fit in an int.
func DecodeList ¶
func DecodeList(attr dynamodb.AttributeValue) []dynamodb.AttributeValue
DecodeList converts an AttributeValue into a []AttributeValue, which will be empty if the value is not a List (L).
func DecodeMap ¶
func DecodeMap(attr dynamodb.AttributeValue) map[string]dynamodb.AttributeValue
DecodeMap converts an AttributeValue into a map[string]AttributeValue, which will be empty if the value is not a Map (M).
func DecodeNumber ¶
func DecodeNumber(av dynamodb.AttributeValue) dynamodbattribute.Number
DecodeNumber converts an AttributeValue into a Number, and will panic if the value is not a Number (N), or if the value is a NULL.
func DecodeString ¶
func DecodeString(attr dynamodb.AttributeValue) string
DecodeString converts an AttributeValue into a String, which will be empty if the value if not a String (S).
func DecodeStringSet ¶
func DecodeStringSet(attr dynamodb.AttributeValue) []string
DecodeStringSet converts an AttributeValue into a []string, which will be empty if the value is not a StringSet (SS).
func EncodeBinary ¶
func EncodeBinary(val []byte) dynamodb.AttributeValue
EncodeBinary converts a []byte into an AttributeValue with the Binary (B) type.
func EncodeBinarySet ¶
func EncodeBinarySet(val [][]byte) dynamodb.AttributeValue
EncodeBinarySet converts a [][]byte into an AttributeValue with the BinarySet (BS) type.
func EncodeBool ¶
func EncodeBool(val bool) dynamodb.AttributeValue
EncodeBool converts a bool into an AttributeValue with the Boolean (BOOL) type.
func EncodeInt ¶
func EncodeInt(val int) dynamodb.AttributeValue
EncodeInt converts an int into an AttributeValue with the Number (N) type.
func EncodeIntSet ¶
func EncodeIntSet(vals []int) dynamodb.AttributeValue
EncodeIntSet converts an []int into an AttributeValue with the NumberSet (NS) type.
func EncodeList ¶
func EncodeList(val []dynamodb.AttributeValue) dynamodb.AttributeValue
EncodeList converts a []AttributeValue into an AttributeValue with the List (L) type.
func EncodeMap ¶
func EncodeMap(val map[string]dynamodb.AttributeValue) dynamodb.AttributeValue
EncodeMap converts a map[string]AttributeValue into an AttributeValue with the Map (M) type.
func EncodeNumber ¶
func EncodeNumber(n dynamodbattribute.Number) dynamodb.AttributeValue
EncodeNumber converts a Number into an AttributeValue with the Number (N) type.
func EncodeString ¶
func EncodeString(val string) dynamodb.AttributeValue
EncodeString converts a string into an AttributeValue with the String (S) type.
func EncodeStringSet ¶
func EncodeStringSet(val []string) dynamodb.AttributeValue
EncodeStringSet converts a []string into an AttributeValue with the StringSet (SS) type.
func FloatToNumber ¶
func FloatToNumber(f float64) dynamodbattribute.Number
FloatToNumber converts a float64 into a Number.
func IntToNumber ¶
func IntToNumber(i int) dynamodbattribute.Number
IntToNumber converts an int into a Number.
func IsNull ¶
func IsNull(attr dynamodb.AttributeValue) bool
IsNull returns true if the given AttributeValue is a Null (NULL).
func TryDecodeBool ¶
func TryDecodeBool(attr dynamodb.AttributeValue) (val, ok bool)
TryDecodeBool attempts to convert an AttributeValue into a bool. The ok result is true if the value is a Boolean (BOOL).
func TryDecodeInt ¶
func TryDecodeInt(av dynamodb.AttributeValue) (int, bool)
TryDecodeInt attempts to convert an AttributeValue into an int. The boolean result is true if the decode was successful.
func TryDecodeNumber ¶
func TryDecodeNumber(av dynamodb.AttributeValue) (result dynamodbattribute.Number, ok bool)
TryDecodeNumber attempts to convert and AttributeValue into a Number. The boolean result is true if the value is a Number (N).
func TryDecodeString ¶
func TryDecodeString(attr dynamodb.AttributeValue) (result string, ok bool)
TryDecodeString attempts to convert an AttributeValue into a string. The ok result is true if the value is a String (S).
Types ¶
This section is empty.