Documentation ¶
Overview ¶
Package types declares data types for Rego values and helper functions to operate on these types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var A = NewAny()
A represents the superset of all types.
var B = NewBoolean()
B represents an instance of the boolean type.
var N = NewNumber()
N represents an instance of the number type.
var S = NewString()
S represents an instance of the string type.
Functions ¶
Types ¶
type Any ¶
type Any []Type
Any represents a dynamic type.
func (Any) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array represents the array type.
func (*Array) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Boolean ¶
type Boolean struct{}
Boolean represents the boolean type.
func (Boolean) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type DynamicProperty ¶
DynamicProperty represents a dynamic object property.
func NewDynamicProperty ¶
func NewDynamicProperty(key, value Type) *DynamicProperty
NewDynamicProperty returns a new DynamicProperty object.
func (*DynamicProperty) MarshalJSON ¶
func (p *DynamicProperty) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of p.
func (*DynamicProperty) String ¶
func (p *DynamicProperty) String() string
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
Function represents a function type.
func NewFunction ¶
NewFunction returns a new Function object where xs[:len(xs)-1] are arguments and xs[len(xs)-1] is the result type.
func (*Function) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Null ¶
type Null struct{}
Null represents the null type.
func (Null) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Number ¶
type Number struct{}
Number represents the number type.
func (Number) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object represents the object type.
func NewObject ¶
func NewObject(static []*StaticProperty, dynamic *DynamicProperty) *Object
NewObject returns a new Object type.
func (*Object) DynamicValue ¶
DynamicValue returns the type of the object's dynamic elements.
func (*Object) Keys ¶
func (t *Object) Keys() []interface{}
Keys returns the keys of the object's static elements.
func (*Object) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set represents the set type.
func (*Set) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type StaticProperty ¶
type StaticProperty struct { Key interface{} Value Type }
StaticProperty represents a static object property.
func NewStaticProperty ¶
func NewStaticProperty(key interface{}, value Type) *StaticProperty
NewStaticProperty returns a new StaticProperty object.
func (*StaticProperty) MarshalJSON ¶
func (p *StaticProperty) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of p.
type String ¶
type String struct{}
String represents the string type.
func (String) MarshalJSON ¶
MarshalJSON returns the JSON encoding of t.
type Type ¶
Type represents a type of a term in the language.
func Keys ¶
Keys returns the type of keys that can be enumerated for a. For arrays, the keys are always number types, for objects the keys are always string types, and for sets the keys are always the type of the set element.