Documentation
¶
Index ¶
- type BoolValue
- type CollectionValue
- type FloatValue
- type Inferrer
- func (i Inferrer) CollectionReferences(enabled bool) Inferrer
- func (i Inferrer) ComplexTypes(enabled bool) Inferrer
- func (i Inferrer) Infer(str string) (Value, error)
- func (i Inferrer) InferAll(strs []string) ([]Value, error)
- func (i Inferrer) LiteralLists(enabled bool) Inferrer
- func (i Inferrer) RegularExpressions(enabled bool) Inferrer
- func (i Inferrer) StrictStrings(enabled bool) Inferrer
- type IntValue
- type ListElementValue
- type ListValue
- type MapElementValue
- type MapValue
- type NullValue
- type RegexValue
- type StringValue
- type UnknownValue
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectionValue ¶
type FloatValue ¶
type FloatValue struct {
V float64
}
FloatValue is a literal floating point value.
func (FloatValue) Equals ¶
func (v FloatValue) Equals(q Value) bool
func (FloatValue) LessThan ¶
func (v FloatValue) LessThan(q Value) bool
func (FloatValue) String ¶
func (v FloatValue) String() string
func (FloatValue) Value ¶
func (v FloatValue) Value() interface{}
type Inferrer ¶
type Inferrer struct {
// contains filtered or unexported fields
}
Inferrer is used to infer data types from string representations and retrieve the coresponding appropriately-typed Value.
func (Inferrer) CollectionReferences ¶
CollectionReferences allows the Infer method to identify map (options["foo"]) and list references (arg[0]), returning MapElementValue and ListElementValue values, respectively. An argument that isn't a string or integer will cause an error to be returned (unless strict strings is false).
func (Inferrer) ComplexTypes ¶
Setting ComplexTypes is a helper function that enables the Infer method to identify literal lists ([ "foo", "bar" ]), collection references (options["foo"]), and regular expressions (/^foo$/).
func (Inferrer) Infer ¶
Infer accepts a string, attempts to determine its type, and based on the outcome returns an appropriate Value value. if strictStrings is true unquoted values that aren't obviously another type will return an error; if not then they will be treated as strings with a "quote flavor" of null ('\u0000). If basicsTypes is set then only the "basic" types (bool, float, int, string) will be returned.
func (Inferrer) LiteralLists ¶
LiteralLists allows the Infer method to infer list literals (["foo, "bar"]). Lists may include regular expressions, but may not include other complex types.
func (Inferrer) RegularExpressions ¶
RegularExpressions allows regular expressions (/^foo$/) to be inferred.
func (Inferrer) StrictStrings ¶
StrictStrings requires strings to be wrapped in single or double quotes (smart quotes are automatically converted to double quotes), and unknown values are returned as an UnknownValue. If not set, unquoted values that aren't clearly recognizable as another type are returned as StringValue values with a Quote value of \u0000 (null character).
type ListElementValue ¶
ListElementValue
func (ListElementValue) Equals ¶
func (v ListElementValue) Equals(q Value) bool
func (ListElementValue) LessThan ¶
func (v ListElementValue) LessThan(q Value) bool
func (ListElementValue) String ¶
func (v ListElementValue) String() string
func (ListElementValue) Value ¶
func (v ListElementValue) Value() interface{}
type MapElementValue ¶
MapElementValue
func (MapElementValue) Equals ¶
func (v MapElementValue) Equals(q Value) bool
func (MapElementValue) LessThan ¶
func (v MapElementValue) LessThan(q Value) bool
func (MapElementValue) String ¶
func (v MapElementValue) String() string
func (MapElementValue) Value ¶
func (v MapElementValue) Value() interface{}
type MapValue ¶
MapValue
type RegexValue ¶
type RegexValue struct {
V string
}
RegexValue describes a regular expression.
func (RegexValue) Equals ¶
func (v RegexValue) Equals(q Value) bool
func (RegexValue) LessThan ¶
func (v RegexValue) LessThan(q Value) bool
func (RegexValue) String ¶
func (v RegexValue) String() string
func (RegexValue) Value ¶
func (v RegexValue) Value() interface{}
type StringValue ¶
StringValue is a literal string value.
func (StringValue) Equals ¶
func (v StringValue) Equals(q Value) bool
func (StringValue) LessThan ¶
func (v StringValue) LessThan(q Value) bool
func (StringValue) String ¶
func (v StringValue) String() string
func (StringValue) Value ¶
func (v StringValue) Value() interface{}
type UnknownValue ¶
type UnknownValue struct {
V string
}
UnknownValue is returned by Parse when it can't determine a value type solely by looking at it. This could indicate a function, named collection(arg, option), or other named entity.
func (UnknownValue) Equals ¶
func (v UnknownValue) Equals(q Value) bool
func (UnknownValue) LessThan ¶
func (v UnknownValue) LessThan(q Value) bool
func (UnknownValue) String ¶
func (v UnknownValue) String() string
func (UnknownValue) Value ¶
func (v UnknownValue) Value() interface{}