Documentation ¶
Index ¶
- Variables
- func Describe(x XValue) string
- func Equals(env utils.Environment, x1 XValue, x2 XValue) bool
- func IsEmpty(x XValue) bool
- func IsXError(x XValue) bool
- func ToXBoolean(env utils.Environment, x XValue) (XBoolean, XError)
- func ToXDateTime(env utils.Environment, x XValue) (XDateTime, XError)
- func ToXJSON(env utils.Environment, x XValue) (XText, XError)
- func ToXNumber(env utils.Environment, x XValue) (XNumber, XError)
- func ToXText(env utils.Environment, x XValue) (XText, XError)
- type XArray
- type XBoolean
- func (x XBoolean) Compare(other XBoolean) int
- func (x XBoolean) Describe() string
- func (x XBoolean) Equals(other XBoolean) bool
- func (x XBoolean) MarshalJSON() ([]byte, error)
- func (x XBoolean) Native() bool
- func (x XBoolean) Reduce(env utils.Environment) XPrimitive
- func (x XBoolean) String() string
- func (x XBoolean) ToXBoolean(env utils.Environment) XBoolean
- func (x XBoolean) ToXJSON(env utils.Environment) XText
- func (x XBoolean) ToXText(env utils.Environment) XText
- func (x *XBoolean) UnmarshalJSON(data []byte) error
- type XDateTime
- func (x XDateTime) Compare(other XDateTime) int
- func (x XDateTime) Describe() string
- func (x XDateTime) Equals(other XDateTime) bool
- func (x XDateTime) MarshalJSON() ([]byte, error)
- func (x XDateTime) Native() time.Time
- func (x XDateTime) Reduce(env utils.Environment) XPrimitive
- func (x XDateTime) String() string
- func (x XDateTime) ToXBoolean(env utils.Environment) XBoolean
- func (x XDateTime) ToXJSON(env utils.Environment) XText
- func (x XDateTime) ToXText(env utils.Environment) XText
- func (x *XDateTime) UnmarshalJSON(data []byte) error
- type XError
- type XIndexable
- type XJSON
- type XJSONArray
- type XJSONObject
- type XLengthable
- type XMap
- type XNumber
- func (x XNumber) Compare(other XNumber) int
- func (x XNumber) Describe() string
- func (x XNumber) Equals(other XNumber) bool
- func (x XNumber) MarshalJSON() ([]byte, error)
- func (x XNumber) Native() decimal.Decimal
- func (x XNumber) Reduce(env utils.Environment) XPrimitive
- func (x XNumber) String() string
- func (x XNumber) ToXBoolean(env utils.Environment) XBoolean
- func (x XNumber) ToXJSON(env utils.Environment) XText
- func (x XNumber) ToXText(env utils.Environment) XText
- func (x *XNumber) UnmarshalJSON(data []byte) error
- type XPrimitive
- type XResolvable
- type XText
- func (x XText) Compare(other XText) int
- func (x XText) Describe() string
- func (x XText) Empty() bool
- func (x XText) Equals(other XText) bool
- func (x XText) Length() int
- func (x XText) MarshalJSON() ([]byte, error)
- func (x XText) Native() string
- func (x XText) Reduce(env utils.Environment) XPrimitive
- func (x XText) String() string
- func (x XText) ToXBoolean(env utils.Environment) XBoolean
- func (x XText) ToXJSON(env utils.Environment) XText
- func (x XText) ToXText(env utils.Environment) XText
- func (x *XText) UnmarshalJSON(data []byte) error
- type XValue
Constants ¶
This section is empty.
Variables ¶
var NilXError = NewXError(nil)
NilXError is the nil error value
var XBooleanFalse = NewXBoolean(false)
XBooleanFalse is the false boolean value
var XBooleanTrue = NewXBoolean(true)
XBooleanTrue is the true boolean value
var XDateTimeZero = NewXDateTime(time.Time{})
XDateTimeZero is the zero time value
var XNumberZero = NewXNumber(decimal.Zero)
XNumberZero is the zero number value
var XTextEmpty = NewXText("")
XTextEmpty is the empty text value
Functions ¶
func Describe ¶ added in v0.10.1
Describe returns a representation of the given value for use in error messages
func Equals ¶ added in v0.9.4
func Equals(env utils.Environment, x1 XValue, x2 XValue) bool
Equals checks for equality between the two give values
func ToXBoolean ¶ added in v0.9.4
func ToXBoolean(env utils.Environment, x XValue) (XBoolean, XError)
ToXBoolean converts the given value to a boolean
func ToXDateTime ¶ added in v0.9.4
func ToXDateTime(env utils.Environment, x XValue) (XDateTime, XError)
ToXDateTime converts the given value to a time or returns an error if that isn't possible
func ToXJSON ¶
func ToXJSON(env utils.Environment, x XValue) (XText, XError)
ToXJSON converts the given value to a JSON string
Types ¶
type XArray ¶
type XArray interface { XPrimitive XIndexable Append(XValue) }
XArray is an array primitive in Excellent expressions
type XBoolean ¶ added in v0.9.0
type XBoolean struct {
// contains filtered or unexported fields
}
XBoolean is a boolean true or false
func NewXBoolean ¶ added in v0.9.0
NewXBoolean creates a new boolean value
func (XBoolean) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (XBoolean) MarshalJSON ¶ added in v0.9.0
MarshalJSON is called when a struct containing this type is marshaled
func (XBoolean) Reduce ¶ added in v0.9.0
func (x XBoolean) Reduce(env utils.Environment) XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XBoolean) String ¶ added in v0.9.0
String returns the native string representation of this type
func (XBoolean) ToXBoolean ¶ added in v0.9.0
func (x XBoolean) ToXBoolean(env utils.Environment) XBoolean
ToXBoolean converts this type to a bool
func (XBoolean) ToXJSON ¶ added in v0.9.0
func (x XBoolean) ToXJSON(env utils.Environment) XText
ToXJSON is called when this type is passed to @(json(...))
func (XBoolean) ToXText ¶ added in v0.9.0
func (x XBoolean) ToXText(env utils.Environment) XText
ToXText converts this type to text
func (*XBoolean) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XDateTime ¶ added in v0.9.0
type XDateTime struct {
// contains filtered or unexported fields
}
XDateTime is a datetime value
func NewXDateTime ¶ added in v0.9.0
NewXDateTime creates a new date
func (XDateTime) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (XDateTime) MarshalJSON ¶ added in v0.9.0
MarshalJSON is called when a struct containing this type is marshaled
func (XDateTime) Reduce ¶ added in v0.9.0
func (x XDateTime) Reduce(env utils.Environment) XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XDateTime) String ¶ added in v0.9.0
String returns the native string representation of this type
func (XDateTime) ToXBoolean ¶ added in v0.9.0
func (x XDateTime) ToXBoolean(env utils.Environment) XBoolean
ToXBoolean converts this type to a bool
func (XDateTime) ToXJSON ¶ added in v0.9.0
func (x XDateTime) ToXJSON(env utils.Environment) XText
ToXJSON is called when this type is passed to @(json(...))
func (XDateTime) ToXText ¶ added in v0.9.0
func (x XDateTime) ToXText(env utils.Environment) XText
ToXText converts this type to text
func (*XDateTime) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XError ¶
type XError interface { error XPrimitive Equals(XError) bool }
XError is an error
func NewXErrorf ¶
NewXErrorf creates a new XError
func NewXResolveError ¶
func NewXResolveError(resolvable XResolvable, key string) XError
NewXResolveError creates a new XError when a key can't be resolved on an XResolvable
type XIndexable ¶
type XIndexable interface { XLengthable Index(index int) XValue }
XIndexable is the interface for types which can be indexed into, e.g. foo.0. Such objects also need to be lengthable so that the engine knows what is a valid index and what isn't.
type XJSON ¶
type XJSON []byte
XJSON is the base type for XJSONObject and XJSONArray
func (XJSON) MarshalJSON ¶
func (XJSON) Reduce ¶
func (x XJSON) Reduce(env utils.Environment) XPrimitive
type XJSONArray ¶
type XJSONArray struct {
XJSON
}
func NewXJSONArray ¶
func NewXJSONArray(data []byte) XJSONArray
func (XJSONArray) Describe ¶ added in v0.10.1
func (x XJSONArray) Describe() string
Describe returns a representation of this type for error messages
func (XJSONArray) Index ¶
func (x XJSONArray) Index(index int) XValue
func (XJSONArray) Length ¶
func (x XJSONArray) Length() int
type XJSONObject ¶
type XJSONObject struct {
XJSON
}
func NewXJSONObject ¶
func NewXJSONObject(data []byte) XJSONObject
func (XJSONObject) Describe ¶ added in v0.10.1
func (x XJSONObject) Describe() string
Describe returns a representation of this type for error messages
func (XJSONObject) Length ¶
func (x XJSONObject) Length() int
func (XJSONObject) Resolve ¶
func (x XJSONObject) Resolve(env utils.Environment, key string) XValue
type XLengthable ¶
type XLengthable interface {
Length() int
}
XLengthable is the interface for types which have a length
type XMap ¶
type XMap interface { XPrimitive XResolvable XLengthable Put(string, XValue) Keys() []string }
XMap is a map primitive in Excellent expressions
func ResolveKeys ¶
func ResolveKeys(env utils.Environment, resolvable XResolvable, keys ...string) XMap
ResolveKeys is a utility function that resolves multiple keys on an XResolvable and returns the results as a map
type XNumber ¶
type XNumber struct {
// contains filtered or unexported fields
}
XNumber is any whole or fractional number
func NewXNumberFromInt ¶
NewXNumberFromInt creates a new XNumber from the given int
func NewXNumberFromInt64 ¶
NewXNumberFromInt64 creates a new XNumber from the given int
func RequireXNumberFromString ¶
RequireXNumberFromString creates a new XNumber from the given string
func (XNumber) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (XNumber) MarshalJSON ¶
MarshalJSON is called when a struct containing this type is marshaled
func (XNumber) Reduce ¶
func (x XNumber) Reduce(env utils.Environment) XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XNumber) ToXBoolean ¶ added in v0.9.0
func (x XNumber) ToXBoolean(env utils.Environment) XBoolean
ToXBoolean converts this type to a bool
func (XNumber) ToXJSON ¶
func (x XNumber) ToXJSON(env utils.Environment) XText
ToXJSON is called when this type is passed to @(json(...))
func (XNumber) ToXText ¶ added in v0.9.0
func (x XNumber) ToXText(env utils.Environment) XText
ToXText converts this type to text
func (*XNumber) UnmarshalJSON ¶
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XPrimitive ¶
type XPrimitive interface { XValue fmt.Stringer ToXText(env utils.Environment) XText ToXBoolean(env utils.Environment) XBoolean }
XPrimitive is the base interface of all Excellent primitive types
type XResolvable ¶
type XResolvable interface {
Resolve(env utils.Environment, key string) XValue
}
XResolvable is the interface for types which can be keyed into, e.g. foo.bar
type XText ¶ added in v0.9.0
type XText struct {
// contains filtered or unexported fields
}
XText is a simple tex value
func MustMarshalToXText ¶ added in v0.9.0
func MustMarshalToXText(x interface{}) XText
MustMarshalToXText calls json.Marshal in the given value and panics in the case of an error
func (XText) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (XText) MarshalJSON ¶ added in v0.9.0
MarshalJSON is called when a struct containing this type is marshaled
func (XText) Reduce ¶ added in v0.9.0
func (x XText) Reduce(env utils.Environment) XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XText) ToXBoolean ¶ added in v0.9.0
func (x XText) ToXBoolean(env utils.Environment) XBoolean
ToXBoolean converts this type to a bool
func (XText) ToXJSON ¶ added in v0.9.0
func (x XText) ToXJSON(env utils.Environment) XText
ToXJSON is called when this type is passed to @(json(...))
func (XText) ToXText ¶ added in v0.9.0
func (x XText) ToXText(env utils.Environment) XText
ToXText converts this type to text
func (*XText) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XValue ¶
type XValue interface { Describe() string ToXJSON(env utils.Environment) XText Reduce(env utils.Environment) XPrimitive }
XValue is the base interface of all Excellent types