Documentation ¶
Index ¶
- func DynMapConvertable(value interface{}) bool
- func ToBool(value interface{}) (bool, error)
- func ToInt(value interface{}) (int, error)
- func ToInt64(value interface{}) (i int64, err error)
- func ToMap(value interface{}) (map[string]interface{}, bool)
- func ToString(value interface{}) string
- func ToTime(value interface{}) (tm time.Time, err error)
- type DynMap
- func (this *DynMap) AddToSlice(key string, mp interface{}) error
- func (this *DynMap) Clone() *DynMap
- func (this *DynMap) Exists(key string) bool
- func (this *DynMap) Get(key string) (interface{}, bool)
- func (this *DynMap) GetBool(key string) (bool, bool)
- func (this *DynMap) GetDynMap(key string) (*DynMap, bool)
- func (this *DynMap) GetDynMapSlice(key string) ([]*DynMap, bool)
- func (this *DynMap) GetInt(key string) (int, bool)
- func (this *DynMap) GetInt64(key string) (int64, bool)
- func (this *DynMap) GetIntSlice(key string) ([]int, bool)
- func (this *DynMap) GetIntSliceSplit(key, delim string) ([]int, bool)
- func (this *DynMap) GetString(key string) (string, bool)
- func (this *DynMap) GetStringSlice(key string) ([]string, bool)
- func (this *DynMap) GetStringSliceSplit(key, delim string) ([]string, bool)
- func (this *DynMap) GetTime(key string) (time.Time, bool)
- func (this *DynMap) MarshalJSON() ([]byte, error)
- func (this *DynMap) MarshalURL() (string, error)
- func (this *DynMap) MustBool(key string, def bool) bool
- func (this *DynMap) MustDynMap(key string, def *DynMap) *DynMap
- func (this *DynMap) MustInt(key string, def int) int
- func (this *DynMap) MustInt64(key string, def int64) int64
- func (this *DynMap) MustString(key string, def string) string
- func (this *DynMap) MustTime(key string, def time.Time) time.Time
- func (this *DynMap) Put(key string, value interface{})
- func (this *DynMap) PutAll(mp interface{}) bool
- func (this *DynMap) PutIfAbsent(key string, value interface{}) (interface{}, bool)
- func (this *DynMap) PutIfAbsentWithDot(key string, value interface{}) (interface{}, bool)
- func (this *DynMap) PutWithDot(key string, value interface{}) error
- func (this *DynMap) Remove(key string) (interface{}, bool)
- func (this *DynMap) ToDynMap() *DynMap
- func (this *DynMap) ToMap() map[string]interface{}
- func (this *DynMap) UnmarshalJSON(bytes []byte) error
- func (this *DynMap) UnmarshalURL(urlstring string) error
- func (this *DynMap) UnmarshalURLValues(values url.Values) error
- type DynMaper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DynMapConvertable ¶
func DynMapConvertable(value interface{}) bool
Returns true if the given value is a map, dynmap, DynMaper or pointer of one of those types
Types ¶
type DynMap ¶
type DynMap struct {
Map map[string]interface{}
}
Dont make this a map type, since we want the option of extending this and adding members.
func (*DynMap) AddToSlice ¶
Adds the item to a slice
func (*DynMap) Get ¶
Get's the value. will honor the dot operator if needed. key = 'map.map2' will first attempt to matche the literal key 'map.map2' if no value is present it will look for a sub map at key 'map'
func (*DynMap) GetDynMap ¶
Gets a dynmap from the requested. This will update the value in the map if the value was not already a dynmap.
func (*DynMap) GetDynMapSlice ¶
gets a slice of dynmaps
func (*DynMap) GetInt64 ¶
Gets the value at the specified key as an int64. returns -1,false if value not available or is not convertable
func (*DynMap) GetIntSlice ¶
Returns a slice of ints
func (*DynMap) GetIntSliceSplit ¶
gets a slice of ints. if the value is a string it will split by the requested delimiter
func (*DynMap) GetStringSlice ¶
Returns a slice of strings
func (*DynMap) GetStringSliceSplit ¶
gets a slice of strings. if the value is a string it will split by the requested delimiter
func (*DynMap) MarshalJSON ¶
func (*DynMap) MarshalURL ¶
encodes this map into a url encoded string. maps are encoded in the rails style (key[key2][key2]=value) TODO: we should sort the keynames so ordering is consistent and then this can be used a cache key
func (*DynMap) MustString ¶
gets a string. if string is not available in the map, then the default is returned
func (*DynMap) PutAll ¶
puts all the values from the passed in map into this dynmap the passed in map must be convertable to a DynMap via ToDynMap. returns false if the passed value is not convertable to dynmap
func (*DynMap) PutIfAbsent ¶
Puts the value into the map if and only if no value exists at the specified key. This does not honor the dot operator on insert.
func (*DynMap) PutIfAbsentWithDot ¶
Same as PutIfAbsent but honors the dot operator
func (*DynMap) PutWithDot ¶
puts the value into the map, honoring the dot operator. so PutWithDot("map1.map2.value", 100) would result in:
{ map1 : { map2 : { value: 100 }}
}
func (*DynMap) UnmarshalJSON ¶
func (*DynMap) UnmarshalURL ¶
Unmarshals a url encoded string. will also parse rails style maps in the form key[key1][key2]=val