Documentation ¶
Overview ¶
Support for AttributeValue type. See http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html
Index ¶
- type AttributeValue
- func (a *AttributeValue) Copy(ac *AttributeValue) error
- func (a AttributeValue) Empty() bool
- func (a *AttributeValue) InsertB(k string) error
- func (a *AttributeValue) InsertBOOL(b bool) error
- func (a *AttributeValue) InsertBS(k string) error
- func (a *AttributeValue) InsertBS_unencoded(k string) error
- func (a *AttributeValue) InsertB_unencoded(k string) error
- func (a *AttributeValue) InsertL(v *AttributeValue) error
- func (a *AttributeValue) InsertM(k string, v *AttributeValue) error
- func (a *AttributeValue) InsertN(k string) error
- func (a *AttributeValue) InsertNS(k string) error
- func (a *AttributeValue) InsertNS_float64(f float64) error
- func (a *AttributeValue) InsertNULL(b bool) error
- func (a *AttributeValue) InsertN_float64(f float64) error
- func (a *AttributeValue) InsertS(k string) error
- func (a *AttributeValue) InsertSS(k string) error
- func (a AttributeValue) MarshalJSON() ([]byte, error)
- func (a *AttributeValue) ToBasicJSON() ([]byte, error)
- func (a *AttributeValue) ToInterface() (interface{}, error)
- func (a *AttributeValue) Valid() bool
- type AttributeValueMap
- type AttributeValueUpdate
- type AttributeValueUpdateMap
- type SetList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeValue ¶
type AttributeValue struct { N string `json:",omitempty"` S string `json:",omitempty"` B string `json:",omitempty"` // These are pointers so we can have a vacuous type (nil), otherwise, we don't know // if false was a set value or the default. To set these BOOL *bool `json:",omitempty"` NULL *bool `json:",omitempty"` L []*AttributeValue `json:",omitempty"` M map[string]*AttributeValue `json:",omitempty"` SS SetList `json:",omitempty"` NS SetList `json:",omitempty"` BS SetList `json:",omitempty"` }
func BasicJSONToAttributeValue ¶
func BasicJSONToAttributeValue(b []byte) (*AttributeValue, error)
BasicJSONToAttributeValue provides a lossy mapping from "basic" json to an AttributeValue. This allows for the type of "JSON Document" functionality employed in the current AWS SDK and outlined in the docs (see http://aws.amazon.com/blogs/aws/dynamodb-update-json-and-more/)
func CoerceToAttributeValue ¶
func CoerceToAttributeValue(i interface{}) (*AttributeValue, error)
CoerceToAttributeValue is a lossy translation for basic json to the AWS serialization format for AttributeValue. There are types that will be dropped as they are indistinguishable without their type designations: 1. binary will be dropped as the values will always be coerced to string. 2. null (as a type, not a value) will always be coerced to bool.
func InterfaceToAttributeValue ¶
func InterfaceToAttributeValue(i interface{}) (*AttributeValue, error)
InterfaceToAttributeValue attempts to coerce an appropriate interface {} to an *AttributeValue
func NewAttributeValue ¶
func NewAttributeValue() *AttributeValue
func (*AttributeValue) Copy ¶
func (a *AttributeValue) Copy(ac *AttributeValue) error
Copy makes a copy of the this AttributeValue into ac.
func (AttributeValue) Empty ¶
func (a AttributeValue) Empty() bool
Empty determines if an AttributeValue is vacuous. Explicitly do not bother testing the boolean fields.
func (*AttributeValue) InsertB ¶
func (a *AttributeValue) InsertB(k string) error
InsertB sets the B field to string k, which it is assumed the caller has already encoded.
func (*AttributeValue) InsertBOOL ¶
func (a *AttributeValue) InsertBOOL(b bool) error
InsertBOOL will set the BOOL field.
func (*AttributeValue) InsertBS ¶
func (a *AttributeValue) InsertBS(k string) error
InsertBS adds a new base64 string to the bs (JSON: BS) set. String is parsed to make sure it is a represents a valid base64 blob. BS is *generated* from an internal representation (UM_bs) as it transforms a map into a list (a "set"). The argument is assumed to be already encoded by the caller.
func (*AttributeValue) InsertBS_unencoded ¶
func (a *AttributeValue) InsertBS_unencoded(k string) error
InsertBS_unencoded adds a new plain string to the bs (JSON: BS) set. BS is *generated* from an internal representation (UM_bs) as it transforms a map into a list (a "set"). The argument is assumed to be plaintext and will be base64 encoded.
func (*AttributeValue) InsertB_unencoded ¶
func (a *AttributeValue) InsertB_unencoded(k string) error
InsertB_unencoded adds a new plain string to the B field. The argument is assumed to be plaintext and will be base64 encoded.
func (*AttributeValue) InsertL ¶
func (a *AttributeValue) InsertL(v *AttributeValue) error
InsertL will append a pointer to a new AttributeValue v to the L list.
func (*AttributeValue) InsertM ¶
func (a *AttributeValue) InsertM(k string, v *AttributeValue) error
InsertM will insert a pointer to a new AttributeValue v to the M map for key k. If k was previously set in the M map, the value will be overwritten.
func (*AttributeValue) InsertN ¶
func (a *AttributeValue) InsertN(k string) error
InsertN sets the N field to number string k
func (*AttributeValue) InsertNS ¶
func (a *AttributeValue) InsertNS(k string) error
InsertNS adds a new number string to the ns (JSON: NS) set. String is parsed to make sure it is a represents a valid float. NS is *generated* from an internal representation (UM_ns) as it transforms a map into a list (a "set")
func (*AttributeValue) InsertNS_float64 ¶
func (a *AttributeValue) InsertNS_float64(f float64) error
InsertNS_float64 works like InsertNS but takes a float64
func (*AttributeValue) InsertNULL ¶
func (a *AttributeValue) InsertNULL(b bool) error
InsertNULL will set the NULL field.
func (*AttributeValue) InsertN_float64 ¶
func (a *AttributeValue) InsertN_float64(f float64) error
InsertN_float64 works like InsertN but takes a float64
func (*AttributeValue) InsertS ¶
func (a *AttributeValue) InsertS(k string) error
InsertS sets the S field to string k
func (*AttributeValue) InsertSS ¶
func (a *AttributeValue) InsertSS(k string) error
InsertSS adds a new string to the ss (JSON: SS) set. SS is *generated* from an internal representation (UM_ss) as it transforms a map into a list (a "set")
func (AttributeValue) MarshalJSON ¶
func (a AttributeValue) MarshalJSON() ([]byte, error)
MarshalJSON will emit null if the AttributeValue is Empty
func (*AttributeValue) ToBasicJSON ¶
func (a *AttributeValue) ToBasicJSON() ([]byte, error)
ToBasicJSON provides a mapping from an AttributeValue to basic json This allows for items from dynamo to be printed in a flat fashion if desired.
func (*AttributeValue) ToInterface ¶
func (a *AttributeValue) ToInterface() (interface{}, error)
AttributeValueToInterface strips the AttributeValue type designations and returns a structure that can be marshaled into basic json.
func (*AttributeValue) Valid ¶
func (a *AttributeValue) Valid() bool
Valid determines if more than one field has been set (in which case it is invalid).
type AttributeValueMap ¶
type AttributeValueMap map[string]*AttributeValue
AttributeValueMap is used throughout GoDynamo
func BasicJSONToAttributeValueMap ¶
func BasicJSONToAttributeValueMap(b []byte) (AttributeValueMap, error)
BasicJSONToAttributeValueMap provides a lossy mapping from "basic" json to an AttributeValueMap. This allows for the type of "JSON Document" functionality employed in the current AWS SDK and outlined in the docs (see http://aws.amazon.com/blogs/aws/dynamodb-update-json-and-more/)
func InterfaceToAttributeValueMap ¶
func InterfaceToAttributeValueMap(i interface{}) (AttributeValueMap, error)
InterfaceToAttributeValueMap attempts to coerce an appropriate interface {} to an AttributeValueMap
func NewAttributeValueMap ¶
func NewAttributeValueMap() AttributeValueMap
func (AttributeValueMap) Copy ¶
func (a AttributeValueMap) Copy(ac AttributeValueMap) error
Copy makes a copy of the this AttributeValueMap into ac.
func (AttributeValueMap) ToBasicJSON ¶
func (a AttributeValueMap) ToBasicJSON() ([]byte, error)
ToBasicJSON provides a mapping from an AttributeValueMap to basic json This allows for items from dynamo to be printed in a flat fashion if desired.
func (AttributeValueMap) ToInterface ¶
func (a AttributeValueMap) ToInterface() (interface{}, error)
AttributeValueMapToInterface converts the map into a map of the key names to interface types that do not have type designations, and be marshaled into basic json
type AttributeValueUpdate ¶
type AttributeValueUpdate struct { Action string `json:",omitempty"` Value *AttributeValue `json:",omitempty"` }
AttributeValueUpdate is used in UpdateItem
func NewAttributeValueUpdate ¶
func NewAttributeValueUpdate() *AttributeValueUpdate
type AttributeValueUpdateMap ¶
type AttributeValueUpdateMap map[string]*AttributeValueUpdate
func NewAttributeValueUpdateMap ¶
func NewAttributeValueUpdateMap() AttributeValueUpdateMap
type SetList ¶
type SetList []string
SetList represents the SS,BS and NS types which are ostensibly sets but encoded as json lists. Duplicates are allowed but removed when marshaling or unmarshaling.
func (SetList) MarshalJSON ¶
MarshalJSON will remove duplicates
func (*SetList) UnmarshalJSON ¶
UnmarshalJSON will remove duplicates