Documentation ¶
Index ¶
- Variables
- func Compare(x1 XValue, x2 XValue) (int, error)
- func IsXError(x XValue) bool
- func ToXBool(x XValue) (XBoolean, XError)
- func ToXDate(env utils.Environment, x XValue) (XDateTime, XError)
- func ToXJSON(x XValue) (XText, XError)
- func ToXNumber(x XValue) (XNumber, XError)
- func ToXText(x XValue) (XText, XError)
- type XArray
- type XBoolean
- func (x XBoolean) Compare(other XBoolean) int
- func (x XBoolean) MarshalJSON() ([]byte, error)
- func (x XBoolean) Native() bool
- func (x XBoolean) Reduce() XPrimitive
- func (x *XBoolean) String() string
- func (x XBoolean) ToXBoolean() XBoolean
- func (x XBoolean) ToXJSON() XText
- func (x XBoolean) ToXText() XText
- func (x *XBoolean) UnmarshalJSON(data []byte) error
- type XDateTime
- func (x XDateTime) Compare(other XDateTime) int
- func (x XDateTime) MarshalJSON() ([]byte, error)
- func (x XDateTime) Native() time.Time
- func (x XDateTime) Reduce() XPrimitive
- func (x *XDateTime) String() string
- func (x XDateTime) ToXBoolean() XBoolean
- func (x XDateTime) ToXJSON() XText
- func (x XDateTime) ToXText() 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) Equals(other XNumber) bool
- func (x XNumber) MarshalJSON() ([]byte, error)
- func (x XNumber) Native() decimal.Decimal
- func (x XNumber) Reduce() XPrimitive
- func (x *XNumber) String() string
- func (x XNumber) ToXBoolean() XBoolean
- func (x XNumber) ToXJSON() XText
- func (x XNumber) ToXText() XText
- func (x *XNumber) UnmarshalJSON(data []byte) error
- type XPrimitive
- type XResolvable
- type XText
- func (x XText) Compare(other XText) int
- 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() XPrimitive
- func (x XText) String() string
- func (x XText) ToXBoolean() XBoolean
- func (x XText) ToXJSON() XText
- func (x XText) ToXText() 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 ToXDate ¶
func ToXDate(env utils.Environment, x XValue) (XDateTime, XError)
ToXDate converts the given value to a time or returns an error if that isn't possible
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) 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() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XBoolean) ToXBoolean ¶ added in v0.9.0
ToXBoolean converts this type to a bool
func (XBoolean) ToXJSON ¶ added in v0.9.0
ToXJSON is called when this type is passed to @(json(...))
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) 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() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XDateTime) ToXBoolean ¶ added in v0.9.0
ToXBoolean converts this type to a bool
func (XDateTime) ToXJSON ¶ added in v0.9.0
ToXJSON is called when this type is passed to @(json(...))
func (*XDateTime) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XError ¶
type XError interface { XPrimitive error }
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() XPrimitive
type XJSONArray ¶
type XJSONArray struct {
XJSON
}
func NewXJSONArray ¶
func NewXJSONArray(data []byte) XJSONArray
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) Length ¶
func (x XJSONObject) Length() int
func (XJSONObject) Resolve ¶
func (x XJSONObject) Resolve(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(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) MarshalJSON ¶
MarshalJSON is called when a struct containing this type is marshaled
func (XNumber) Reduce ¶
func (x XNumber) Reduce() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XNumber) ToXBoolean ¶ added in v0.9.0
ToXBoolean converts this type to a bool
func (*XNumber) UnmarshalJSON ¶
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XPrimitive ¶
XPrimitive is the base interface of all Excellent primitive types
type XResolvable ¶
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) 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() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (XText) ToXBoolean ¶ added in v0.9.0
ToXBoolean converts this type to a bool
func (*XText) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XValue ¶
type XValue interface { ToXJSON() XText Reduce() XPrimitive }
XValue is the base interface of all Excellent types