Documentation
¶
Overview ¶
Package mapof provides string-keyed map types with typed values and helper methods.
Any, String, Int, Int64, Float, Bool, and the generic Object[T] are all plain map types under their methods, so they can be ranged over, indexed, and serialized exactly like the maps they wrap. What they add is typed accessors — GetString, GetInt, GetBool, and their OK-returning variants — that convert a loosely-typed value on the way out, plus the Getter and Setter implementations that let the schema package address them by path.
That schema integration is the reason these types exist: they are the carriers a JSON-Schema-shaped document is read into and written back out of when there is no Go struct to bind to.
Template is the exception to "exactly like the maps they wrap": its strings may be stored as loose.Template values, compiled when decoded or set, and its getters take the data to render them against. Read it only through its methods.
Index ¶
- type Any
- func (x *Any) Append(key string, value any)
- func (x Any) Equal(value map[string]any) bool
- func (x Any) GetAny(key string) any
- func (x Any) GetAnyOK(key string) (any, bool)
- func (x Any) GetBool(key string) bool
- func (x Any) GetBoolOK(key string) (value bool, ok bool)
- func (x Any) GetFloat(key string) float64
- func (x Any) GetFloatOK(key string) (value float64, ok bool)
- func (x Any) GetInt(key string) int
- func (x Any) GetInt64(key string) int64
- func (x Any) GetInt64OK(key string) (value int64, ok bool)
- func (x Any) GetIntOK(key string) (value int, ok bool)
- func (m Any) GetMap(name string) Any
- func (m Any) GetMapOfAny(name string) Any
- func (m Any) GetMapOfString(name string) String
- func (x Any) GetPointer(key string) (any, bool)
- func (m Any) GetSliceOfAny(name string) []any
- func (m Any) GetSliceOfFloat(name string) []float64
- func (m Any) GetSliceOfInt(name string) []int
- func (m Any) GetSliceOfMap(name string) []Any
- func (m Any) GetSliceOfPlainMap(name string) []map[string]any
- func (m Any) GetSliceOfString(name string) []string
- func (x Any) GetString(key string) string
- func (x Any) GetStringOK(key string) (value string, ok bool)
- func (x Any) GetTime(key string) time.Time
- func (x Any) GetTimeOK(key string) (value time.Time, ok bool)
- func (x Any) IsEmpty() bool
- func (x Any) IsMap() bool
- func (m Any) IsZeroValue(name string) bool
- func (x Any) Keys() []string
- func (x Any) Length() int
- func (m Any) MapOfAny() map[string]any
- func (m Any) MapOfString() map[string]string
- func (x Any) NotEmpty() bool
- func (x Any) NotEqual(value map[string]any) bool
- func (x *Any) Remove(key string) bool
- func (x *Any) SetAny(key string, value any) bool
- func (x *Any) SetBool(key string, value bool) bool
- func (x *Any) SetFloat(key string, value float64) bool
- func (x *Any) SetInt(key string, value int) bool
- func (x *Any) SetInt64(key string, value int64) bool
- func (x *Any) SetKey(key string, value any) error
- func (x *Any) SetString(key string, value string) bool
- func (x *Any) SetValue(value any) error
- type Bool
- func (x Bool) Equal(value Bool) bool
- func (x Bool) GetBool(key string) bool
- func (x Bool) GetBoolOK(key string) (bool, bool)
- func (x Bool) IsEmpty() bool
- func (x Bool) IsMap() bool
- func (x Bool) Keys() []string
- func (x Bool) Length() int
- func (x Bool) NotEmpty() bool
- func (x Bool) NotEqual(value Bool) bool
- func (x *Bool) Remove(key string) bool
- func (x *Bool) SetBool(key string, value bool) bool
- type Float
- func (x Float) Equal(value map[string]float64) bool
- func (x Float) GetFloat(key string) float64
- func (x Float) GetFloatOK(key string) (float64, bool)
- func (x Float) IsEmpty() bool
- func (x Float) IsMap() bool
- func (x Float) Keys() []string
- func (x Float) Length() int
- func (x Float) NotEmpty() bool
- func (x Float) NotEqual(value map[string]float64) bool
- func (x *Float) Remove(key string) bool
- func (x *Float) SetFloat(key string, value float64) bool
- type Int
- func (x Int) Equal(value map[string]int) bool
- func (x Int) GetInt(key string) int
- func (x Int) GetIntOK(key string) (int, bool)
- func (x Int) IsEmpty() bool
- func (x Int) IsMap() bool
- func (x Int) Keys() []string
- func (x Int) Length() int
- func (x Int) NotEmpty() bool
- func (x Int) NotEqual(value map[string]int) bool
- func (x *Int) Remove(key string) bool
- func (x *Int) SetInt(key string, value int) bool
- type Int64
- func (x Int64) Equal(value map[string]int64) bool
- func (x Int64) GetInt64(key string) int64
- func (x Int64) GetInt64OK(key string) (int64, bool)
- func (x Int64) IsEmpty() bool
- func (x Int64) IsMap() bool
- func (x Int64) Keys() []string
- func (x Int64) Length() int
- func (x Int64) NotEmpty() bool
- func (x Int64) NotEqual(value map[string]int64) bool
- func (x *Int64) Remove(key string) bool
- func (x *Int64) SetInt64(key string, value int64) bool
- type Matchable
- func (m Matchable[T]) Equal(value map[string]any) bool
- func (m Matchable[T]) GetPointer(key string) (any, bool)
- func (m Matchable[T]) IsEmpty() bool
- func (m Matchable[T]) IsMap() bool
- func (m Matchable[T]) IsZeroValue(name string) bool
- func (m Matchable[T]) Keys() []string
- func (m Matchable[T]) Length() int
- func (m Matchable[T]) MapOfAny() map[string]any
- func (m Matchable[T]) MapOfString() map[string]string
- func (m Matchable[T]) Match(expression exp.Expression) Matchable[T]
- func (m Matchable[T]) MatchOne(expression exp.Expression) (T, bool)
- func (m Matchable[T]) NotEmpty() bool
- func (m Matchable[T]) NotEqual(value map[string]any) bool
- func (m *Matchable[T]) Remove(key string) bool
- func (m Matchable[T]) Values() []T
- type Matcher
- type Object
- func (object Object[T]) GetPointer(name string) (any, bool)
- func (x Object[T]) IsEmpty() bool
- func (x Object[T]) IsMap() bool
- func (object Object[T]) IsZeroValue(name string) bool
- func (x Object[T]) Keys() []string
- func (x Object[T]) Length() int
- func (x Object[T]) NotEmpty() bool
- func (object *Object[T]) Remove(key string) bool
- func (object *Object[T]) SetKey(key string, value any) error
- type Slices
- type String
- func (x String) Equal(value map[string]string) bool
- func (x String) GetString(key string) string
- func (x String) GetStringOK(key string) (string, bool)
- func (x String) IsEmpty() bool
- func (x String) IsMap() bool
- func (x String) Keys() []string
- func (x String) Length() int
- func (x String) MapOfAny() map[string]any
- func (x String) MapOfString() map[string]string
- func (x String) NotEmpty() bool
- func (x String) NotEqual(value map[string]string) bool
- func (x *String) Remove(key string) bool
- func (x *String) SetString(key string, value string) bool
- type Template
- func (x *Template) Append(key string, value any)
- func (x Template) Clone() Template
- func (x Template) Equal(value map[string]any) bool
- func (x Template) Evaluate(key string, data any) (string, error)
- func (x Template) GetAny(key string, data any) any
- func (x Template) GetAnyOK(key string, data any) (any, bool)
- func (x Template) GetBool(key string, data any) bool
- func (x Template) GetBoolOK(key string, data any) (value bool, ok bool)
- func (x Template) GetFloat(key string, data any) float64
- func (x Template) GetFloatOK(key string, data any) (value float64, ok bool)
- func (x Template) GetInt(key string, data any) int
- func (x Template) GetInt64(key string, data any) int64
- func (x Template) GetInt64OK(key string, data any) (value int64, ok bool)
- func (x Template) GetIntOK(key string, data any) (value int, ok bool)
- func (x Template) GetMap(name string, data any) Any
- func (x Template) GetMapOfAny(name string, data any) Any
- func (x Template) GetMapOfString(name string, data any) String
- func (x Template) GetPointer(key string) (any, bool)
- func (x Template) GetSliceOfAny(name string, data any) []any
- func (x Template) GetSliceOfFloat(name string, data any) []float64
- func (x Template) GetSliceOfInt(name string, data any) []int
- func (x Template) GetSliceOfMap(name string, data any) []Any
- func (x Template) GetSliceOfPlainMap(name string, data any) []map[string]any
- func (x Template) GetSliceOfString(name string, data any) []string
- func (x Template) GetString(key string, data any) string
- func (x Template) GetStringOK(key string, data any) (value string, ok bool)
- func (x Template) GetTime(key string, data any) time.Time
- func (x Template) GetTimeOK(key string, data any) (value time.Time, ok bool)
- func (x Template) IsEmpty() bool
- func (x Template) IsMap() bool
- func (x Template) IsZeroValue(name string) bool
- func (x Template) Keys() []string
- func (x Template) Length() int
- func (x Template) MapOfAny() map[string]any
- func (x Template) MapOfString() map[string]string
- func (x Template) NotEmpty() bool
- func (x Template) NotEqual(value map[string]any) bool
- func (x *Template) Remove(key string) bool
- func (x *Template) SetAny(key string, value any) bool
- func (x *Template) SetBool(key string, value bool) bool
- func (x *Template) SetFloat(key string, value float64) bool
- func (x *Template) SetInt(key string, value int) bool
- func (x *Template) SetInt64(key string, value int64) bool
- func (x *Template) SetKey(key string, value any) error
- func (x *Template) SetString(key string, value string) bool
- func (x *Template) SetValue(value any) error
- func (x *Template) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Any ¶
Any is a map of string keys to arbitrary values with typed, coercing accessors.
func MapOfAny ¶ added in v0.22.0
MapOfAny converts Any, Template, Bool, Float, Int, Int64, String, a pointer to one of those, or a plain or pointer map[string]X of those value types into a mapof.Any, and TRUE, or (nil, false) otherwise.
func (*Any) Append ¶ added in v0.16.0
Append adds a new value to the provided key. If a value already exists for this key then it will be forced into a slice of values.
func (Any) GetAnyOK ¶ added in v0.11.0
GetAnyOK returns the raw value for the key and TRUE if it is present, or (nil, false) if not.
func (Any) GetBool ¶
GetBool returns the value for the key coerced to bool, or FALSE if absent or not coercible.
func (Any) GetBoolOK ¶ added in v0.11.0
GetBoolOK returns the key's value as a bool, and TRUE if it was present and converted losslessly.
func (Any) GetFloat ¶
GetFloat returns the value for the key coerced to float64, or 0 if absent or not coercible.
func (Any) GetFloatOK ¶ added in v0.11.0
GetFloatOK returns the key's value as a float64, and TRUE if present and converted losslessly.
func (Any) GetInt ¶
GetInt returns the value for the key coerced to int, or 0 if absent or not coercible.
func (Any) GetInt64 ¶
GetInt64 returns the value for the key coerced to int64, or 0 if absent or not coercible.
func (Any) GetInt64OK ¶ added in v0.11.0
GetInt64OK returns the key's value as an int64, and TRUE if present and converted losslessly.
func (Any) GetIntOK ¶ added in v0.11.0
GetIntOK returns the key's value as an int, and TRUE if it was present and converted losslessly.
func (Any) GetMapOfAny ¶ added in v0.25.26
GetMapOfAny returns a named property as a mapof.Any
func (Any) GetMapOfString ¶ added in v0.25.26
GetMapOfString returns a named property as a mapof.String
func (Any) GetPointer ¶ added in v0.14.0
GetPointer returns the raw value for the key (implements the schema PointerGetter interface).
func (Any) GetSliceOfAny ¶ added in v0.23.1
GetSliceOfAny returns a named property as a slice of any values
func (Any) GetSliceOfFloat ¶ added in v0.11.0
GetSliceOfFloat returns a named property as a slice of float64 values
func (Any) GetSliceOfInt ¶ added in v0.11.0
GetSliceOfInt returns a named property as a slice of int values
func (Any) GetSliceOfMap ¶ added in v0.11.0
GetSliceOfMap returns a named property as a slice of mapof.Any objects.
func (Any) GetSliceOfPlainMap ¶ added in v0.23.2
GetSliceOfPlainMap returns a named property as a slice of plain map[string]any objects.
func (Any) GetSliceOfString ¶ added in v0.11.0
GetSliceOfString returns a named property as a slice of strings
func (Any) GetString ¶
GetString returns the value for the key coerced to string, or "" if absent or not coercible.
func (Any) GetStringOK ¶ added in v0.11.0
GetStringOK returns the key's value as a string, and TRUE if present and converted losslessly.
func (Any) GetTime ¶ added in v0.24.6
GetTime returns the value for the key coerced to time.Time, or the zero time if absent or not coercible.
func (Any) GetTimeOK ¶ added in v0.24.6
GetTimeOK returns the value for the key coerced to time.Time, with TRUE if it was present and coercible.
func (Any) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Any) IsZeroValue ¶ added in v0.12.2
IsZeroValue returns TRUE if the named property is absent or holds a zero value.
func (Any) MapOfAny ¶ added in v0.21.3
MapOfAny implements the convert.MapOfAnyGetter interface. It returns this value as a map[string]any
func (Any) MapOfString ¶ added in v0.21.3
MapOfString returns this value as a map[string]string, converting each value to a string
func (Any) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (Any) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map does not deeply equal the provided map.
func (*Any) SetAny ¶
SetAny stores a non-zero value at the key (deleting the key when the value is zero to keep the map sparse).
func (*Any) SetFloat ¶
SetFloat stores a non-zero float64 at the key (deleting the key when the value is zero).
func (*Any) SetInt ¶
SetInt stores a non-zero int at the key (deleting the key when the value is zero).
func (*Any) SetInt64 ¶
SetInt64 stores a non-zero int64 at the key (deleting the key when the value is zero).
func (*Any) SetKey ¶ added in v0.44.0
SetKey stores the value under the key exactly as given, including a zero value (implements the schema KeySetter interface).
type Bool ¶
Bool is a map of string keys to bool values with typed accessors.
func (Bool) Equal ¶ added in v0.13.0
Equal returns TRUE if this map has the same keys and values as the provided map.
func (Bool) GetBoolOK ¶ added in v0.11.0
GetBoolOK returns the value for the key and TRUE if it is present, or (false, false) if not.
func (Bool) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Bool) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (Bool) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map differs from the provided map.
type Float ¶
Float is a map of string keys to float64 values with typed accessors.
func NewFloat ¶ added in v0.11.0
func NewFloat() Float
NewFloat returns a new, initialized Float map.
func (Float) Equal ¶ added in v0.13.0
Equal returns TRUE if this map has the same keys and values as the provided map.
func (Float) GetFloatOK ¶ added in v0.10.0
GetFloatOK returns the value for the key and TRUE if it is present, or (0, false) if not.
func (Float) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Float) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (Float) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map differs from the provided map.
type Int ¶
Int is a map of string keys to int values with typed accessors.
func (Int) Equal ¶ added in v0.13.0
Equal returns TRUE if this map has the same keys and values as the provided map.
func (Int) GetIntOK ¶ added in v0.11.0
GetIntOK returns the value for the key and TRUE if it is present, or (0, false) if not.
func (Int) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Int) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (Int) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map differs from the provided map.
type Int64 ¶
Int64 is a map of string keys to int64 values with typed accessors.
func NewInt64 ¶ added in v0.11.0
func NewInt64() Int64
NewInt64 returns a new, initialized Int64 map.
func (Int64) Equal ¶ added in v0.13.0
Equal returns TRUE if this map has the same keys and values as the provided map.
func (Int64) GetInt64OK ¶ added in v0.11.0
GetInt64OK returns the value for the key and TRUE if it is present, or (0, false) if not.
func (Int64) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Int64) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (Int64) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map differs from the provided map.
type Matchable ¶ added in v0.25.35
Matchable is a map of objects that implement the Matcher interface and can be queried using the Match and MatchOne methods.
func NewMatchable ¶ added in v0.25.35
NewMatchable returns a fully initialized Matchable object
func (Matchable[T]) Equal ¶ added in v0.25.35
Equal returns TRUE if this map deeply equals the provided map.
func (Matchable[T]) GetPointer ¶ added in v0.25.35
GetPointer returns the value for the key (implements the schema PointerGetter interface).
func (Matchable[T]) IsEmpty ¶ added in v0.25.35
IsEmpty returns TRUE if the map contains no elements.
func (Matchable[T]) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Matchable[T]) IsZeroValue ¶ added in v0.25.35
IsZeroValue returns TRUE if the named property is absent or holds a zero value.
func (Matchable[T]) MapOfAny ¶ added in v0.25.35
MapOfAny implements the convert.MapOfAnyGetter interface. It returns a copy of this value as a map[string]any
func (Matchable[T]) MapOfString ¶ added in v0.25.35
MapOfString returns this value as a map[string]string, converting each value to a string
func (Matchable[T]) Match ¶ added in v0.25.35
func (m Matchable[T]) Match(expression exp.Expression) Matchable[T]
Match returns a new map containing all elements that match the given expression.
func (Matchable[T]) MatchOne ¶ added in v0.25.35
func (m Matchable[T]) MatchOne(expression exp.Expression) (T, bool)
MatchOne returns an element that matches the given expression (an arbitrary one when several match), along with a boolean indicating if a match was found.
func (Matchable[T]) NotEmpty ¶ added in v0.25.35
NotEmpty returns TRUE if the map contains one or more elements.
func (Matchable[T]) NotEqual ¶ added in v0.25.35
NotEqual returns TRUE if this map does not deeply equal the provided map.
type Matcher ¶ added in v0.25.35
type Matcher interface {
// Match returns TRUE if this object matches the provided predicate
Match(predicate exp.Predicate) bool
}
Matcher interface wraps the Match method, which allows objects to declare if they match a given predicate
type Object ¶ added in v0.10.0
Object is a map of string keys to values of a single type T, with schema-traversal support.
func (Object[T]) GetPointer ¶ added in v0.14.0
GetPointer returns the value for the key (implements the schema PointerGetter interface).
func (Object[T]) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Object[T]) IsZeroValue ¶ added in v0.12.2
IsZeroValue returns TRUE if the named property is absent or holds a zero value.
func (Object[T]) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
type Slices ¶ added in v0.25.10
type Slices[K comparable, V comparable] map[K][]V
Slices is a map from keys to slices of values, i.e. a one-to-many multimap.
type String ¶
String is a map of string keys to string values with typed accessors.
func NewString ¶ added in v0.11.0
func NewString() String
NewString returns a new, initialized String map.
func (String) Equal ¶ added in v0.13.0
Equal returns TRUE if this map has the same keys and values as the provided map.
func (String) GetStringOK ¶ added in v0.11.0
GetStringOK returns the value for the key and TRUE if it is present, or ("", false) if not.
func (String) IsMap ¶ added in v0.29.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (String) MapOfString ¶ added in v0.21.3
MapOfString returns the underlying map[string]string.
func (String) NotEmpty ¶ added in v0.16.3
NotEmpty returns TRUE if the map contains one or more elements.
func (String) NotEqual ¶ added in v0.24.8
NotEqual returns TRUE if this map differs from the provided map.
type Template ¶ added in v0.43.0
Template is a map of string keys to arbitrary values, whose strings may be templates that its getters render against data. Read it only through its methods.
func NewTemplate ¶ added in v0.43.0
func NewTemplate() Template
NewTemplate returns a new, initialized Template map.
func ParseTemplate ¶ added in v0.43.0
ParseTemplate copies a map into a Template, compiling every top-level string that holds a template.
func (*Template) Append ¶ added in v0.43.0
Append adds a new value to the provided key. If a value already exists for this key then it will be forced into a slice of original values, which are never templates.
func (Template) Clone ¶ added in v0.43.0
Clone returns a deep copy of this map, so that a caller can change any map or slice within it without changing the original. Pointers, structs, arrays, and loose.Template values are shared.
func (Template) Equal ¶ added in v0.43.0
Equal returns TRUE if this map's original values deeply equal the provided map.
func (Template) Evaluate ¶ added in v0.43.0
Evaluate renders the value at the key against the provided data if it is a template, and otherwise returns it as a string. Unlike the getters, it reports a failed render.
func (Template) GetAny ¶ added in v0.43.0
GetAny returns the value for the key, with a template rendered against the data, or nil if the key is not present.
func (Template) GetAnyOK ¶ added in v0.43.0
GetAnyOK returns the value for the key, with a template rendered against the data, and TRUE if it is present, or (nil, false) if not.
func (Template) GetBool ¶ added in v0.43.0
GetBool returns the value for the key, rendered against the data and coerced to bool, or FALSE if absent or not coercible.
func (Template) GetBoolOK ¶ added in v0.43.0
GetBoolOK returns the value for the key, rendered against the data and coerced to bool, with TRUE if it was present and converted losslessly.
func (Template) GetFloat ¶ added in v0.43.0
GetFloat returns the value for the key, rendered against the data and coerced to float64, or 0 if absent or not coercible.
func (Template) GetFloatOK ¶ added in v0.43.0
GetFloatOK returns the value for the key, rendered against the data and coerced to float64, with TRUE if it was present and converted losslessly.
func (Template) GetInt ¶ added in v0.43.0
GetInt returns the value for the key, rendered against the data and coerced to int, or 0 if absent or not coercible.
func (Template) GetInt64 ¶ added in v0.43.0
GetInt64 returns the value for the key, rendered against the data and coerced to int64, or 0 if absent or not coercible.
func (Template) GetInt64OK ¶ added in v0.43.0
GetInt64OK returns the value for the key, rendered against the data and coerced to int64, with TRUE if it was present and converted losslessly.
func (Template) GetIntOK ¶ added in v0.43.0
GetIntOK returns the value for the key, rendered against the data and coerced to int, with TRUE if it was present and converted losslessly.
func (Template) GetMap ¶ added in v0.43.0
GetMap returns a named property as a mapof.Any. Strings within it are not templates.
func (Template) GetMapOfAny ¶ added in v0.43.0
GetMapOfAny returns a named property as a mapof.Any. Strings within it are not templates.
func (Template) GetMapOfString ¶ added in v0.43.0
GetMapOfString returns a named property as a mapof.String. Strings within it are not templates.
func (Template) GetPointer ¶ added in v0.43.0
GetPointer returns the original value for the key (implements the schema PointerGetter interface).
func (Template) GetSliceOfAny ¶ added in v0.43.0
GetSliceOfAny returns a named property, with a template rendered against the data, as a slice of any values
func (Template) GetSliceOfFloat ¶ added in v0.43.0
GetSliceOfFloat returns a named property, with a template rendered against the data, as a slice of float64 values
func (Template) GetSliceOfInt ¶ added in v0.43.0
GetSliceOfInt returns a named property, with a template rendered against the data, as a slice of int values
func (Template) GetSliceOfMap ¶ added in v0.43.0
GetSliceOfMap returns a named property as a slice of mapof.Any objects. Strings within them are not templates.
func (Template) GetSliceOfPlainMap ¶ added in v0.43.0
GetSliceOfPlainMap returns a named property as a slice of plain map[string]any objects. Strings within them are not templates.
func (Template) GetSliceOfString ¶ added in v0.43.0
GetSliceOfString returns a named property, with a template rendered against the data, as a slice of strings
func (Template) GetString ¶ added in v0.43.0
GetString returns the value for the key, rendered against the data and coerced to string, or "" if absent or not coercible.
func (Template) GetStringOK ¶ added in v0.43.0
GetStringOK returns the value for the key, rendered against the data and coerced to string, with TRUE if it was present and converted losslessly.
func (Template) GetTime ¶ added in v0.43.0
GetTime returns the value for the key, rendered against the data and coerced to time.Time, or the zero time if absent or not coercible.
func (Template) GetTimeOK ¶ added in v0.43.0
GetTimeOK returns the value for the key, rendered against the data and coerced to time.Time, with TRUE if it was present and coercible.
func (Template) IsMap ¶ added in v0.43.0
IsMap returns TRUE, declaring this type a map for schema traversal. Implements schema.MapTyper.
func (Template) IsZeroValue ¶ added in v0.43.0
IsZeroValue returns TRUE if the named property is absent or holds a zero value, without rendering it.
func (Template) MapOfAny ¶ added in v0.43.0
MapOfAny implements the convert.MapOfAnyGetter interface. It returns a copy of this map, with every loose.Template replaced by its source string
func (Template) MapOfString ¶ added in v0.43.0
MapOfString returns this map's original values as a map[string]string
func (Template) NotEmpty ¶ added in v0.43.0
NotEmpty returns TRUE if the map contains one or more elements.
func (Template) NotEqual ¶ added in v0.43.0
NotEqual returns TRUE if this map's original values do not deeply equal the provided map.
func (*Template) SetAny ¶ added in v0.43.0
SetAny stores a non-zero value at the key (deleting it when zero), compiling a templated string.
func (*Template) SetFloat ¶ added in v0.43.0
SetFloat stores a non-zero float64 at the key (deleting the key when the value is zero).
func (*Template) SetInt ¶ added in v0.43.0
SetInt stores a non-zero int at the key (deleting the key when the value is zero).
func (*Template) SetInt64 ¶ added in v0.43.0
SetInt64 stores a non-zero int64 at the key (deleting the key when the value is zero).
func (*Template) SetKey ¶ added in v0.44.0
SetKey stores the value under the key, including a zero value, compiling a string that holds a template (implements the schema KeySetter interface).
func (*Template) SetString ¶ added in v0.43.0
SetString stores a non-empty string at the key (deleting it when empty), compiling a template.
func (*Template) SetValue ¶ added in v0.43.0
SetValue replaces the entire map with the provided value, if it can be converted to a map, compiling every top-level string that holds a template.
func (*Template) UnmarshalJSON ¶ added in v0.43.0
UnmarshalJSON decodes a JSON object, compiling every top-level string that holds a template.