Documentation ¶
Index ¶
- Variables
- func Compare(x1 XValue, x2 XValue) (int, error)
- func IsXError(x XValue) bool
- func ToXBool(x XValue) (XBool, XError)
- func ToXDate(env utils.Environment, x XValue) (XDate, XError)
- func ToXJSON(x XValue) (XString, XError)
- func ToXNumber(x XValue) (XNumber, XError)
- func ToXString(x XValue) (XString, XError)
- type XArray
- type XBool
- func (x XBool) Compare(other XBool) int
- func (x XBool) MarshalJSON() ([]byte, error)
- func (x XBool) Native() bool
- func (x XBool) Reduce() XPrimitive
- func (x *XBool) String() string
- func (x XBool) ToXBool() XBool
- func (x XBool) ToXJSON() XString
- func (x XBool) ToXString() XString
- func (x *XBool) UnmarshalJSON(data []byte) error
- type XDate
- func (x XDate) Compare(other XDate) int
- func (x XDate) MarshalJSON() ([]byte, error)
- func (x XDate) Native() time.Time
- func (x XDate) Reduce() XPrimitive
- func (x *XDate) String() string
- func (x XDate) ToXBool() XBool
- func (x XDate) ToXJSON() XString
- func (x XDate) ToXString() XString
- func (x *XDate) 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) ToXBool() XBool
- func (x XNumber) ToXJSON() XString
- func (x XNumber) ToXString() XString
- func (x *XNumber) UnmarshalJSON(data []byte) error
- type XPrimitive
- type XResolvable
- type XString
- func (x XString) Compare(other XString) int
- func (x XString) Empty() bool
- func (x XString) Equals(other XString) bool
- func (x XString) Length() int
- func (x XString) MarshalJSON() ([]byte, error)
- func (x XString) Native() string
- func (x XString) Reduce() XPrimitive
- func (x XString) String() string
- func (x XString) ToXBool() XBool
- func (x XString) ToXJSON() XString
- func (x XString) ToXString() XString
- func (x *XString) UnmarshalJSON(data []byte) error
- type XValue
Constants ¶
This section is empty.
Variables ¶
var NilXError = NewXError(nil)
NilXError is the nil error value
var XBoolFalse = NewXBool(false)
XBoolFalse is the false boolean value
var XBoolTrue = NewXBool(true)
XBoolTrue is the true boolean value
var XDateZero = NewXDate(time.Time{})
XDateZero is the zero time value
var XNumberZero = NewXNumber(decimal.Zero)
XNumberZero is the zero number value
var XStringEmpty = NewXString("")
XStringEmpty is the empty string value
Functions ¶
func ToXDate ¶
func ToXDate(env utils.Environment, x XValue) (XDate, 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 XBool ¶
type XBool struct {
// contains filtered or unexported fields
}
XBool is a boolean true or false
func (XBool) MarshalJSON ¶
MarshalJSON is called when a struct containing this type is marshaled
func (XBool) Reduce ¶
func (x XBool) Reduce() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (*XBool) UnmarshalJSON ¶
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XDate ¶
type XDate struct {
// contains filtered or unexported fields
}
XDate is a date
func (XDate) MarshalJSON ¶
MarshalJSON is called when a struct containing this type is marshaled
func (XDate) Reduce ¶
func (x XDate) Reduce() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (*XDate) UnmarshalJSON ¶
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) 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 XString ¶
type XString struct {
// contains filtered or unexported fields
}
XString is a string of characters
func MustMarshalToXString ¶
func MustMarshalToXString(x interface{}) XString
MustMarshalToXString calls json.Marshal in the given value and panics in the case of an error
func (XString) MarshalJSON ¶
MarshalJSON is called when a struct containing this type is marshaled
func (XString) Reduce ¶
func (x XString) Reduce() XPrimitive
Reduce returns the primitive version of this type (i.e. itself)
func (*XString) UnmarshalJSON ¶
UnmarshalJSON is called when a struct containing this type is unmarshaled
type XValue ¶
type XValue interface { ToXJSON() XString Reduce() XPrimitive }
XValue is the base interface of all Excellent types