Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Any = TypeFromString("any") Bool = TypeFromString("bool") Char = TypeFromString("char") Data = TypeFromString("data") Number = TypeFromString("number") String = TypeFromString("string") AnyArray = TypeFromString("[]any") BoolArray = TypeFromString("[]bool") NumberArray = TypeFromString("[]number") StringArray = TypeFromString("[]string") AnyMap = TypeFromString("{}any") NumberMap = TypeFromString("{}number") StringMap = TypeFromString("{}string") ErrorInterface = NewInterface("error.Error", map[string]*Type{ "Error": String, }) )
Functions ¶
Types ¶
type Kind ¶
type Kind int
const ( // An unresolved interface (object type) is named, but the properties will // be nil because they are not known. This is a distinction from a resolved // interface which allowed to have zero or more properties. // // KindUnresolvedInterface = 0 on purpose it acts as a fallthrough/unknown // type. KindUnresolvedInterface Kind = iota KindResolvedInterface // Basic types. KindAny KindBool KindChar KindData KindNumber KindString // Other. KindArray KindMap KindFunc )
type Type ¶
type Type struct { Kind Kind // Name is used as the descriptive name for the object. Name string // Element is used when Kind is an Array or Map. Element *Type // Argument and Returns are used when Kind is a Func. Either may be nil. Arguments, Returns []*Type // Properties is used for KindInterface Properties map[string]*Type }
Type represents a data type.
func NewUnresolvedInterface ¶
func TypeFromString ¶
TypeFromString decodes a syntactically-valid type from a string.
Click to show internal directories.
Click to hide internal directories.