types

package
v0.0.0-...-76abfc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 26 Imported by: 16

Documentation

Overview

Example (NextToken)
const src = `# This is scanned code.
  constants => {
    first => 0,
    second => 0x32,
    third => 2e4,
    fourth => 2.3e-2,
    fifth => 'hello',
    sixth => "world",
    type => Foo::Bar,
    value => "String\nWith \\Escape",
    array => [a, b, c],
    call => Boo::Bar(x, 3)
  }`
sr := utils.NewStringReader(src)
for {
	tf := nextToken(sr)
	if tf.i == end {
		break
	}
	fmt.Println(tf)
}
Output:

identifier: 'constants'
rocket: '=>'
leftCurlyBrace: '{'
identifier: 'first'
rocket: '=>'
integer: '0'
comma: ','
identifier: 'second'
rocket: '=>'
integer: '0x32'
comma: ','
identifier: 'third'
rocket: '=>'
float: '2e4'
comma: ','
identifier: 'fourth'
rocket: '=>'
float: '2.3e-2'
comma: ','
identifier: 'fifth'
rocket: '=>'
string: 'hello'
comma: ','
identifier: 'sixth'
rocket: '=>'
string: 'world'
comma: ','
identifier: 'type'
rocket: '=>'
name: 'Foo::Bar'
comma: ','
identifier: 'value'
rocket: '=>'
string: 'String
With \Escape'
comma: ','
identifier: 'array'
rocket: '=>'
leftBracket: '['
identifier: 'a'
comma: ','
identifier: 'b'
comma: ','
identifier: 'c'
rightBracket: ']'
comma: ','
identifier: 'call'
rocket: '=>'
name: 'Boo::Bar'
leftParen: '('
identifier: 'x'
comma: ','
integer: '3'
rightParen: ')'
rightCurlyBrace: '}'

Index

Examples

Constants

View Source
const (
	NsecsPerUsec = 1000
	NsecsPerMsec = NsecsPerUsec * 1000
	NsecsPerSec  = NsecsPerMsec * 1000
	NsecsPerMin  = NsecsPerSec * 60
	NsecsPerHour = NsecsPerMin * 60
	NsecsPerDay  = NsecsPerHour * 24

	KeyString       = `string`
	KeyFormat       = `format`
	KeyNegative     = `negative`
	KeyDays         = `days`
	KeyHours        = `hours`
	KeyMinutes      = `minutes`
	KeySeconds      = `seconds`
	KeyMilliseconds = `milliseconds`
	KeyMicroseconds = `microseconds`
	KeyNanoseconds  = `nanoseconds`
)
View Source
const (
	NoString = "\x00"

	HkArray        = byte('A')
	HkBinary       = byte('B')
	HkBoolean      = byte('b')
	HkDefault      = byte('d')
	HkEntry        = byte('E')
	HkFloat        = byte('f')
	HkHash         = byte('H')
	HkInteger      = byte('i')
	HkRegexp       = byte('r')
	HkTimespan     = byte('D')
	HkTimestamp    = byte('T')
	HkType         = byte('t')
	HkUndef        = byte('u')
	HkUri          = byte('U')
	HkVersion      = byte('v')
	HkVersionRange = byte('R')

	IntegerHex = `(?:0[xX][0-9A-Fa-f]+)`
	IntegerOct = `(?:0[0-7]+)`
	IntegerBin = `(?:0[bB][01]+)`
	IntegerDec = `(?:0|[1-9]\d*)`
	SignPrefix = `[+-]?\s*`

	OptionalFraction = `(?:\.\d+)?`
	OptionalExponent = `(?:[eE]-?\d+)?`
	FloatDec         = `(?:` + IntegerDec + OptionalFraction + OptionalExponent + `)`

	IntegerPattern = `\A` + SignPrefix + `(?:` + IntegerDec + `|` + IntegerHex + `|` + IntegerOct + `|` + IntegerBin + `)\z`
	FloatPattern   = `\A` + SignPrefix + `(?:` + FloatDec + `|` + IntegerHex + `|` + IntegerOct + `|` + IntegerBin + `)\z`
)
View Source
const (
	KeyNameAuthority = `name_authority`
	KeyReferences    = `references`
	KeyTypes         = `types`
	KeyVersion       = `version`
	KeyVersionRange  = `version_range`
)
View Source
const KeyGoName = `go_name`
View Source
const MaxUnixSecs = math.MaxInt64 - 62135596800

MAX_UNIX_SECS is an offset of 62135596800 seconds to sec that represents the number of seconds from 1970-01-01:00:00:00 UTC. This offset must be retracted from the MaxInt64 value in order for it to end up as that value internally.

View Source
const ParseError = `PARSE_ERROR`

Variables

View Source
var AnyMetaType px.ObjectType
View Source
var ArrayMetaType px.ObjectType
View Source
var BinaryMetaType px.ObjectType
View Source
var BooleanFalse = booleanValue(false)
View Source
var BooleanMetaType px.ObjectType
View Source
var BooleanTrue = booleanValue(true)
View Source
var CallableMetaType px.ObjectType
View Source
var CollectionMetaType px.ObjectType
View Source
var DefaultAnyFormat = simpleFormat('s')
View Source
var DefaultArrayContainerFormat = basicFormat('p', `,`, '[', nil)
View Source
var DefaultArrayFormat = basicFormat('a', `,`, '[', nil)
View Source
var DefaultHashContainerFormat = basicFormat('p', ` => `, '{', nil)
View Source
var DefaultHashFormat = basicFormat('h', ` => `, '{', nil)
View Source
var DefaultIndentation = newIndentation(false, 0)
View Source
var DefaultMetaType px.ObjectType
View Source
var DefaultObjectContainerFormat = basicFormat('p', ` => `, '(', nil)
View Source
var DefaultObjectFormat = basicFormat('p', ` => `, '(', nil)
View Source
var DefaultProgramFormat = simpleFormat('p')
View Source
var DefaultTimespanFormats []*TimespanFormat
View Source
var DefaultTimestampFormats []*TimestampFormat
View Source
var DefaultTimestampFormatsWoTz []*TimestampFormat
View Source
var DeferredMetaType px.ObjectType
View Source
var EnumMetaType px.ObjectType
View Source
var Expanded = newFormatContext2(DefaultIndentation, DefaultFormats, map[string]string{`expanded`: `true`})
View Source
var FloatMetaType px.ObjectType
View Source
var HashMetaType px.ObjectType
View Source
var InitMetaType px.ObjectType
View Source
var IntegerMetaType px.ObjectType
View Source
var IntegerTypeOne = &IntegerType{1, 1}
View Source
var IntegerTypePositive = &IntegerType{0, math.MaxInt64}
View Source
var IntegerTypeZero = &IntegerType{0, 0}
View Source
var IterableMetaType px.ObjectType
View Source
var IteratorMetaType px.ObjectType
View Source
var LikeMetaType px.ObjectType
View Source
var MaxTime = time.Unix(MaxUnixSecs, 999999999)
View Source
var MemberNamePattern = regexp.MustCompile(`\A[a-z_]\w*\z`)
View Source
var MinTime = time.Time{}
View Source
var NoPositionalConstructor = func(c px.Context, args []px.Value) px.Value {
	panic(errors.New(`internal error: call to NoPositionalConstructor`))
}
View Source
var None = newFormatContext2(DefaultIndentation, DefaultFormats, nil)
View Source
var NotUndefMetaType px.ObjectType
View Source
var NumericMetaType px.ObjectType
View Source
var ObjectMetaType px.ObjectType

TODO: Implement Type.CanCoerce(Value)

Object.IsInstance is true if value is a Hash matching the attribute requirements
where each entry value can be coerced into the attribute´s type
View Source
var ObjectTypeExtensionMetaType px.ObjectType
View Source
var OneCharStringType = NewStringType(NewIntegerType(1, 1), ``)
View Source
var OptionalMetaType px.ObjectType
View Source
var PatternMetaType px.ObjectType
View Source
var PrettyArrayFormat = basicAltFormat('a', `,`, '[', PrettyContainerFormats)
View Source
var PrettyHashFormat = basicAltFormat('h', ` => `, '{', PrettyContainerFormats)
View Source
var PrettyIndentation = newIndentation(true, 0)
View Source
var PrettyObjectFormat = basicAltFormat('p', ` => `, '(', PrettyContainerFormats)
View Source
var PrettyProgramFormat = newFormat(`%#p`)
View Source
var Program = newFormatContext2(DefaultIndentation, px.FormatMap(singleMap(DefaultAnyType(), DefaultObjectFormat)), nil)
View Source
var RegexpMetaType px.ObjectType
View Source
var RuntimeMetaType px.ObjectType
View Source
var ScalarDataMetaType px.ObjectType
View Source
var ScalarMetaType px.ObjectType
View Source
var SemVerMetaType px.ObjectType
View Source
var SemVerRangeMetaType px.ObjectType
View Source
var SensitiveMetaType px.ObjectType
View Source
var StringMetaType px.ObjectType
View Source
var StructElementMeta px.Type
View Source
var StructMetaType px.ObjectType
View Source
var TagsAnnotationType px.ObjectType
View Source
var TimespanMax = time.Duration(math.MaxInt64)
View Source
var TimespanMetaType px.ObjectType
View Source
var TimespanMin = time.Duration(math.MinInt64)
View Source
var TimestampMetaType px.ObjectType
View Source
var TupleMetaType px.ObjectType
View Source
var TypeAliasMetaType px.ObjectType
View Source
var TypeEquality = newVariantType2(TypeMemberName, TypeMemberNames)
View Source
var TypeFunctions = NewHashType(newVariantType2(TypeMemberName, newPatternType2(NewRegexpTypeR(regexp.MustCompile(`^\[]$`)))), DefaultNotUndefType(), nil)
View Source
var TypeMemberName = newPatternType2(NewRegexpTypeR(MemberNamePattern))
View Source
var TypeMemberNames = newArrayType2(TypeMemberName)
View Source
var TypeMetaType px.ObjectType
View Source
var TypeNamePattern = regexp.MustCompile(`\A[A-Z][\w]*(?:::[A-Z][\w]*)*\z`)
View Source
var TypeObjectInitHash = NewStructType([]*StructElement{
	NewStructElement(newOptionalType3(keyName), TypeTypeName),
	NewStructElement(newOptionalType3(keyParent), NewVariantType(DefaultTypeType(), TypeTypeName)),
	NewStructElement(newOptionalType3(keyTypeParameters), TypeParameters),
	NewStructElement(newOptionalType3(keyAttributes), TypeAttributes),
	NewStructElement(newOptionalType3(keyConstants), TypeConstants),
	NewStructElement(newOptionalType3(keyFunctions), TypeFunctions),
	NewStructElement(newOptionalType3(keyEquality), TypeEquality),
	NewStructElement(newOptionalType3(keyEqualityIncludeType), DefaultBooleanType()),
	NewStructElement(newOptionalType3(keyEquality), TypeEquality),
	NewStructElement(newOptionalType3(keySerialization), TypeMemberNames),
	NewStructElement(newOptionalType3(keyAnnotations), typeAnnotations),
})
View Source
var TypeQualifiedReference = NewPatternType([]*RegexpType{NewRegexpType(`\A[A-Z][\w]*(?:::[A-Z][\w]*)*\z`)})
View Source
var TypeReferenceMetaType px.ObjectType
View Source
var TypeSetMetaType px.ObjectType
View Source
var TypeSimpleTypeName = NewPatternType([]*RegexpType{NewRegexpType(`\A[A-Z]\w*\z`)})
View Source
var TypeTypeParameter = NewStructType([]*StructElement{
	newStructElement2(keyType, DefaultTypeType()),
	NewStructElement(newOptionalType3(keyAnnotations), typeAnnotations),
})
View Source
var TypedNameMetaType px.ObjectType
View Source
var URIMetaType px.ObjectType
View Source
var UndefMetaType px.ObjectType
View Source
var UnitMetaType px.ObjectType
View Source
var VariantMetaType px.ObjectType
View Source
var ZERO = integerValue(0)

Functions

func AllocObjectType

func AllocObjectType() *objectType

func AllocObjectValue

func AllocObjectValue(typ px.ObjectType) px.Object

func AllocTypeSetType

func AllocTypeSetType() *typeSet

func BuildObjectType

func BuildObjectType(name string, parent px.Type, hashProducer func(px.ObjectType) px.OrderedMap) px.ObjectType

func CanCoerce

func CanCoerce(typ px.Type, value px.Value) bool

CanCoerce responds true iv the given value can be coerced into an instance of the given type.

func CoerceTo

func CoerceTo(c px.Context, label string, typ px.Type, value px.Value) (result px.Value)

CoerceTo will deep coerce the given value into an instance of the given type t. The coercion will recurse down into hashes, arrays, and objects and take key, value, and attribute types into account.

The label is used in potential type assertion errors. It should indicate what it is that is being coerced.

func CopyAppend

func CopyAppend(types []px.Type, t px.Type) []px.Type

func DefaultAnnotationType

func DefaultAnnotationType() px.Type

func DefaultObjectType

func DefaultObjectType() *objectType

func DefaultStringType

func DefaultStringType() *stringType

func DefaultTypeSetType

func DefaultTypeSetType() px.TypeSet

func EachCoreType

func EachCoreType(fc func(t px.Type))

func FieldName

func FieldName(f *reflect.StructField) string

func Fields

func Fields(t reflect.Type) []reflect.StructField

func FormatFromHash

func FormatFromHash(h *Hash) px.Format

func GuardedIsAssignable

func GuardedIsAssignable(a px.Type, b px.Type, g px.Guard) bool

func GuardedIsInstance

func GuardedIsInstance(a px.Type, v px.Value, g px.Guard) bool

func LazyIsInstance

func LazyIsInstance(a px.Type, b px.Value, g px.Guard) int

func MakeObjectType

func MakeObjectType(name string, parent px.Type, initHash px.OrderedMap, register bool, creators ...px.DispatchFunction) *objectType

MakeObjectType creates a new object type and optionally registers it as a resolvable to be picked up for resolution on the next call to px.ResolveResolvables if the given register flag is true. This flag should only be set to true when the call stems from a static init() function where no context is available.

func MapToRegexps

func MapToRegexps(regexpTypes []*RegexpType) []*regexp.Regexp

func Methods

func Methods(t reflect.Type) []reflect.Method

func NamedType

func NamedType(na px.URI, name string, value px.Value) px.Type

func NewCollector

func NewCollector() px.Collector

NewCollector returns a new Collector instance

func NewDeferred

func NewDeferred(name string, arguments ...px.Value) *deferred

func NewFormatMap

func NewFormatMap(h *Hash) px.FormatMap

func NewObjectTypeExtension

func NewObjectTypeExtension(c px.Context, baseType px.ObjectType, initParameters []px.Value) *objectTypeExtension

func NewObjectValue

func NewObjectValue(c px.Context, typ px.ObjectType, values []px.Value) (ov px.Object)

func NewReflectedValue

func NewReflectedValue(typ px.ObjectType, value reflect.Value) px.Object

func NewReflector

func NewReflector(c px.Context) px.Reflector

func NewStringType

func NewStringType(rng *IntegerType, s string) px.Type

func NewTagsAnnotation

func NewTagsAnnotation(tags px.OrderedMap) px.TagsAnnotation

func NewTypeSet

func NewTypeSet(na px.URI, name string, initHash px.OrderedMap) px.TypeSet

func NewTypedName

func NewTypedName(namespace px.Namespace, name string) px.TypedName

func NewVariantType

func NewVariantType(types ...px.Type) px.Type

func NilAs

func NilAs(dflt, t px.Type) px.Type

func NormalizeType

func NormalizeType(rt reflect.Type) reflect.Type

NormalizeType ensures that pointers to interface is converted to interface and that struct is converted to pointer to struct

func ObjectToString

func ObjectToString(o px.PuppetObject, s px.FormatContext, b io.Writer, g px.RDetect)

func ParentType

func ParentType(t reflect.Type) reflect.Type

func Parse

func Parse(content string) px.Value

Parse calls ParseFile with the string "<pcore type expression>" as the fileName

Example (Entry)
package main

import (
	"fmt"
	"os"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	const src = `# This is scanned code.
    constants => {
      first => 0,
      second => 0x32,
      third => 2e4,
      fourth => 2.3e-2,
      fifth => 'hello',
      sixth => "world",
      type => Foo::Bar[1,'23',Baz[1,2]],
      value => "String\nWith \\Escape",
      array => [a, b, c],
      call => Boo::Bar("with", "args")
    }
  `
	v := types.Parse(src)
	v.ToString(os.Stdout, px.PrettyExpanded, nil)
	fmt.Println()
}
Output:

{
  'constants' => {
    'first' => 0,
    'second' => 50,
    'third' => 20000.0,
    'fourth' => 0.02300,
    'fifth' => 'hello',
    'sixth' => 'world',
    'type' => DeferredType(Foo::Bar, [1, '23', DeferredType(Baz, [1, 2])]),
    'value' => "String\nWith \\Escape",
    'array' => ['a', 'b', 'c'],
    'call' => Deferred(
      'name' => 'new',
      'arguments' => ['Boo::Bar', 'with', 'args']
    )
  }
}
Example (Hash)
package main

import (
	"fmt"

	"github.com/lyraproj/pcore/types"
)

func main() {
	v := types.Parse(`{value=>-1}`)
	fmt.Println(v)
}
Output:

{'value' => -1}
Example (Int)
package main

import (
	"fmt"
	"os"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	t := types.Parse(`23`)
	t.ToString(os.Stdout, px.PrettyExpanded, nil)
	fmt.Println()
}
Output:

23
Example (QName)
package main

import (
	"fmt"
	"os"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	t := types.Parse(`Foo::Bar`)
	t.ToString(os.Stdout, px.PrettyExpanded, nil)
	fmt.Println()
}
Output:

DeferredType(Foo::Bar)

func ParseFile

func ParseFile(fileName, content string) px.Value

ParseFile parses the given content into a px.Value. The content must be a string representation of a Puppet literal or a type assignment expression. Valid literals are float, integer, string, boolean, undef, array, hash, parameter lists, and type expressions.

Double quoted strings containing interpolation expressions will be parsed into a string verbatim without resolving the interpolations.

func ParseTagHash

func ParseTagHash(tag string) (px.OrderedMap, bool)

func ParseTags

func ParseTags(tag string) map[string]string
Example
fmt.Println(WrapStringToStringMap(ParseTags(`puppet:"hey\"ho" lyra:"here we go"`)))
Output:

{'lyra' => 'here we go', 'puppet' => 'hey"ho'}

func ParseURI

func ParseURI(str string) *url.URL

ParseURI parses a string into a uri.URL and panics with an issue code if the parse fails

func ParseURI2

func ParseURI2(str string, strict bool) (*url.URL, error)

func PopDeclaredTypes

func PopDeclaredTypes() (types []px.ResolvableType)

func PrimitivePType

func PrimitivePType(vt reflect.Type) (pt px.Type, ok bool)

func PuppetFprintf

func PuppetFprintf(buf io.Writer, s string, args ...px.Value)

PuppetFprintf is like fmt.Fprintf but using named arguments accessed with %{key} formatting instructions and using Puppet StringFormatter for evaluating formatting specifications

func PuppetSprintf

func PuppetSprintf(s string, args ...px.Value) string

PuppetSprintf is like fmt.Fprintf but using named arguments accessed with %{key} formatting instructions and using Puppet StringFormatter for evaluating formatting specifications

func ReflectType

func ReflectType(c px.Context, src px.Type) (reflect.Type, bool)

func Resolve

func Resolve(c px.Context, tn string) px.Type

func ResolveDeferred

func ResolveDeferred(c px.Context, a px.Value, scope px.Keyed) px.Value

ResolveDeferred will resolve all occurrences of a DeferredValue in its given argument. Array and Hash arguments will be resolved recursively.

func ResolveWithParams

func ResolveWithParams(c px.Context, name string, args []px.Value) px.Type

func TagHash

func TagHash(f *reflect.StructField) (px.OrderedMap, bool)

func TimeFromHash

func TimeFromHash(hash *Hash) (time.Time, bool)

func TimeFromString

func TimeFromString(value string) time.Time

func TypeToString

func TypeToString(t px.Type, b io.Writer, s px.FormatContext, g px.RDetect)

func URIFromHash

func URIFromHash(hash *Hash) *url.URL

func UniqueTypes

func UniqueTypes(types []px.Type) []px.Type

func UniqueValues

func UniqueValues(values []px.Value) []px.Value
Example
package main

import (
	"fmt"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	x := types.WrapString(`hello`)
	y := types.WrapInteger(32)
	types.UniqueValues([]px.Value{x, y})

	z := types.WrapString(`hello`)
	sv := []px.StringValue{x, z}
	fmt.Println(types.UniqueValues([]px.Value{sv[0], sv[1]}))
}
Output:

[hello]

func ValueSlice

func ValueSlice(slice interface{}) []px.Value

ValueSlice convert a slice of values that implement the pcore.Value interface to []pcore.Value. The method will panic if the given argument is not a slice or array, or if not all elements implement the pcore.Value interface

func WrapBoolean

func WrapBoolean(val bool) px.Boolean

func WrapFloat

func WrapFloat(val float64) px.Float

func WrapInteger

func WrapInteger(val int64) px.Integer

func WrapPrimitive

func WrapPrimitive(vr reflect.Value) (pv px.Value, ok bool)

func WrapString

func WrapString(str string) px.StringValue

Types

type AnyType

type AnyType struct{}

func DefaultAnyType

func DefaultAnyType() *AnyType

func (*AnyType) Accept

func (t *AnyType) Accept(v px.Visitor, g px.Guard)

func (*AnyType) CanSerializeAsString

func (t *AnyType) CanSerializeAsString() bool

func (*AnyType) Equals

func (t *AnyType) Equals(o interface{}, g px.Guard) bool

func (*AnyType) IsAssignable

func (t *AnyType) IsAssignable(o px.Type, g px.Guard) bool

func (*AnyType) IsInstance

func (t *AnyType) IsInstance(v px.Value, g px.Guard) bool

func (*AnyType) MetaType

func (t *AnyType) MetaType() px.ObjectType

func (*AnyType) Name

func (t *AnyType) Name() string

func (*AnyType) PType

func (t *AnyType) PType() px.Type

func (*AnyType) SerializationString

func (t *AnyType) SerializationString() string

func (*AnyType) String

func (t *AnyType) String() string

func (*AnyType) ToString

func (t *AnyType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Array

type Array struct {
	// contains filtered or unexported fields
}

func BuildArray

func BuildArray(len int, bld func(*Array, []px.Value) []px.Value) *Array

func SingletonArray

func SingletonArray(element px.Value) *Array

func WrapArray3

func WrapArray3(iv px.List) *Array

func WrapInterfaces

func WrapInterfaces(c px.Context, elements []interface{}) *Array

func WrapInts

func WrapInts(ints []int) *Array

func WrapStrings

func WrapStrings(strings []string) *Array

func WrapTypes

func WrapTypes(elements []px.Type) *Array

func WrapValues

func WrapValues(elements []px.Value) *Array

func (*Array) Add

func (av *Array) Add(ov px.Value) px.List

func (*Array) AddAll

func (av *Array) AddAll(ov px.List) px.List

func (*Array) All

func (av *Array) All(predicate px.Predicate) bool

func (*Array) Any

func (av *Array) Any(predicate px.Predicate) bool

func (*Array) AppendTo

func (av *Array) AppendTo(slice []px.Value) []px.Value

func (*Array) At

func (av *Array) At(i int) px.Value

func (*Array) Delete

func (av *Array) Delete(ov px.Value) px.List

func (*Array) DeleteAll

func (av *Array) DeleteAll(ov px.List) px.List

func (*Array) DetailedType

func (av *Array) DetailedType() px.Type

func (*Array) Dig

func (av *Array) Dig(into px.Value) px.Value

func (*Array) Each

func (av *Array) Each(consumer px.Consumer)

func (*Array) EachSlice

func (av *Array) EachSlice(n int, consumer px.SliceConsumer)

func (*Array) EachWithIndex

func (av *Array) EachWithIndex(consumer px.IndexedConsumer)

func (*Array) ElementType

func (av *Array) ElementType() px.Type

func (*Array) Equals

func (av *Array) Equals(o interface{}, g px.Guard) bool

func (*Array) Find

func (av *Array) Find(predicate px.Predicate) (px.Value, bool)

func (*Array) Flatten

func (av *Array) Flatten() px.List

func (*Array) IsEmpty

func (av *Array) IsEmpty() bool

func (*Array) IsHashStyle

func (av *Array) IsHashStyle() bool

func (*Array) Len

func (av *Array) Len() int

func (*Array) Map

func (av *Array) Map(mapper px.Mapper) px.List

func (*Array) PType

func (av *Array) PType() px.Type

func (*Array) Reduce

func (av *Array) Reduce(redactor px.BiMapper) px.Value

func (*Array) Reduce2

func (av *Array) Reduce2(initialValue px.Value, redactor px.BiMapper) px.Value

func (*Array) Reflect

func (av *Array) Reflect(c px.Context) reflect.Value

func (*Array) ReflectTo

func (av *Array) ReflectTo(c px.Context, value reflect.Value)

func (*Array) Reject

func (av *Array) Reject(predicate px.Predicate) px.List

func (*Array) Select

func (av *Array) Select(predicate px.Predicate) px.List

func (*Array) Slice

func (av *Array) Slice(i int, j int) px.List

func (*Array) Sort

func (av *Array) Sort(comparator px.Comparator) px.List

func (*Array) String

func (av *Array) String() string

func (*Array) ToKey

func (av *Array) ToKey(b *bytes.Buffer)

func (*Array) ToString

func (av *Array) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*Array) ToString2

func (av *Array) ToString2(b io.Writer, s px.FormatContext, f px.Format, delim byte, g px.RDetect)

func (*Array) Unique

func (av *Array) Unique() px.List

type ArrayType

type ArrayType struct {
	// contains filtered or unexported fields
}

func DefaultArrayType

func DefaultArrayType() *ArrayType

func EmptyArrayType

func EmptyArrayType() *ArrayType

func NewArrayType

func NewArrayType(element px.Type, rng *IntegerType) *ArrayType

func (*ArrayType) Accept

func (t *ArrayType) Accept(v px.Visitor, g px.Guard)

func (*ArrayType) CanSerializeAsString

func (t *ArrayType) CanSerializeAsString() bool

func (*ArrayType) Default

func (t *ArrayType) Default() px.Type

func (*ArrayType) ElementType

func (t *ArrayType) ElementType() px.Type

func (*ArrayType) Equals

func (t *ArrayType) Equals(o interface{}, g px.Guard) bool

func (*ArrayType) Generic

func (t *ArrayType) Generic() px.Type

func (*ArrayType) Get

func (t *ArrayType) Get(key string) (value px.Value, ok bool)

func (*ArrayType) IsAssignable

func (t *ArrayType) IsAssignable(o px.Type, g px.Guard) bool

func (*ArrayType) IsInstance

func (t *ArrayType) IsInstance(v px.Value, g px.Guard) bool

func (*ArrayType) MetaType

func (t *ArrayType) MetaType() px.ObjectType

func (*ArrayType) Name

func (t *ArrayType) Name() string

func (*ArrayType) PType

func (t *ArrayType) PType() px.Type

func (*ArrayType) Parameters

func (t *ArrayType) Parameters() []px.Value

func (*ArrayType) ReflectType

func (t *ArrayType) ReflectType(c px.Context) (reflect.Type, bool)

func (*ArrayType) Resolve

func (t *ArrayType) Resolve(c px.Context) px.Type

func (*ArrayType) SerializationString

func (t *ArrayType) SerializationString() string

func (*ArrayType) Size

func (t *ArrayType) Size() *IntegerType

func (*ArrayType) String

func (t *ArrayType) String() string

func (*ArrayType) ToString

func (t *ArrayType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type BasicCollector

type BasicCollector struct {
	// contains filtered or unexported fields
}

A BasicCollector is an extendable basic implementation of the Collector interface

func (*BasicCollector) Add

func (hm *BasicCollector) Add(element px.Value)

func (*BasicCollector) AddArray

func (hm *BasicCollector) AddArray(cap int, doer px.Doer)

func (*BasicCollector) AddHash

func (hm *BasicCollector) AddHash(cap int, doer px.Doer)

func (*BasicCollector) AddRef

func (hm *BasicCollector) AddRef(ref int)

func (*BasicCollector) CanDoBinary

func (hm *BasicCollector) CanDoBinary() bool

func (*BasicCollector) CanDoComplexKeys

func (hm *BasicCollector) CanDoComplexKeys() bool

func (*BasicCollector) Init

func (hm *BasicCollector) Init()

func (*BasicCollector) PopLast

func (hm *BasicCollector) PopLast() px.Value

func (*BasicCollector) StringDedupThreshold

func (hm *BasicCollector) StringDedupThreshold() int

func (*BasicCollector) Value

func (hm *BasicCollector) Value() px.Value

type Binary

type Binary struct {
	// contains filtered or unexported fields
}

Binary keeps only the value because the type is known and not parameterized

func BinaryFromArray

func BinaryFromArray(array px.List) *Binary

func BinaryFromFile

func BinaryFromFile(path string) *Binary

BinaryFromFile opens file appointed by the given path for reading and returns its contents as a Binary. The function will panic with an issue.Reported unless the operation succeeds.

func BinaryFromFile2

func BinaryFromFile2(path string) (*Binary, bool)

BinaryFromFile2 opens file appointed by the given path for reading and returns its contents as a Binary together with a boolean indicating if the file was found or not.

The function will only return false if the given file does not exist. It will panic with an issue.Reported on all other errors.

func BinaryFromString

func BinaryFromString(str string, f string) *Binary

func WrapBinary

func WrapBinary(val []byte) *Binary

func (*Binary) AsArray

func (bv *Binary) AsArray() px.List

func (*Binary) Bytes

func (bv *Binary) Bytes() []byte

func (*Binary) CanSerializeAsString

func (bv *Binary) CanSerializeAsString() bool

func (*Binary) Equals

func (bv *Binary) Equals(o interface{}, g px.Guard) bool

func (*Binary) PType

func (bv *Binary) PType() px.Type

func (*Binary) Reflect

func (bv *Binary) Reflect(c px.Context) reflect.Value

func (*Binary) ReflectTo

func (bv *Binary) ReflectTo(c px.Context, value reflect.Value)

func (*Binary) SerializationString

func (bv *Binary) SerializationString() string

func (*Binary) String

func (bv *Binary) String() string

func (*Binary) ToKey

func (bv *Binary) ToKey(b *bytes.Buffer)

func (*Binary) ToString

func (bv *Binary) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type BinaryType

type BinaryType struct{}

func DefaultBinaryType

func DefaultBinaryType() *BinaryType

func (*BinaryType) Accept

func (t *BinaryType) Accept(v px.Visitor, g px.Guard)

func (*BinaryType) CanSerializeAsString

func (t *BinaryType) CanSerializeAsString() bool

func (*BinaryType) Equals

func (t *BinaryType) Equals(o interface{}, g px.Guard) bool

func (*BinaryType) IsAssignable

func (t *BinaryType) IsAssignable(o px.Type, g px.Guard) bool

func (*BinaryType) IsInstance

func (t *BinaryType) IsInstance(o px.Value, g px.Guard) bool

func (*BinaryType) MetaType

func (t *BinaryType) MetaType() px.ObjectType

func (*BinaryType) Name

func (t *BinaryType) Name() string

func (*BinaryType) PType

func (t *BinaryType) PType() px.Type

func (*BinaryType) ReflectType

func (t *BinaryType) ReflectType(c px.Context) (reflect.Type, bool)

func (*BinaryType) SerializationString

func (t *BinaryType) SerializationString() string

func (*BinaryType) String

func (t *BinaryType) String() string

func (*BinaryType) ToString

func (t *BinaryType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type BooleanType

type BooleanType struct {
	// contains filtered or unexported fields
}

func DefaultBooleanType

func DefaultBooleanType() *BooleanType

func NewBooleanType

func NewBooleanType(value bool) *BooleanType

func (*BooleanType) Accept

func (t *BooleanType) Accept(v px.Visitor, g px.Guard)

func (*BooleanType) CanSerializeAsString

func (t *BooleanType) CanSerializeAsString() bool

func (*BooleanType) Default

func (t *BooleanType) Default() px.Type

func (*BooleanType) Equals

func (t *BooleanType) Equals(o interface{}, g px.Guard) bool

func (*BooleanType) Generic

func (t *BooleanType) Generic() px.Type

func (*BooleanType) Get

func (t *BooleanType) Get(key string) (px.Value, bool)

func (*BooleanType) IsAssignable

func (t *BooleanType) IsAssignable(o px.Type, g px.Guard) bool

func (*BooleanType) IsInstance

func (t *BooleanType) IsInstance(o px.Value, g px.Guard) bool

func (*BooleanType) MetaType

func (t *BooleanType) MetaType() px.ObjectType

func (*BooleanType) Name

func (t *BooleanType) Name() string

func (*BooleanType) PType

func (t *BooleanType) PType() px.Type

func (*BooleanType) Parameters

func (t *BooleanType) Parameters() []px.Value

func (*BooleanType) ReflectType

func (t *BooleanType) ReflectType(c px.Context) (reflect.Type, bool)

func (*BooleanType) SerializationString

func (t *BooleanType) SerializationString() string

func (*BooleanType) String

func (t *BooleanType) String() string

func (*BooleanType) ToString

func (t *BooleanType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type BuildFunctionArgs

type BuildFunctionArgs struct {
	Name       string
	LocalTypes px.LocalTypesCreator
	Creators   []px.DispatchCreator
}

func PopDeclaredConstructors

func PopDeclaredConstructors() (ctorDecls []*BuildFunctionArgs)

type CallableType

type CallableType struct {
	// contains filtered or unexported fields
}

func DefaultCallableType

func DefaultCallableType() *CallableType

func NewCallableType

func NewCallableType(paramsType px.Type, returnType px.Type, blockType px.Type) *CallableType
Example
package main

import (
	"fmt"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	cc := types.NewCallableType(types.NewTupleType([]px.Type{types.DefaultUnitType()}, types.PositiveIntegerType()), nil, nil)
	fmt.Println(cc)
}
Output:

Callable[0, default]

func (*CallableType) Accept

func (t *CallableType) Accept(v px.Visitor, g px.Guard)

func (*CallableType) BlockName

func (t *CallableType) BlockName() string

func (*CallableType) BlockType

func (t *CallableType) BlockType() px.Type

func (*CallableType) CallableWith

func (t *CallableType) CallableWith(args []px.Value, block px.Lambda) bool

func (*CallableType) CanSerializeAsString

func (t *CallableType) CanSerializeAsString() bool

func (*CallableType) Default

func (t *CallableType) Default() px.Type

func (*CallableType) Equals

func (t *CallableType) Equals(o interface{}, g px.Guard) bool

func (*CallableType) Generic

func (t *CallableType) Generic() px.Type

func (*CallableType) Get

func (t *CallableType) Get(key string) (px.Value, bool)

func (*CallableType) IsAssignable

func (t *CallableType) IsAssignable(o px.Type, g px.Guard) bool

func (*CallableType) IsInstance

func (t *CallableType) IsInstance(o px.Value, g px.Guard) bool

func (*CallableType) MetaType

func (t *CallableType) MetaType() px.ObjectType

func (*CallableType) Name

func (t *CallableType) Name() string

func (*CallableType) PType

func (t *CallableType) PType() px.Type

func (*CallableType) ParameterNames

func (t *CallableType) ParameterNames() []string

func (*CallableType) Parameters

func (t *CallableType) Parameters() (params []px.Value)

func (*CallableType) ParametersType

func (t *CallableType) ParametersType() px.Type

func (*CallableType) Resolve

func (t *CallableType) Resolve(c px.Context) px.Type

func (*CallableType) ReturnType

func (t *CallableType) ReturnType() px.Type

func (*CallableType) SerializationString

func (t *CallableType) SerializationString() string

func (*CallableType) String

func (t *CallableType) String() string

func (*CallableType) ToString

func (t *CallableType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type CollectionType

type CollectionType struct {
	// contains filtered or unexported fields
}

func DefaultCollectionType

func DefaultCollectionType() *CollectionType

func NewCollectionType

func NewCollectionType(size *IntegerType) *CollectionType

func (*CollectionType) Accept

func (t *CollectionType) Accept(v px.Visitor, g px.Guard)

func (*CollectionType) CanSerializeAsString

func (t *CollectionType) CanSerializeAsString() bool

func (*CollectionType) Default

func (t *CollectionType) Default() px.Type

func (*CollectionType) Equals

func (t *CollectionType) Equals(o interface{}, g px.Guard) bool

func (*CollectionType) Generic

func (t *CollectionType) Generic() px.Type

func (*CollectionType) Get

func (t *CollectionType) Get(key string) (px.Value, bool)

func (*CollectionType) IsAssignable

func (t *CollectionType) IsAssignable(o px.Type, g px.Guard) bool

func (*CollectionType) IsInstance

func (t *CollectionType) IsInstance(o px.Value, g px.Guard) bool

func (*CollectionType) MetaType

func (t *CollectionType) MetaType() px.ObjectType

func (*CollectionType) Name

func (t *CollectionType) Name() string

func (*CollectionType) PType

func (t *CollectionType) PType() px.Type

func (*CollectionType) Parameters

func (t *CollectionType) Parameters() []px.Value

func (*CollectionType) SerializationString

func (t *CollectionType) SerializationString() string

func (*CollectionType) Size

func (t *CollectionType) Size() *IntegerType

func (*CollectionType) String

func (t *CollectionType) String() string

func (*CollectionType) ToString

func (t *CollectionType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type DefaultType

type DefaultType struct{}

func DefaultDefaultType

func DefaultDefaultType() *DefaultType

func (*DefaultType) Accept

func (t *DefaultType) Accept(v px.Visitor, g px.Guard)

func (*DefaultType) CanSerializeAsString

func (t *DefaultType) CanSerializeAsString() bool

func (*DefaultType) Equals

func (t *DefaultType) Equals(o interface{}, g px.Guard) bool

func (*DefaultType) IsAssignable

func (t *DefaultType) IsAssignable(o px.Type, g px.Guard) bool

func (*DefaultType) IsInstance

func (t *DefaultType) IsInstance(o px.Value, g px.Guard) bool

func (*DefaultType) MetaType

func (t *DefaultType) MetaType() px.ObjectType

func (*DefaultType) Name

func (t *DefaultType) Name() string

func (*DefaultType) PType

func (t *DefaultType) PType() px.Type

func (*DefaultType) SerializationString

func (t *DefaultType) SerializationString() string

func (*DefaultType) String

func (t *DefaultType) String() string

func (*DefaultType) ToString

func (t *DefaultType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type DefaultValue

type DefaultValue struct{}

DefaultValue is an empty struct because both type and value are known

func WrapDefault

func WrapDefault() *DefaultValue

func (*DefaultValue) Equals

func (dv *DefaultValue) Equals(o interface{}, g px.Guard) bool

func (*DefaultValue) PType

func (dv *DefaultValue) PType() px.Type

func (*DefaultValue) String

func (dv *DefaultValue) String() string

func (*DefaultValue) ToKey

func (dv *DefaultValue) ToKey() px.HashKey

func (*DefaultValue) ToString

func (dv *DefaultValue) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Deferred

type Deferred interface {
	px.Value

	Name() string

	Arguments() *Array

	Resolve(c px.Context, scope px.Keyed) px.Value
}

type DeferredType

type DeferredType struct {
	// contains filtered or unexported fields
}

func NewDeferredType

func NewDeferredType(name string, params ...px.Value) *DeferredType

func (*DeferredType) Equals

func (dt *DeferredType) Equals(other interface{}, guard px.Guard) bool

func (*DeferredType) Name

func (dt *DeferredType) Name() string

func (*DeferredType) PType

func (dt *DeferredType) PType() px.Type

func (*DeferredType) Parameters

func (dt *DeferredType) Parameters() []px.Value

func (*DeferredType) Resolve

func (dt *DeferredType) Resolve(c px.Context) px.Type

func (*DeferredType) String

func (dt *DeferredType) String() string

func (*DeferredType) ToString

func (dt *DeferredType) ToString(bld io.Writer, s px.FormatContext, g px.RDetect)

type EnumType

type EnumType struct {
	// contains filtered or unexported fields
}

func DefaultEnumType

func DefaultEnumType() *EnumType

func NewEnumType

func NewEnumType(enums []string, caseInsensitive bool) *EnumType

func (*EnumType) Accept

func (t *EnumType) Accept(v px.Visitor, g px.Guard)

func (*EnumType) CanSerializeAsString

func (t *EnumType) CanSerializeAsString() bool

func (*EnumType) Default

func (t *EnumType) Default() px.Type

func (*EnumType) Equals

func (t *EnumType) Equals(o interface{}, g px.Guard) bool

func (*EnumType) Generic

func (t *EnumType) Generic() px.Type

func (*EnumType) Get

func (t *EnumType) Get(key string) (px.Value, bool)

func (*EnumType) IsAssignable

func (t *EnumType) IsAssignable(o px.Type, g px.Guard) bool

func (*EnumType) IsCaseInsensitive

func (t *EnumType) IsCaseInsensitive() bool

func (*EnumType) IsInstance

func (t *EnumType) IsInstance(o px.Value, g px.Guard) bool

func (*EnumType) MetaType

func (t *EnumType) MetaType() px.ObjectType

func (*EnumType) Name

func (t *EnumType) Name() string

func (*EnumType) PType

func (t *EnumType) PType() px.Type

func (*EnumType) Parameters

func (t *EnumType) Parameters() []px.Value

func (*EnumType) ReflectType

func (t *EnumType) ReflectType(c px.Context) (reflect.Type, bool)

func (*EnumType) SerializationString

func (t *EnumType) SerializationString() string

func (*EnumType) String

func (t *EnumType) String() string

func (*EnumType) Strings

func (t *EnumType) Strings() []string

func (*EnumType) ToString

func (t *EnumType) ToString(b io.Writer, f px.FormatContext, g px.RDetect)

type FloatType

type FloatType struct {
	// contains filtered or unexported fields
}

func DefaultFloatType

func DefaultFloatType() *FloatType

func NewFloatType

func NewFloatType(min float64, max float64) *FloatType

func (*FloatType) Accept

func (t *FloatType) Accept(v px.Visitor, g px.Guard)

func (*FloatType) CanSerializeAsString

func (t *FloatType) CanSerializeAsString() bool

func (*FloatType) Default

func (t *FloatType) Default() px.Type

func (*FloatType) Equals

func (t *FloatType) Equals(o interface{}, g px.Guard) bool

func (*FloatType) Generic

func (t *FloatType) Generic() px.Type

func (*FloatType) Get

func (t *FloatType) Get(key string) (px.Value, bool)

func (*FloatType) IsAssignable

func (t *FloatType) IsAssignable(o px.Type, g px.Guard) bool

func (*FloatType) IsInstance

func (t *FloatType) IsInstance(o px.Value, g px.Guard) bool

func (*FloatType) IsUnbounded

func (t *FloatType) IsUnbounded() bool

func (*FloatType) Max

func (t *FloatType) Max() float64

func (*FloatType) MetaType

func (t *FloatType) MetaType() px.ObjectType

func (*FloatType) Min

func (t *FloatType) Min() float64

func (*FloatType) Name

func (t *FloatType) Name() string

func (*FloatType) PType

func (t *FloatType) PType() px.Type

func (*FloatType) Parameters

func (t *FloatType) Parameters() []px.Value

func (*FloatType) ReflectType

func (t *FloatType) ReflectType(c px.Context) (reflect.Type, bool)

func (*FloatType) SerializationString

func (t *FloatType) SerializationString() string

func (*FloatType) String

func (t *FloatType) String() string

func (*FloatType) ToString

func (t *FloatType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

func BuildHash

func BuildHash(len int, bld func(*Hash, []*HashEntry) []*HashEntry) *Hash

func IndexedFromArray

func IndexedFromArray(a *Array) *Hash

func WrapHash

func WrapHash(entries []*HashEntry) *Hash
Example
package main

import (
	"fmt"
	"regexp"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	a := px.Wrap(nil, map[string]interface{}{
		`foo`: 23,
		`fee`: `hello`,
		`fum`: map[string]interface{}{
			`x`: `1`,
			`y`: []int{1, 2, 3},
			`z`: regexp.MustCompile(`^[a-z]+$`)}})

	e := types.WrapHash([]*types.HashEntry{
		types.WrapHashEntry2(`foo`, types.WrapInteger(23)),
		types.WrapHashEntry2(`fee`, types.WrapString(`hello`)),
		types.WrapHashEntry2(`fum`, types.WrapHash([]*types.HashEntry{
			types.WrapHashEntry2(`x`, types.WrapString(`1`)),
			types.WrapHashEntry2(`y`, types.WrapValues([]px.Value{
				types.WrapInteger(1), types.WrapInteger(2), types.WrapInteger(3)})),
			types.WrapHashEntry2(`z`, types.WrapRegexp(`^[a-z]+$`))}))})

	fmt.Println(e.Equals(a, nil))
}
Output:

true

func WrapHash2

func WrapHash2(entries px.List) *Hash

func WrapHashFromArray

func WrapHashFromArray(a *Array) *Hash

func WrapStringPValue

func WrapStringPValue(hash hash.StringHash) *Hash

func WrapStringToInterfaceMap

func WrapStringToInterfaceMap(c px.Context, hash map[string]interface{}) *Hash

WrapStringToInterfaceMap does not preserve order since order is undefined in a Go map

func WrapStringToStringMap

func WrapStringToStringMap(hash map[string]string) *Hash

WrapStringToStringMap does not preserve order since order is undefined in a Go map

func WrapStringToTypeMap

func WrapStringToTypeMap(hash map[string]px.Type) *Hash

WrapStringToTypeMap builds an ordered map from adds all entries in the given map

func WrapStringToValueMap

func WrapStringToValueMap(hash map[string]px.Value) *Hash

WrapStringToValueMap builds an ordered map from adds all entries in the given map

func (*Hash) Add

func (hv *Hash) Add(v px.Value) px.List

func (*Hash) AddAll

func (hv *Hash) AddAll(v px.List) px.List

func (*Hash) All

func (hv *Hash) All(predicate px.Predicate) bool

func (*Hash) AllKeysAreStrings

func (hv *Hash) AllKeysAreStrings() bool

func (*Hash) AllPairs

func (hv *Hash) AllPairs(predicate px.BiPredicate) bool

func (*Hash) Any

func (hv *Hash) Any(predicate px.Predicate) bool

func (*Hash) AnyPair

func (hv *Hash) AnyPair(predicate px.BiPredicate) bool

func (*Hash) AppendEntriesTo

func (hv *Hash) AppendEntriesTo(entries []*HashEntry) []*HashEntry

func (*Hash) AppendTo

func (hv *Hash) AppendTo(slice []px.Value) []px.Value

func (*Hash) AsArray

func (hv *Hash) AsArray() px.List

func (*Hash) At

func (hv *Hash) At(i int) px.Value

func (*Hash) Delete

func (hv *Hash) Delete(key px.Value) px.List

func (*Hash) DeleteAll

func (hv *Hash) DeleteAll(keys px.List) px.List

func (*Hash) DetailedType

func (hv *Hash) DetailedType() px.Type

func (*Hash) Each

func (hv *Hash) Each(consumer px.Consumer)

func (*Hash) EachKey

func (hv *Hash) EachKey(consumer px.Consumer)

func (*Hash) EachPair

func (hv *Hash) EachPair(consumer px.BiConsumer)

func (*Hash) EachSlice

func (hv *Hash) EachSlice(n int, consumer px.SliceConsumer)

func (*Hash) EachValue

func (hv *Hash) EachValue(consumer px.Consumer)

func (*Hash) EachWithIndex

func (hv *Hash) EachWithIndex(consumer px.IndexedConsumer)

func (*Hash) ElementType

func (hv *Hash) ElementType() px.Type

func (*Hash) Entries

func (hv *Hash) Entries() px.List

func (*Hash) Equals

func (hv *Hash) Equals(o interface{}, g px.Guard) bool

func (*Hash) Find

func (hv *Hash) Find(predicate px.Predicate) (px.Value, bool)

func (*Hash) Flatten

func (hv *Hash) Flatten() px.List

func (*Hash) Get

func (hv *Hash) Get(key px.Value) (px.Value, bool)

func (*Hash) Get2

func (hv *Hash) Get2(key px.Value, dflt px.Value) px.Value

func (*Hash) Get3

func (hv *Hash) Get3(key px.Value, dflt px.Producer) px.Value

func (*Hash) Get4

func (hv *Hash) Get4(key string) (px.Value, bool)

func (*Hash) Get5

func (hv *Hash) Get5(key string, dflt px.Value) px.Value

func (*Hash) Get6

func (hv *Hash) Get6(key string, dflt px.Producer) px.Value

func (*Hash) GetEntry

func (hv *Hash) GetEntry(key string) (px.MapEntry, bool)

func (*Hash) GetEntryFold

func (hv *Hash) GetEntryFold(key string) (px.MapEntry, bool)

func (*Hash) IncludesKey

func (hv *Hash) IncludesKey(o px.Value) bool

func (*Hash) IncludesKey2

func (hv *Hash) IncludesKey2(key string) bool

func (*Hash) IsEmpty

func (hv *Hash) IsEmpty() bool

func (*Hash) IsHashStyle

func (hv *Hash) IsHashStyle() bool

func (*Hash) Keys

func (hv *Hash) Keys() px.List

func (*Hash) Len

func (hv *Hash) Len() int

func (*Hash) Map

func (hv *Hash) Map(mapper px.Mapper) px.List

func (*Hash) MapEntries

func (hv *Hash) MapEntries(mapper px.EntryMapper) px.OrderedMap

func (*Hash) MapValues

func (hv *Hash) MapValues(mapper px.Mapper) px.OrderedMap

func (*Hash) Merge

func (hv *Hash) Merge(o px.OrderedMap) px.OrderedMap

func (*Hash) PType

func (hv *Hash) PType() px.Type

func (*Hash) Reduce

func (hv *Hash) Reduce(redactor px.BiMapper) px.Value

func (*Hash) Reduce2

func (hv *Hash) Reduce2(initialValue px.Value, redactor px.BiMapper) px.Value

func (*Hash) Reflect

func (hv *Hash) Reflect(c px.Context) reflect.Value

func (*Hash) ReflectTo

func (hv *Hash) ReflectTo(c px.Context, value reflect.Value)

func (*Hash) Reject

func (hv *Hash) Reject(predicate px.Predicate) px.List

func (*Hash) RejectPairs

func (hv *Hash) RejectPairs(predicate px.BiPredicate) px.OrderedMap

func (*Hash) Select

func (hv *Hash) Select(predicate px.Predicate) px.List

func (*Hash) SelectPairs

func (hv *Hash) SelectPairs(predicate px.BiPredicate) px.OrderedMap

func (*Hash) Slice

func (hv *Hash) Slice(i int, j int) px.List

func (*Hash) Sort

func (hv *Hash) Sort(comparator px.Comparator) px.List

Sort reorders the associations of this hash by applying the comparator to the keys

func (*Hash) String

func (hv *Hash) String() string

func (*Hash) ToKey

func (hv *Hash) ToKey(b *bytes.Buffer)

func (*Hash) ToString

func (hv *Hash) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*Hash) ToString2

func (hv *Hash) ToString2(b io.Writer, s px.FormatContext, f px.Format, delim byte, g px.RDetect)

func (*Hash) ToStringMap

func (hv *Hash) ToStringMap() map[string]px.Value

func (*Hash) Unique

func (hv *Hash) Unique() px.List

Unique on a Hash will always return self since the keys of a hash are unique

func (*Hash) Values

func (hv *Hash) Values() px.List

type HashEntry

type HashEntry struct {
	// contains filtered or unexported fields
}

func WrapHashEntry

func WrapHashEntry(key px.Value, value px.Value) *HashEntry

func WrapHashEntry2

func WrapHashEntry2(key string, value px.Value) *HashEntry

func (*HashEntry) Add

func (he *HashEntry) Add(v px.Value) px.List

func (*HashEntry) AddAll

func (he *HashEntry) AddAll(v px.List) px.List

func (*HashEntry) All

func (he *HashEntry) All(predicate px.Predicate) bool

func (*HashEntry) Any

func (he *HashEntry) Any(predicate px.Predicate) bool

func (*HashEntry) AppendTo

func (he *HashEntry) AppendTo(slice []px.Value) []px.Value

func (*HashEntry) AsArray

func (he *HashEntry) AsArray() px.List

func (*HashEntry) At

func (he *HashEntry) At(i int) px.Value

func (*HashEntry) Delete

func (he *HashEntry) Delete(v px.Value) px.List

func (*HashEntry) DeleteAll

func (he *HashEntry) DeleteAll(v px.List) px.List

func (*HashEntry) DetailedType

func (he *HashEntry) DetailedType() px.Type

func (*HashEntry) Each

func (he *HashEntry) Each(consumer px.Consumer)

func (*HashEntry) EachSlice

func (he *HashEntry) EachSlice(n int, consumer px.SliceConsumer)

func (*HashEntry) EachWithIndex

func (he *HashEntry) EachWithIndex(consumer px.IndexedConsumer)

func (*HashEntry) ElementType

func (he *HashEntry) ElementType() px.Type

func (*HashEntry) Equals

func (he *HashEntry) Equals(o interface{}, g px.Guard) bool

func (*HashEntry) Find

func (he *HashEntry) Find(predicate px.Predicate) (px.Value, bool)

func (*HashEntry) Flatten

func (he *HashEntry) Flatten() px.List

func (*HashEntry) IsEmpty

func (he *HashEntry) IsEmpty() bool

func (*HashEntry) IsHashStyle

func (he *HashEntry) IsHashStyle() bool

func (*HashEntry) Key

func (he *HashEntry) Key() px.Value

func (*HashEntry) Len

func (he *HashEntry) Len() int

func (*HashEntry) Map

func (he *HashEntry) Map(mapper px.Mapper) px.List

func (*HashEntry) PType

func (he *HashEntry) PType() px.Type

func (*HashEntry) Reduce

func (he *HashEntry) Reduce(redactor px.BiMapper) px.Value

func (*HashEntry) Reduce2

func (he *HashEntry) Reduce2(initialValue px.Value, redactor px.BiMapper) px.Value

func (*HashEntry) Reject

func (he *HashEntry) Reject(predicate px.Predicate) px.List

func (*HashEntry) Select

func (he *HashEntry) Select(predicate px.Predicate) px.List

func (*HashEntry) Slice

func (he *HashEntry) Slice(i int, j int) px.List

func (*HashEntry) String

func (he *HashEntry) String() string

func (*HashEntry) ToKey

func (he *HashEntry) ToKey(b *bytes.Buffer)

func (*HashEntry) ToString

func (he *HashEntry) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*HashEntry) Unique

func (he *HashEntry) Unique() px.List

func (*HashEntry) Value

func (he *HashEntry) Value() px.Value

type HashType

type HashType struct {
	// contains filtered or unexported fields
}

func DefaultHashType

func DefaultHashType() *HashType

func EmptyHashType

func EmptyHashType() *HashType

func NewHashType

func NewHashType(keyType px.Type, valueType px.Type, rng *IntegerType) *HashType

func (*HashType) Accept

func (t *HashType) Accept(v px.Visitor, g px.Guard)

func (*HashType) CanSerializeAsString

func (t *HashType) CanSerializeAsString() bool

func (*HashType) Default

func (t *HashType) Default() px.Type

func (*HashType) EntryType

func (t *HashType) EntryType() px.Type

func (*HashType) Equals

func (t *HashType) Equals(o interface{}, g px.Guard) bool

func (*HashType) Generic

func (t *HashType) Generic() px.Type

func (*HashType) Get

func (t *HashType) Get(key string) (value px.Value, ok bool)

func (*HashType) IsAssignable

func (t *HashType) IsAssignable(o px.Type, g px.Guard) bool

func (*HashType) IsInstance

func (t *HashType) IsInstance(o px.Value, g px.Guard) bool

func (*HashType) KeyType

func (t *HashType) KeyType() px.Type

func (*HashType) MetaType

func (t *HashType) MetaType() px.ObjectType

func (*HashType) Name

func (t *HashType) Name() string

func (*HashType) PType

func (t *HashType) PType() px.Type

func (*HashType) Parameters

func (t *HashType) Parameters() []px.Value

func (*HashType) ReflectType

func (t *HashType) ReflectType(c px.Context) (reflect.Type, bool)

func (*HashType) Resolve

func (t *HashType) Resolve(c px.Context) px.Type

func (*HashType) SerializationString

func (t *HashType) SerializationString() string

func (*HashType) Size

func (t *HashType) Size() *IntegerType

func (*HashType) String

func (t *HashType) String() string

func (*HashType) ToString

func (t *HashType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*HashType) ValueType

func (t *HashType) ValueType() px.Type

type InitType

type InitType struct {
	// contains filtered or unexported fields
}

func DefaultInitType

func DefaultInitType() *InitType

func NewInitType

func NewInitType(typ px.Value, args px.Value) *InitType

func (*InitType) Accept

func (t *InitType) Accept(v px.Visitor, g px.Guard)

func (*InitType) CanSerializeAsString

func (t *InitType) CanSerializeAsString() bool

func (*InitType) Default

func (t *InitType) Default() px.Type

func (*InitType) EachSignature

func (t *InitType) EachSignature(doer func(signature px.Signature))

func (*InitType) Equals

func (t *InitType) Equals(o interface{}, g px.Guard) bool

func (*InitType) Get

func (t *InitType) Get(key string) (px.Value, bool)

func (*InitType) IsAssignable

func (t *InitType) IsAssignable(o px.Type, g px.Guard) bool

IsAssignable answers the question if a value of the given type can be used when instantiating an instance of the contained type

func (*InitType) IsInstance

func (t *InitType) IsInstance(o px.Value, g px.Guard) bool

IsInstance answers the question if the given value can be used when instantiating an instance of the contained type

func (*InitType) MetaType

func (t *InitType) MetaType() px.ObjectType

func (*InitType) Name

func (t *InitType) Name() string

func (*InitType) New

func (t *InitType) New(c px.Context, args []px.Value) px.Value

func (*InitType) PType

func (t *InitType) PType() px.Type

func (*InitType) Parameters

func (t *InitType) Parameters() []px.Value

func (*InitType) Resolve

func (t *InitType) Resolve(c px.Context) px.Type

func (*InitType) SerializationString

func (t *InitType) SerializationString() string

func (*InitType) String

func (t *InitType) String() string

func (*InitType) ToString

func (t *InitType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*InitType) Type

func (t *InitType) Type() px.Type

type IntegerType

type IntegerType struct {
	// contains filtered or unexported fields
}

func DefaultIntegerType

func DefaultIntegerType() *IntegerType

func NewIntegerType

func NewIntegerType(min int64, max int64) *IntegerType

func PositiveIntegerType

func PositiveIntegerType() *IntegerType

func (*IntegerType) Accept

func (t *IntegerType) Accept(v px.Visitor, g px.Guard)

func (*IntegerType) CanSerializeAsString

func (t *IntegerType) CanSerializeAsString() bool

func (*IntegerType) Default

func (t *IntegerType) Default() px.Type

func (*IntegerType) Equals

func (t *IntegerType) Equals(o interface{}, g px.Guard) bool

func (*IntegerType) Generic

func (t *IntegerType) Generic() px.Type

func (*IntegerType) Get

func (t *IntegerType) Get(key string) (px.Value, bool)

func (*IntegerType) IsAssignable

func (t *IntegerType) IsAssignable(o px.Type, g px.Guard) bool

func (*IntegerType) IsInstance

func (t *IntegerType) IsInstance(o px.Value, g px.Guard) bool

func (*IntegerType) IsInstance2

func (t *IntegerType) IsInstance2(n int64) bool

func (*IntegerType) IsInstance3

func (t *IntegerType) IsInstance3(n int) bool

func (*IntegerType) IsUnbounded

func (t *IntegerType) IsUnbounded() bool

func (*IntegerType) Max

func (t *IntegerType) Max() int64

func (*IntegerType) MetaType

func (t *IntegerType) MetaType() px.ObjectType

func (*IntegerType) Min

func (t *IntegerType) Min() int64

func (*IntegerType) Name

func (t *IntegerType) Name() string

func (*IntegerType) PType

func (t *IntegerType) PType() px.Type

func (*IntegerType) Parameters

func (t *IntegerType) Parameters() []px.Value

func (*IntegerType) ReflectType

func (t *IntegerType) ReflectType(c px.Context) (reflect.Type, bool)

func (*IntegerType) SerializationString

func (t *IntegerType) SerializationString() string

func (*IntegerType) SizeParameters

func (t *IntegerType) SizeParameters() []px.Value

func (*IntegerType) String

func (t *IntegerType) String() string

func (*IntegerType) ToString

func (t *IntegerType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type IterableType

type IterableType struct {
	// contains filtered or unexported fields
}

func DefaultIterableType

func DefaultIterableType() *IterableType

func NewIterableType

func NewIterableType(elementType px.Type) *IterableType

func (*IterableType) Accept

func (t *IterableType) Accept(v px.Visitor, g px.Guard)

func (*IterableType) CanSerializeAsString

func (t *IterableType) CanSerializeAsString() bool

func (*IterableType) Default

func (t *IterableType) Default() px.Type

func (*IterableType) ElementType

func (t *IterableType) ElementType() px.Type

func (*IterableType) Equals

func (t *IterableType) Equals(o interface{}, g px.Guard) bool

func (*IterableType) Generic

func (t *IterableType) Generic() px.Type

func (*IterableType) Get

func (t *IterableType) Get(key string) (value px.Value, ok bool)

func (*IterableType) IsAssignable

func (t *IterableType) IsAssignable(o px.Type, g px.Guard) bool

func (*IterableType) IsInstance

func (t *IterableType) IsInstance(o px.Value, g px.Guard) bool

func (*IterableType) MetaType

func (t *IterableType) MetaType() px.ObjectType

func (*IterableType) Name

func (t *IterableType) Name() string

func (*IterableType) PType

func (t *IterableType) PType() px.Type

func (*IterableType) Parameters

func (t *IterableType) Parameters() []px.Value

func (*IterableType) Resolve

func (t *IterableType) Resolve(c px.Context) px.Type

func (*IterableType) SerializationString

func (t *IterableType) SerializationString() string

func (*IterableType) String

func (t *IterableType) String() string

func (*IterableType) ToString

func (t *IterableType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type IteratorType

type IteratorType struct {
	// contains filtered or unexported fields
}

func DefaultIteratorType

func DefaultIteratorType() *IteratorType

func NewIteratorType

func NewIteratorType(elementType px.Type) *IteratorType

func (*IteratorType) Accept

func (t *IteratorType) Accept(v px.Visitor, g px.Guard)

func (*IteratorType) CanSerializeAsString

func (t *IteratorType) CanSerializeAsString() bool

func (*IteratorType) Default

func (t *IteratorType) Default() px.Type

func (*IteratorType) ElementType

func (t *IteratorType) ElementType() px.Type

func (*IteratorType) Equals

func (t *IteratorType) Equals(o interface{}, g px.Guard) bool

func (*IteratorType) Generic

func (t *IteratorType) Generic() px.Type

func (*IteratorType) Get

func (t *IteratorType) Get(key string) (value px.Value, ok bool)

func (*IteratorType) IsAssignable

func (t *IteratorType) IsAssignable(o px.Type, g px.Guard) bool

func (*IteratorType) IsInstance

func (t *IteratorType) IsInstance(o px.Value, g px.Guard) bool

func (*IteratorType) MetaType

func (t *IteratorType) MetaType() px.ObjectType

func (*IteratorType) Name

func (t *IteratorType) Name() string

func (*IteratorType) PType

func (t *IteratorType) PType() px.Type

func (*IteratorType) Parameters

func (t *IteratorType) Parameters() []px.Value

func (*IteratorType) Resolve

func (t *IteratorType) Resolve(c px.Context) px.Type

func (*IteratorType) SerializationString

func (t *IteratorType) SerializationString() string

func (*IteratorType) String

func (t *IteratorType) String() string

func (*IteratorType) ToString

func (t *IteratorType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type LazyType

type LazyType interface {
	LazyIsInstance(v px.Value, g px.Guard) int
}

type LikeType

type LikeType struct {
	// contains filtered or unexported fields
}

func DefaultLikeType

func DefaultLikeType() *LikeType

func NewLikeType

func NewLikeType(baseType px.Type, navigation string) *LikeType

func (*LikeType) Accept

func (t *LikeType) Accept(v px.Visitor, g px.Guard)

func (*LikeType) Default

func (t *LikeType) Default() px.Type

func (*LikeType) Equals

func (t *LikeType) Equals(o interface{}, g px.Guard) bool

func (*LikeType) Get

func (t *LikeType) Get(key string) (px.Value, bool)

func (*LikeType) IsAssignable

func (t *LikeType) IsAssignable(o px.Type, g px.Guard) bool

func (*LikeType) IsInstance

func (t *LikeType) IsInstance(o px.Value, g px.Guard) bool

func (*LikeType) MetaType

func (t *LikeType) MetaType() px.ObjectType

func (*LikeType) Name

func (t *LikeType) Name() string

func (*LikeType) PType

func (t *LikeType) PType() px.Type

func (*LikeType) Parameters

func (t *LikeType) Parameters() []px.Value

func (*LikeType) Resolve

func (t *LikeType) Resolve(c px.Context) px.Type

func (*LikeType) String

func (t *LikeType) String() string

func (*LikeType) ToString

func (t *LikeType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Mapping

type Mapping struct {
	T px.Type
	R reflect.Type
}

func PopDeclaredMappings

func PopDeclaredMappings() (types []Mapping)

type MutableHashValue

type MutableHashValue struct {
	Hash
}

func NewMutableHash

func NewMutableHash() *MutableHashValue

func (*MutableHashValue) Put

func (hv *MutableHashValue) Put(key, value px.Value)

Put adds or replaces the given key/value association in this hash

func (*MutableHashValue) PutAll

func (hv *MutableHashValue) PutAll(o px.OrderedMap)

PutAll merges the given hash into this hash (mutates the hash). The method is not thread safe

type NotUndefType

type NotUndefType struct {
	// contains filtered or unexported fields
}

func DefaultNotUndefType

func DefaultNotUndefType() *NotUndefType

func NewNotUndefType

func NewNotUndefType(containedType px.Type) *NotUndefType

func (*NotUndefType) Accept

func (t *NotUndefType) Accept(v px.Visitor, g px.Guard)

func (*NotUndefType) CanSerializeAsString

func (t *NotUndefType) CanSerializeAsString() bool

func (*NotUndefType) ContainedType

func (t *NotUndefType) ContainedType() px.Type

func (*NotUndefType) Default

func (t *NotUndefType) Default() px.Type

func (*NotUndefType) Equals

func (t *NotUndefType) Equals(o interface{}, g px.Guard) bool

func (*NotUndefType) Generic

func (t *NotUndefType) Generic() px.Type

func (*NotUndefType) Get

func (t *NotUndefType) Get(key string) (value px.Value, ok bool)

func (*NotUndefType) IsAssignable

func (t *NotUndefType) IsAssignable(o px.Type, g px.Guard) bool

func (*NotUndefType) IsInstance

func (t *NotUndefType) IsInstance(o px.Value, g px.Guard) bool

func (*NotUndefType) MetaType

func (t *NotUndefType) MetaType() px.ObjectType

func (*NotUndefType) Name

func (t *NotUndefType) Name() string

func (*NotUndefType) PType

func (t *NotUndefType) PType() px.Type

func (*NotUndefType) Parameters

func (t *NotUndefType) Parameters() []px.Value

func (*NotUndefType) ReflectType

func (t *NotUndefType) ReflectType(c px.Context) (reflect.Type, bool)

func (*NotUndefType) Resolve

func (t *NotUndefType) Resolve(c px.Context) px.Type

func (*NotUndefType) SerializationString

func (t *NotUndefType) SerializationString() string

func (*NotUndefType) String

func (t *NotUndefType) String() string

func (*NotUndefType) ToString

func (t *NotUndefType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type NumericType

type NumericType struct{}

func DefaultNumericType

func DefaultNumericType() *NumericType

func (*NumericType) Accept

func (t *NumericType) Accept(v px.Visitor, g px.Guard)

func (*NumericType) CanSerializeAsString

func (t *NumericType) CanSerializeAsString() bool

func (*NumericType) Equals

func (t *NumericType) Equals(o interface{}, g px.Guard) bool

func (*NumericType) IsAssignable

func (t *NumericType) IsAssignable(o px.Type, g px.Guard) bool

func (*NumericType) IsInstance

func (t *NumericType) IsInstance(o px.Value, g px.Guard) bool

func (*NumericType) MetaType

func (t *NumericType) MetaType() px.ObjectType

func (*NumericType) Name

func (t *NumericType) Name() string

func (*NumericType) PType

func (t *NumericType) PType() px.Type

func (*NumericType) ReflectType

func (t *NumericType) ReflectType(c px.Context) (reflect.Type, bool)

func (*NumericType) SerializationString

func (t *NumericType) SerializationString() string

func (*NumericType) String

func (t *NumericType) String() string

func (*NumericType) ToString

func (t *NumericType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type OptionalType

type OptionalType struct {
	// contains filtered or unexported fields
}

func DefaultOptionalType

func DefaultOptionalType() *OptionalType

func NewOptionalType

func NewOptionalType(containedType px.Type) *OptionalType

func (*OptionalType) Accept

func (t *OptionalType) Accept(v px.Visitor, g px.Guard)

func (*OptionalType) CanSerializeAsString

func (t *OptionalType) CanSerializeAsString() bool

func (*OptionalType) ContainedType

func (t *OptionalType) ContainedType() px.Type

func (*OptionalType) Default

func (t *OptionalType) Default() px.Type

func (*OptionalType) Equals

func (t *OptionalType) Equals(o interface{}, g px.Guard) bool

func (*OptionalType) Generic

func (t *OptionalType) Generic() px.Type

func (*OptionalType) Get

func (t *OptionalType) Get(key string) (value px.Value, ok bool)

func (*OptionalType) IsAssignable

func (t *OptionalType) IsAssignable(o px.Type, g px.Guard) bool

func (*OptionalType) IsInstance

func (t *OptionalType) IsInstance(o px.Value, g px.Guard) bool

func (*OptionalType) MetaType

func (t *OptionalType) MetaType() px.ObjectType

func (*OptionalType) Name

func (t *OptionalType) Name() string

func (*OptionalType) PType

func (t *OptionalType) PType() px.Type

func (*OptionalType) Parameters

func (t *OptionalType) Parameters() []px.Value

func (*OptionalType) ReflectType

func (t *OptionalType) ReflectType(c px.Context) (reflect.Type, bool)

func (*OptionalType) Resolve

func (t *OptionalType) Resolve(c px.Context) px.Type

func (*OptionalType) SerializationString

func (t *OptionalType) SerializationString() string

func (*OptionalType) String

func (t *OptionalType) String() string

func (*OptionalType) ToString

func (t *OptionalType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type PatternType

type PatternType struct {
	// contains filtered or unexported fields
}

func DefaultPatternType

func DefaultPatternType() *PatternType

func NewPatternType

func NewPatternType(regexps []*RegexpType) *PatternType

func (*PatternType) Accept

func (t *PatternType) Accept(v px.Visitor, g px.Guard)

func (*PatternType) CanSerializeAsString

func (t *PatternType) CanSerializeAsString() bool

func (*PatternType) Default

func (t *PatternType) Default() px.Type

func (*PatternType) Equals

func (t *PatternType) Equals(o interface{}, g px.Guard) bool

func (*PatternType) Get

func (t *PatternType) Get(key string) (value px.Value, ok bool)

func (*PatternType) IsAssignable

func (t *PatternType) IsAssignable(o px.Type, g px.Guard) bool

func (*PatternType) IsInstance

func (t *PatternType) IsInstance(o px.Value, g px.Guard) bool

func (*PatternType) MetaType

func (t *PatternType) MetaType() px.ObjectType

func (*PatternType) Name

func (t *PatternType) Name() string

func (*PatternType) PType

func (t *PatternType) PType() px.Type

func (*PatternType) Parameters

func (t *PatternType) Parameters() []px.Value

func (*PatternType) Patterns

func (t *PatternType) Patterns() *Array

func (*PatternType) ReflectType

func (t *PatternType) ReflectType(c px.Context) (reflect.Type, bool)

func (*PatternType) SerializationString

func (t *PatternType) SerializationString() string

func (*PatternType) String

func (t *PatternType) String() string

func (*PatternType) ToString

func (t *PatternType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Regexp

type Regexp RegexpType

Regexp represents RegexpType as a value

func WrapRegexp

func WrapRegexp(str string) *Regexp

func WrapRegexp2

func WrapRegexp2(pattern *regexp.Regexp) *Regexp

func (*Regexp) Equals

func (r *Regexp) Equals(o interface{}, g px.Guard) bool

func (*Regexp) Match

func (r *Regexp) Match(s string) []string

func (*Regexp) PType

func (r *Regexp) PType() px.Type

func (*Regexp) PatternString

func (r *Regexp) PatternString() string

func (*Regexp) Reflect

func (r *Regexp) Reflect(c px.Context) reflect.Value

func (*Regexp) ReflectTo

func (r *Regexp) ReflectTo(c px.Context, dest reflect.Value)

func (*Regexp) Regexp

func (r *Regexp) Regexp() *regexp.Regexp

func (*Regexp) String

func (r *Regexp) String() string

func (*Regexp) ToKey

func (r *Regexp) ToKey(b *bytes.Buffer)

func (*Regexp) ToString

func (r *Regexp) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type RegexpType

type RegexpType struct {
	// contains filtered or unexported fields
}

func DefaultRegexpType

func DefaultRegexpType() *RegexpType

func NewRegexpType

func NewRegexpType(patternString string) *RegexpType

func NewRegexpTypeR

func NewRegexpTypeR(pattern *regexp.Regexp) *RegexpType

func UniqueRegexps

func UniqueRegexps(regexpTypes []*RegexpType) []*RegexpType

func (*RegexpType) Accept

func (t *RegexpType) Accept(v px.Visitor, g px.Guard)

func (*RegexpType) CanSerializeAsString

func (t *RegexpType) CanSerializeAsString() bool

func (*RegexpType) Default

func (t *RegexpType) Default() px.Type

func (*RegexpType) Equals

func (t *RegexpType) Equals(o interface{}, g px.Guard) bool

func (*RegexpType) Get

func (t *RegexpType) Get(key string) (value px.Value, ok bool)

func (*RegexpType) IsAssignable

func (t *RegexpType) IsAssignable(o px.Type, g px.Guard) bool

func (*RegexpType) IsInstance

func (t *RegexpType) IsInstance(o px.Value, g px.Guard) bool

func (*RegexpType) MetaType

func (t *RegexpType) MetaType() px.ObjectType

func (*RegexpType) Name

func (t *RegexpType) Name() string

func (*RegexpType) PType

func (t *RegexpType) PType() px.Type

func (*RegexpType) Parameters

func (t *RegexpType) Parameters() []px.Value

func (*RegexpType) PatternString

func (t *RegexpType) PatternString() string

func (*RegexpType) ReflectType

func (t *RegexpType) ReflectType(c px.Context) (reflect.Type, bool)

func (*RegexpType) Regexp

func (t *RegexpType) Regexp() *regexp.Regexp

func (*RegexpType) SerializationString

func (t *RegexpType) SerializationString() string

func (*RegexpType) String

func (t *RegexpType) String() string

func (*RegexpType) ToString

func (t *RegexpType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type RuntimeType

type RuntimeType struct {
	// contains filtered or unexported fields
}

func DefaultRuntimeType

func DefaultRuntimeType() *RuntimeType

func NewGoRuntimeType

func NewGoRuntimeType(value interface{}) *RuntimeType

NewGoRuntimeType creates a Go runtime by extracting the element type of the given value.

A Go interface must be registered by passing a Pointer to a nil of the interface so to create an Runtime for the interface Foo, use NewGoRuntimeType((*Foo)(nil))

func NewRuntimeType

func NewRuntimeType(runtimeName string, name string, pattern *RegexpType) *RuntimeType

func (*RuntimeType) Accept

func (t *RuntimeType) Accept(v px.Visitor, g px.Guard)

func (*RuntimeType) CanSerializeAsString

func (t *RuntimeType) CanSerializeAsString() bool

func (*RuntimeType) Default

func (t *RuntimeType) Default() px.Type

func (*RuntimeType) Equals

func (t *RuntimeType) Equals(o interface{}, g px.Guard) bool

func (*RuntimeType) Generic

func (t *RuntimeType) Generic() px.Type

func (*RuntimeType) Get

func (t *RuntimeType) Get(key string) (px.Value, bool)

func (*RuntimeType) IsAssignable

func (t *RuntimeType) IsAssignable(o px.Type, g px.Guard) bool

func (*RuntimeType) IsInstance

func (t *RuntimeType) IsInstance(o px.Value, g px.Guard) bool

func (*RuntimeType) MetaType

func (t *RuntimeType) MetaType() px.ObjectType

func (*RuntimeType) Name

func (t *RuntimeType) Name() string

func (*RuntimeType) PType

func (t *RuntimeType) PType() px.Type

func (*RuntimeType) Parameters

func (t *RuntimeType) Parameters() []px.Value

func (*RuntimeType) ReflectType

func (t *RuntimeType) ReflectType(c px.Context) (reflect.Type, bool)

func (*RuntimeType) SerializationString

func (t *RuntimeType) SerializationString() string

func (*RuntimeType) String

func (t *RuntimeType) String() string

func (*RuntimeType) ToString

func (t *RuntimeType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type RuntimeValue

type RuntimeValue struct {
	// contains filtered or unexported fields
}

RuntimeValue Captures values of all types unknown to Puppet

func WrapRuntime

func WrapRuntime(value interface{}) *RuntimeValue

func (*RuntimeValue) Equals

func (rv *RuntimeValue) Equals(o interface{}, g px.Guard) bool

func (*RuntimeValue) Interface

func (rv *RuntimeValue) Interface() interface{}

func (*RuntimeValue) PType

func (rv *RuntimeValue) PType() px.Type

func (*RuntimeValue) Reflect

func (rv *RuntimeValue) Reflect(c px.Context) reflect.Value

func (*RuntimeValue) ReflectTo

func (rv *RuntimeValue) ReflectTo(c px.Context, dest reflect.Value)

func (*RuntimeValue) String

func (rv *RuntimeValue) String() string

func (*RuntimeValue) ToString

func (rv *RuntimeValue) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type ScalarDataType

type ScalarDataType struct{}

func DefaultScalarDataType

func DefaultScalarDataType() *ScalarDataType

func (*ScalarDataType) Accept

func (t *ScalarDataType) Accept(v px.Visitor, g px.Guard)

func (*ScalarDataType) CanSerializeAsString

func (t *ScalarDataType) CanSerializeAsString() bool

func (*ScalarDataType) Equals

func (t *ScalarDataType) Equals(o interface{}, g px.Guard) bool

func (*ScalarDataType) IsAssignable

func (t *ScalarDataType) IsAssignable(o px.Type, g px.Guard) bool

func (*ScalarDataType) IsInstance

func (t *ScalarDataType) IsInstance(o px.Value, g px.Guard) bool

func (*ScalarDataType) MetaType

func (t *ScalarDataType) MetaType() px.ObjectType

func (*ScalarDataType) Name

func (t *ScalarDataType) Name() string

func (*ScalarDataType) PType

func (t *ScalarDataType) PType() px.Type

func (*ScalarDataType) SerializationString

func (t *ScalarDataType) SerializationString() string

func (*ScalarDataType) String

func (t *ScalarDataType) String() string

func (*ScalarDataType) ToString

func (t *ScalarDataType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type ScalarType

type ScalarType struct{}

func DefaultScalarType

func DefaultScalarType() *ScalarType

func (*ScalarType) Accept

func (t *ScalarType) Accept(v px.Visitor, g px.Guard)

func (*ScalarType) CanSerializeAsString

func (t *ScalarType) CanSerializeAsString() bool

func (*ScalarType) Equals

func (t *ScalarType) Equals(o interface{}, g px.Guard) bool

func (*ScalarType) IsAssignable

func (t *ScalarType) IsAssignable(o px.Type, g px.Guard) bool

func (*ScalarType) IsInstance

func (t *ScalarType) IsInstance(o px.Value, g px.Guard) bool

func (*ScalarType) MetaType

func (t *ScalarType) MetaType() px.ObjectType

func (*ScalarType) Name

func (t *ScalarType) Name() string

func (*ScalarType) PType

func (t *ScalarType) PType() px.Type

func (*ScalarType) SerializationString

func (t *ScalarType) SerializationString() string

func (*ScalarType) String

func (t *ScalarType) String() string

func (*ScalarType) ToString

func (t *ScalarType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type SemVer

type SemVer SemVerType

func WrapSemVer

func WrapSemVer(val semver.Version) *SemVer

func (*SemVer) CanSerializeAsString

func (v *SemVer) CanSerializeAsString() bool

func (*SemVer) Equals

func (v *SemVer) Equals(o interface{}, g px.Guard) bool

func (*SemVer) PType

func (v *SemVer) PType() px.Type

func (*SemVer) Reflect

func (v *SemVer) Reflect(c px.Context) reflect.Value

func (*SemVer) ReflectTo

func (v *SemVer) ReflectTo(c px.Context, dest reflect.Value)

func (*SemVer) SerializationString

func (v *SemVer) SerializationString() string

func (*SemVer) String

func (v *SemVer) String() string

func (*SemVer) ToKey

func (v *SemVer) ToKey(b *bytes.Buffer)

func (*SemVer) ToString

func (v *SemVer) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*SemVer) Version

func (v *SemVer) Version() semver.Version

type SemVerRange

type SemVerRange struct {
	// contains filtered or unexported fields
}

func WrapSemVerRange

func WrapSemVerRange(val semver.VersionRange) *SemVerRange

func (*SemVerRange) CanSerializeAsString

func (bv *SemVerRange) CanSerializeAsString() bool

func (*SemVerRange) Equals

func (bv *SemVerRange) Equals(o interface{}, g px.Guard) bool

func (*SemVerRange) PType

func (bv *SemVerRange) PType() px.Type

func (*SemVerRange) Reflect

func (bv *SemVerRange) Reflect(c px.Context) reflect.Value

func (*SemVerRange) ReflectTo

func (bv *SemVerRange) ReflectTo(c px.Context, dest reflect.Value)

func (*SemVerRange) SerializationString

func (bv *SemVerRange) SerializationString() string

func (*SemVerRange) String

func (bv *SemVerRange) String() string

func (*SemVerRange) ToKey

func (bv *SemVerRange) ToKey(b *bytes.Buffer)

func (*SemVerRange) ToString

func (bv *SemVerRange) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*SemVerRange) VersionRange

func (bv *SemVerRange) VersionRange() semver.VersionRange

type SemVerRangeType

type SemVerRangeType struct{}

func DefaultSemVerRangeType

func DefaultSemVerRangeType() *SemVerRangeType

func (*SemVerRangeType) Accept

func (t *SemVerRangeType) Accept(v px.Visitor, g px.Guard)

func (*SemVerRangeType) CanSerializeAsString

func (t *SemVerRangeType) CanSerializeAsString() bool

func (*SemVerRangeType) Equals

func (t *SemVerRangeType) Equals(o interface{}, g px.Guard) bool

func (*SemVerRangeType) IsAssignable

func (t *SemVerRangeType) IsAssignable(o px.Type, g px.Guard) bool

func (*SemVerRangeType) IsInstance

func (t *SemVerRangeType) IsInstance(o px.Value, g px.Guard) bool

func (*SemVerRangeType) MetaType

func (t *SemVerRangeType) MetaType() px.ObjectType

func (*SemVerRangeType) Name

func (t *SemVerRangeType) Name() string

func (*SemVerRangeType) PType

func (t *SemVerRangeType) PType() px.Type

func (*SemVerRangeType) ReflectType

func (t *SemVerRangeType) ReflectType(c px.Context) (reflect.Type, bool)

func (*SemVerRangeType) SerializationString

func (t *SemVerRangeType) SerializationString() string

func (*SemVerRangeType) String

func (t *SemVerRangeType) String() string

func (*SemVerRangeType) ToString

func (t *SemVerRangeType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type SemVerType

type SemVerType struct {
	// contains filtered or unexported fields
}

func DefaultSemVerType

func DefaultSemVerType() *SemVerType

func NewSemVerType

func NewSemVerType(vr semver.VersionRange) *SemVerType

func (*SemVerType) Accept

func (t *SemVerType) Accept(v px.Visitor, g px.Guard)

func (*SemVerType) CanSerializeAsString

func (t *SemVerType) CanSerializeAsString() bool

func (*SemVerType) Default

func (t *SemVerType) Default() px.Type

func (*SemVerType) Equals

func (t *SemVerType) Equals(o interface{}, g px.Guard) bool

func (*SemVerType) Get

func (t *SemVerType) Get(key string) (px.Value, bool)

func (*SemVerType) IsAssignable

func (t *SemVerType) IsAssignable(o px.Type, g px.Guard) bool

func (*SemVerType) IsInstance

func (t *SemVerType) IsInstance(o px.Value, g px.Guard) bool

func (*SemVerType) MetaType

func (t *SemVerType) MetaType() px.ObjectType

func (*SemVerType) Name

func (t *SemVerType) Name() string

func (*SemVerType) PType

func (t *SemVerType) PType() px.Type

func (*SemVerType) Parameters

func (t *SemVerType) Parameters() []px.Value

func (*SemVerType) ReflectType

func (t *SemVerType) ReflectType(c px.Context) (reflect.Type, bool)

func (*SemVerType) SerializationString

func (t *SemVerType) SerializationString() string

func (*SemVerType) String

func (t *SemVerType) String() string

func (*SemVerType) ToString

func (t *SemVerType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Sensitive

type Sensitive struct {
	Value px.Value
}

func WrapSensitive

func WrapSensitive(val px.Value) *Sensitive

func (*Sensitive) Equals

func (s *Sensitive) Equals(o interface{}, g px.Guard) bool

func (*Sensitive) PType

func (s *Sensitive) PType() px.Type

func (*Sensitive) Reflect

func (s *Sensitive) Reflect(c px.Context) reflect.Value

func (*Sensitive) ReflectTo

func (s *Sensitive) ReflectTo(c px.Context, value reflect.Value)

func (*Sensitive) String

func (s *Sensitive) String() string

func (*Sensitive) ToString

func (s *Sensitive) ToString(b io.Writer, f px.FormatContext, g px.RDetect)

func (*Sensitive) Unwrap

func (s *Sensitive) Unwrap() px.Value

type SensitiveType

type SensitiveType struct {
	// contains filtered or unexported fields
}

func DefaultSensitiveType

func DefaultSensitiveType() *SensitiveType

func NewSensitiveType

func NewSensitiveType(containedType px.Type) *SensitiveType

func (*SensitiveType) Accept

func (t *SensitiveType) Accept(v px.Visitor, g px.Guard)

func (*SensitiveType) CanSerializeAsString

func (t *SensitiveType) CanSerializeAsString() bool

func (*SensitiveType) ContainedType

func (t *SensitiveType) ContainedType() px.Type

func (*SensitiveType) Default

func (t *SensitiveType) Default() px.Type

func (*SensitiveType) Equals

func (t *SensitiveType) Equals(o interface{}, g px.Guard) bool

func (*SensitiveType) Generic

func (t *SensitiveType) Generic() px.Type

func (*SensitiveType) IsAssignable

func (t *SensitiveType) IsAssignable(o px.Type, g px.Guard) bool

func (*SensitiveType) IsInstance

func (t *SensitiveType) IsInstance(o px.Value, g px.Guard) bool

func (*SensitiveType) MetaType

func (t *SensitiveType) MetaType() px.ObjectType

func (*SensitiveType) Name

func (t *SensitiveType) Name() string

func (*SensitiveType) PType

func (t *SensitiveType) PType() px.Type

func (*SensitiveType) Parameters

func (t *SensitiveType) Parameters() []px.Value

func (*SensitiveType) ReflectType

func (t *SensitiveType) ReflectType(c px.Context) (reflect.Type, bool)

func (*SensitiveType) Resolve

func (t *SensitiveType) Resolve(c px.Context) px.Type

func (*SensitiveType) SerializationString

func (t *SensitiveType) SerializationString() string

func (*SensitiveType) String

func (t *SensitiveType) String() string

func (*SensitiveType) ToString

func (t *SensitiveType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type StructElement

type StructElement struct {
	// contains filtered or unexported fields
}

func NewStructElement

func NewStructElement(key px.Value, value px.Type) *StructElement

func (*StructElement) Accept

func (s *StructElement) Accept(v px.Visitor, g px.Guard)

func (*StructElement) ActualKeyType

func (s *StructElement) ActualKeyType() px.Type

func (*StructElement) Equals

func (s *StructElement) Equals(o interface{}, g px.Guard) bool

func (*StructElement) Key

func (s *StructElement) Key() px.Type

func (*StructElement) Name

func (s *StructElement) Name() string

func (*StructElement) Optional

func (s *StructElement) Optional() bool

func (*StructElement) PType

func (s *StructElement) PType() px.Type

func (*StructElement) String

func (s *StructElement) String() string

func (*StructElement) ToString

func (s *StructElement) ToString(bld io.Writer, format px.FormatContext, g px.RDetect)

func (*StructElement) Value

func (s *StructElement) Value() px.Type

type StructType

type StructType struct {
	// contains filtered or unexported fields
}

func DefaultStructType

func DefaultStructType() *StructType

func NewStructType

func NewStructType(elements []*StructElement) *StructType

func (*StructType) Accept

func (t *StructType) Accept(v px.Visitor, g px.Guard)

func (*StructType) CanSerializeAsString

func (t *StructType) CanSerializeAsString() bool

func (*StructType) Default

func (t *StructType) Default() px.Type

func (*StructType) Elements

func (t *StructType) Elements() []*StructElement

func (*StructType) Equals

func (t *StructType) Equals(o interface{}, g px.Guard) bool

func (*StructType) Generic

func (t *StructType) Generic() px.Type

func (*StructType) Get

func (t *StructType) Get(key string) (value px.Value, ok bool)

func (*StructType) HashedMembers

func (t *StructType) HashedMembers() map[string]*StructElement

func (*StructType) HashedMembersCloned

func (t *StructType) HashedMembersCloned() map[string]*StructElement

func (*StructType) IsAssignable

func (t *StructType) IsAssignable(o px.Type, g px.Guard) bool

func (*StructType) IsInstance

func (t *StructType) IsInstance(o px.Value, g px.Guard) bool

func (*StructType) MetaType

func (t *StructType) MetaType() px.ObjectType

func (*StructType) Name

func (t *StructType) Name() string

func (*StructType) PType

func (t *StructType) PType() px.Type

func (*StructType) Parameters

func (t *StructType) Parameters() []px.Value

func (*StructType) Resolve

func (t *StructType) Resolve(c px.Context) px.Type

func (*StructType) SerializationString

func (t *StructType) SerializationString() string

func (*StructType) Size

func (t *StructType) Size() *IntegerType

func (*StructType) String

func (t *StructType) String() string

func (*StructType) ToString

func (t *StructType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Timespan

type Timespan time.Duration

Timespan represents time.Duration as an pcore.Value

func ParseTimespan

func ParseTimespan(str string, formats []*TimespanFormat) Timespan

func WrapTimespan

func WrapTimespan(val time.Duration) Timespan

func (Timespan) Abs

func (tv Timespan) Abs() px.Number

func (Timespan) CanSerializeAsString

func (tv Timespan) CanSerializeAsString() bool

func (Timespan) Days

func (tv Timespan) Days() int64

Hours returns a positive integer denoting the number of days

func (Timespan) Duration

func (tv Timespan) Duration() time.Duration

func (Timespan) Equals

func (tv Timespan) Equals(o interface{}, g px.Guard) bool

func (Timespan) Float

func (tv Timespan) Float() float64

Float returns the number of seconds with fraction

func (Timespan) Format

func (tv Timespan) Format(format string) string

func (Timespan) Hours

func (tv Timespan) Hours() int64

Hours returns a positive integer, 0 - 23 denoting hours of day

func (Timespan) Int

func (tv Timespan) Int() int64

Int returns the total number of seconds

func (Timespan) Milliseconds

func (tv Timespan) Milliseconds() int64

Seconds returns a positive integer, 0 - 999 denoting milliseconds of second

func (Timespan) Minutes

func (tv Timespan) Minutes() int64

Minutes returns a positive integer, 0 - 59 denoting minutes of hour

func (Timespan) PType

func (tv Timespan) PType() px.Type

func (Timespan) Reflect

func (tv Timespan) Reflect(c px.Context) reflect.Value

func (Timespan) ReflectTo

func (tv Timespan) ReflectTo(c px.Context, dest reflect.Value)

func (Timespan) Seconds

func (tv Timespan) Seconds() int64

Seconds returns a positive integer, 0 - 59 denoting seconds of minute

func (Timespan) SerializationString

func (tv Timespan) SerializationString() string

func (Timespan) String

func (tv Timespan) String() string

func (Timespan) ToKey

func (tv Timespan) ToKey(b *bytes.Buffer)

func (Timespan) ToString

func (tv Timespan) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type TimespanFormat

type TimespanFormat struct {
	// contains filtered or unexported fields
}

type TimespanFormatParser

type TimespanFormatParser struct {
	// contains filtered or unexported fields
}
var DefaultTimespanFormatParser *TimespanFormatParser

func NewTimespanFormatParser

func NewTimespanFormatParser() *TimespanFormatParser

func (*TimespanFormatParser) ParseFormat

func (p *TimespanFormatParser) ParseFormat(format string) *TimespanFormat

type TimespanType

type TimespanType struct {
	// contains filtered or unexported fields
}

func DefaultTimespanType

func DefaultTimespanType() *TimespanType

func NewTimespanType

func NewTimespanType(min time.Duration, max time.Duration) *TimespanType

func (*TimespanType) Accept

func (t *TimespanType) Accept(v px.Visitor, g px.Guard)

func (*TimespanType) CanSerializeAsString

func (t *TimespanType) CanSerializeAsString() bool

func (*TimespanType) Default

func (t *TimespanType) Default() px.Type

func (*TimespanType) Equals

func (t *TimespanType) Equals(other interface{}, guard px.Guard) bool

func (*TimespanType) Get

func (t *TimespanType) Get(key string) (px.Value, bool)

func (*TimespanType) IsAssignable

func (t *TimespanType) IsAssignable(o px.Type, g px.Guard) bool

func (*TimespanType) IsInstance

func (t *TimespanType) IsInstance(o px.Value, g px.Guard) bool

func (*TimespanType) MetaType

func (t *TimespanType) MetaType() px.ObjectType

func (*TimespanType) Name

func (t *TimespanType) Name() string

func (*TimespanType) PType

func (t *TimespanType) PType() px.Type

func (*TimespanType) Parameters

func (t *TimespanType) Parameters() []px.Value

func (*TimespanType) ReflectType

func (t *TimespanType) ReflectType(c px.Context) (reflect.Type, bool)

func (*TimespanType) SerializationString

func (t *TimespanType) SerializationString() string

func (*TimespanType) String

func (t *TimespanType) String() string

func (*TimespanType) ToString

func (t *TimespanType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type Timestamp

type Timestamp time.Time

Timestamp represents TimestampType as a value

func ParseTimestamp

func ParseTimestamp(str string, formats []*TimestampFormat, tz string) *Timestamp

func WrapTimestamp

func WrapTimestamp(time time.Time) *Timestamp

func (*Timestamp) CanSerializeAsString

func (tv *Timestamp) CanSerializeAsString() bool

func (*Timestamp) Equals

func (tv *Timestamp) Equals(o interface{}, g px.Guard) bool

func (*Timestamp) Float

func (tv *Timestamp) Float() float64

func (*Timestamp) Format

func (tv *Timestamp) Format(format string) string

func (*Timestamp) Format2

func (tv *Timestamp) Format2(format, tz string) string

func (*Timestamp) Int

func (tv *Timestamp) Int() int64

func (*Timestamp) PType

func (tv *Timestamp) PType() px.Type

func (*Timestamp) Reflect

func (tv *Timestamp) Reflect(c px.Context) reflect.Value

func (*Timestamp) ReflectTo

func (tv *Timestamp) ReflectTo(c px.Context, dest reflect.Value)

func (*Timestamp) SerializationString

func (tv *Timestamp) SerializationString() string

func (*Timestamp) String

func (tv *Timestamp) String() string

func (*Timestamp) Time

func (tv *Timestamp) Time() time.Time

func (*Timestamp) ToKey

func (tv *Timestamp) ToKey(b *bytes.Buffer)

func (*Timestamp) ToString

func (tv *Timestamp) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type TimestampFormat

type TimestampFormat struct {
	// contains filtered or unexported fields
}

func (*TimestampFormat) Format

func (f *TimestampFormat) Format(t *Timestamp) string

func (*TimestampFormat) Format2

func (f *TimestampFormat) Format2(t *Timestamp, tz string) string

type TimestampFormatParser

type TimestampFormatParser struct {
	// contains filtered or unexported fields
}
var DefaultTimestampFormatParser *TimestampFormatParser

func NewTimestampFormatParser

func NewTimestampFormatParser() *TimestampFormatParser

func (*TimestampFormatParser) ParseFormat

func (p *TimestampFormatParser) ParseFormat(format string) *TimestampFormat

type TimestampType

type TimestampType struct {
	// contains filtered or unexported fields
}

func DefaultTimestampType

func DefaultTimestampType() *TimestampType

func NewTimestampType

func NewTimestampType(min time.Time, max time.Time) *TimestampType

func (*TimestampType) Accept

func (t *TimestampType) Accept(v px.Visitor, g px.Guard)

func (*TimestampType) CanSerializeAsString

func (t *TimestampType) CanSerializeAsString() bool

func (*TimestampType) Default

func (t *TimestampType) Default() px.Type

func (*TimestampType) Equals

func (t *TimestampType) Equals(other interface{}, guard px.Guard) bool

func (*TimestampType) Get

func (t *TimestampType) Get(key string) (px.Value, bool)

func (*TimestampType) IsAssignable

func (t *TimestampType) IsAssignable(o px.Type, g px.Guard) bool

func (*TimestampType) IsInstance

func (t *TimestampType) IsInstance(o px.Value, g px.Guard) bool

func (*TimestampType) MetaType

func (t *TimestampType) MetaType() px.ObjectType

func (*TimestampType) Name

func (t *TimestampType) Name() string

func (*TimestampType) PType

func (t *TimestampType) PType() px.Type

func (*TimestampType) Parameters

func (t *TimestampType) Parameters() []px.Value

func (*TimestampType) ReflectType

func (t *TimestampType) ReflectType(c px.Context) (reflect.Type, bool)

func (*TimestampType) SerializationString

func (t *TimestampType) SerializationString() string

func (*TimestampType) String

func (t *TimestampType) String() string

func (*TimestampType) ToString

func (t *TimestampType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type TupleType

type TupleType struct {
	// contains filtered or unexported fields
}

func DefaultTupleType

func DefaultTupleType() *TupleType

func EmptyTupleType

func EmptyTupleType() *TupleType

func NewTupleType

func NewTupleType(types []px.Type, size *IntegerType) *TupleType
Example
package main

import (
	"fmt"

	"github.com/lyraproj/pcore/px"
	"github.com/lyraproj/pcore/types"
)

func main() {
	tuple := types.NewTupleType([]px.Type{types.DefaultStringType(), types.DefaultIntegerType()}, nil)
	fmt.Println(tuple)
}
Output:

Tuple[String, Integer]

func (*TupleType) Accept

func (t *TupleType) Accept(v px.Visitor, g px.Guard)

func (*TupleType) At

func (t *TupleType) At(i int) px.Value

func (*TupleType) CanSerializeAsString

func (t *TupleType) CanSerializeAsString() bool

func (*TupleType) CommonElementType

func (t *TupleType) CommonElementType() px.Type

func (*TupleType) Default

func (t *TupleType) Default() px.Type

func (*TupleType) Equals

func (t *TupleType) Equals(o interface{}, g px.Guard) bool

func (*TupleType) Generic

func (t *TupleType) Generic() px.Type

func (*TupleType) Get

func (t *TupleType) Get(key string) (value px.Value, ok bool)

func (*TupleType) IsAssignable

func (t *TupleType) IsAssignable(o px.Type, g px.Guard) bool

func (*TupleType) IsInstance

func (t *TupleType) IsInstance(v px.Value, g px.Guard) bool

func (*TupleType) IsInstance2

func (t *TupleType) IsInstance2(vs px.List, g px.Guard) bool

func (*TupleType) IsInstance3

func (t *TupleType) IsInstance3(vs []px.Value, g px.Guard) bool

func (*TupleType) MetaType

func (t *TupleType) MetaType() px.ObjectType

func (*TupleType) Name

func (t *TupleType) Name() string

func (*TupleType) PType

func (t *TupleType) PType() px.Type

func (*TupleType) Parameters

func (t *TupleType) Parameters() []px.Value

func (*TupleType) Resolve

func (t *TupleType) Resolve(c px.Context) px.Type

func (*TupleType) SerializationString

func (t *TupleType) SerializationString() string

func (*TupleType) Size

func (t *TupleType) Size() *IntegerType

func (*TupleType) String

func (t *TupleType) String() string

func (*TupleType) ToString

func (t *TupleType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*TupleType) Types

func (t *TupleType) Types() []px.Type

type TypeAliasType

type TypeAliasType struct {
	// contains filtered or unexported fields
}

func DefaultDataType

func DefaultDataType() *TypeAliasType

func DefaultRichDataType

func DefaultRichDataType() *TypeAliasType

func DefaultTypeAliasType

func DefaultTypeAliasType() *TypeAliasType

func NewTypeAliasType

func NewTypeAliasType(name string, typeExpression *DeferredType, resolvedType px.Type) *TypeAliasType

NewTypeAliasType creates a new TypeAliasType from a name and a typeExpression which must either be a *DeferredType, a parser.Expression, or nil. If it is nil, the resolved Type must be given.

func (*TypeAliasType) Accept

func (t *TypeAliasType) Accept(v px.Visitor, g px.Guard)

func (*TypeAliasType) Default

func (t *TypeAliasType) Default() px.Type

func (*TypeAliasType) Equals

func (t *TypeAliasType) Equals(o interface{}, g px.Guard) bool

func (*TypeAliasType) Get

func (t *TypeAliasType) Get(key string) (px.Value, bool)

func (*TypeAliasType) IsAssignable

func (t *TypeAliasType) IsAssignable(o px.Type, g px.Guard) bool

func (*TypeAliasType) IsInstance

func (t *TypeAliasType) IsInstance(o px.Value, g px.Guard) bool

func (*TypeAliasType) Loader

func (t *TypeAliasType) Loader() px.Loader

func (*TypeAliasType) MetaType

func (t *TypeAliasType) MetaType() px.ObjectType

func (*TypeAliasType) Name

func (t *TypeAliasType) Name() string

func (*TypeAliasType) PType

func (t *TypeAliasType) PType() px.Type

func (*TypeAliasType) Resolve

func (t *TypeAliasType) Resolve(c px.Context) px.Type

func (*TypeAliasType) ResolvedType

func (t *TypeAliasType) ResolvedType() px.Type

func (*TypeAliasType) String

func (t *TypeAliasType) String() string

func (*TypeAliasType) ToString

func (t *TypeAliasType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type TypeReferenceType

type TypeReferenceType struct {
	// contains filtered or unexported fields
}

func DefaultTypeReferenceType

func DefaultTypeReferenceType() *TypeReferenceType

func NewTypeReferenceType

func NewTypeReferenceType(typeString string) *TypeReferenceType

func (*TypeReferenceType) Accept

func (t *TypeReferenceType) Accept(v px.Visitor, g px.Guard)

func (*TypeReferenceType) CanSerializeAsString

func (t *TypeReferenceType) CanSerializeAsString() bool

func (*TypeReferenceType) Default

func (t *TypeReferenceType) Default() px.Type

func (*TypeReferenceType) Equals

func (t *TypeReferenceType) Equals(o interface{}, g px.Guard) bool

func (*TypeReferenceType) Get

func (t *TypeReferenceType) Get(key string) (px.Value, bool)

func (*TypeReferenceType) IsAssignable

func (t *TypeReferenceType) IsAssignable(o px.Type, g px.Guard) bool

func (*TypeReferenceType) IsInstance

func (t *TypeReferenceType) IsInstance(o px.Value, g px.Guard) bool

func (*TypeReferenceType) MetaType

func (t *TypeReferenceType) MetaType() px.ObjectType

func (*TypeReferenceType) Name

func (t *TypeReferenceType) Name() string

func (*TypeReferenceType) PType

func (t *TypeReferenceType) PType() px.Type

func (*TypeReferenceType) Parameters

func (t *TypeReferenceType) Parameters() []px.Value

func (*TypeReferenceType) Resolve

func (t *TypeReferenceType) Resolve(c px.Context) px.Type

func (*TypeReferenceType) SerializationString

func (t *TypeReferenceType) SerializationString() string

func (*TypeReferenceType) String

func (t *TypeReferenceType) String() string

func (*TypeReferenceType) ToString

func (t *TypeReferenceType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*TypeReferenceType) TypeString

func (t *TypeReferenceType) TypeString() string

type TypeType

type TypeType struct {
	// contains filtered or unexported fields
}

func DefaultTypeType

func DefaultTypeType() *TypeType

func NewTypeType

func NewTypeType(containedType px.Type) *TypeType

func (*TypeType) Accept

func (t *TypeType) Accept(v px.Visitor, g px.Guard)

func (*TypeType) CanSerializeAsString

func (t *TypeType) CanSerializeAsString() bool

func (*TypeType) ContainedType

func (t *TypeType) ContainedType() px.Type

func (*TypeType) Default

func (t *TypeType) Default() px.Type

func (*TypeType) Equals

func (t *TypeType) Equals(o interface{}, g px.Guard) bool

func (*TypeType) Generic

func (t *TypeType) Generic() px.Type

func (*TypeType) Get

func (t *TypeType) Get(key string) (value px.Value, ok bool)

func (*TypeType) IsAssignable

func (t *TypeType) IsAssignable(o px.Type, g px.Guard) bool

func (*TypeType) IsInstance

func (t *TypeType) IsInstance(o px.Value, g px.Guard) bool

func (*TypeType) MetaType

func (t *TypeType) MetaType() px.ObjectType

func (*TypeType) Name

func (t *TypeType) Name() string

func (*TypeType) PType

func (t *TypeType) PType() px.Type

func (*TypeType) Parameters

func (t *TypeType) Parameters() []px.Value

func (*TypeType) Resolve

func (t *TypeType) Resolve(c px.Context) px.Type

func (*TypeType) SerializationString

func (t *TypeType) SerializationString() string

func (*TypeType) String

func (t *TypeType) String() string

func (*TypeType) ToString

func (t *TypeType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type UndefType

type UndefType struct{}

func DefaultUndefType

func DefaultUndefType() *UndefType

func (*UndefType) Accept

func (t *UndefType) Accept(v px.Visitor, g px.Guard)

func (*UndefType) CanSerializeAsString

func (t *UndefType) CanSerializeAsString() bool

func (*UndefType) Equals

func (t *UndefType) Equals(o interface{}, g px.Guard) bool

func (*UndefType) IsAssignable

func (t *UndefType) IsAssignable(o px.Type, g px.Guard) bool

func (*UndefType) IsInstance

func (t *UndefType) IsInstance(o px.Value, g px.Guard) bool

func (*UndefType) MetaType

func (t *UndefType) MetaType() px.ObjectType

func (*UndefType) Name

func (t *UndefType) Name() string

func (*UndefType) PType

func (t *UndefType) PType() px.Type

func (*UndefType) SerializationString

func (t *UndefType) SerializationString() string

func (*UndefType) String

func (t *UndefType) String() string

func (*UndefType) ToString

func (t *UndefType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type UndefValue

type UndefValue struct{}

UndefValue is an empty struct because both type and value are known

func WrapUndef

func WrapUndef() *UndefValue

func (*UndefValue) Equals

func (uv *UndefValue) Equals(o interface{}, g px.Guard) bool

func (*UndefValue) MarshalJSON

func (uv *UndefValue) MarshalJSON() ([]byte, error)

func (*UndefValue) MarshalYAML

func (uv *UndefValue) MarshalYAML() (interface{}, error)

func (*UndefValue) PType

func (uv *UndefValue) PType() px.Type

func (*UndefValue) Reflect

func (uv *UndefValue) Reflect(c px.Context) reflect.Value

func (*UndefValue) ReflectTo

func (uv *UndefValue) ReflectTo(c px.Context, value reflect.Value)

func (*UndefValue) String

func (uv *UndefValue) String() string

func (*UndefValue) ToKey

func (uv *UndefValue) ToKey() px.HashKey

func (*UndefValue) ToString

func (uv *UndefValue) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type UnitType

type UnitType struct{}

func DefaultUnitType

func DefaultUnitType() *UnitType

func (*UnitType) Accept

func (t *UnitType) Accept(v px.Visitor, g px.Guard)

func (*UnitType) CanSerializeAsString

func (t *UnitType) CanSerializeAsString() bool

func (*UnitType) Equals

func (t *UnitType) Equals(o interface{}, g px.Guard) bool

func (*UnitType) IsAssignable

func (t *UnitType) IsAssignable(o px.Type, g px.Guard) bool

func (*UnitType) IsInstance

func (t *UnitType) IsInstance(o px.Value, g px.Guard) bool

func (*UnitType) MetaType

func (t *UnitType) MetaType() px.ObjectType

func (*UnitType) Name

func (t *UnitType) Name() string

func (*UnitType) PType

func (t *UnitType) PType() px.Type

func (*UnitType) SerializationString

func (t *UnitType) SerializationString() string

func (*UnitType) String

func (t *UnitType) String() string

func (*UnitType) ToString

func (t *UnitType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type UriType

type UriType struct {
	// contains filtered or unexported fields
}

func DefaultUriType

func DefaultUriType() *UriType

func NewUriType

func NewUriType(uri *url.URL) *UriType

func (*UriType) Accept

func (t *UriType) Accept(v px.Visitor, g px.Guard)

func (*UriType) CanSerializeAsString

func (t *UriType) CanSerializeAsString() bool

func (*UriType) Default

func (t *UriType) Default() px.Type

func (*UriType) Equals

func (t *UriType) Equals(other interface{}, g px.Guard) bool

func (*UriType) Get

func (t *UriType) Get(key string) (value px.Value, ok bool)

func (*UriType) IsAssignable

func (t *UriType) IsAssignable(other px.Type, g px.Guard) bool

func (*UriType) IsInstance

func (t *UriType) IsInstance(other px.Value, g px.Guard) bool

func (*UriType) Member

func (t *UriType) Member(name string) (px.CallableMember, bool)

func (*UriType) MetaType

func (t *UriType) MetaType() px.ObjectType

func (*UriType) Name

func (t *UriType) Name() string

func (*UriType) PType

func (t *UriType) PType() px.Type

func (*UriType) Parameters

func (t *UriType) Parameters() []px.Value

func (*UriType) SerializationString

func (t *UriType) SerializationString() string

func (*UriType) String

func (t *UriType) String() string

func (*UriType) ToString

func (t *UriType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

type UriValue

type UriValue struct {
	UriType
}

func WrapURI

func WrapURI(uri *url.URL) *UriValue

func WrapURI2

func WrapURI2(str string) *UriValue

func (*UriValue) CanSerializeAsString

func (u *UriValue) CanSerializeAsString() bool

func (*UriValue) Equals

func (u *UriValue) Equals(other interface{}, guard px.Guard) bool

func (*UriValue) Get

func (u *UriValue) Get(key string) (px.Value, bool)

func (*UriValue) PType

func (u *UriValue) PType() px.Type

func (*UriValue) SerializationString

func (u *UriValue) SerializationString() string

func (*UriValue) String

func (u *UriValue) String() string

func (*UriValue) ToKey

func (u *UriValue) ToKey(b *bytes.Buffer)

func (*UriValue) ToString

func (u *UriValue) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*UriValue) URL

func (u *UriValue) URL() *url.URL

type VariantType

type VariantType struct {
	// contains filtered or unexported fields
}

func DefaultVariantType

func DefaultVariantType() *VariantType

func (*VariantType) Accept

func (t *VariantType) Accept(v px.Visitor, g px.Guard)

func (*VariantType) CanSerializeAsString

func (t *VariantType) CanSerializeAsString() bool

func (*VariantType) Default

func (t *VariantType) Default() px.Type

func (*VariantType) Equals

func (t *VariantType) Equals(o interface{}, g px.Guard) bool

func (*VariantType) Generic

func (t *VariantType) Generic() px.Type

func (*VariantType) IsAssignable

func (t *VariantType) IsAssignable(o px.Type, g px.Guard) bool

func (*VariantType) IsInstance

func (t *VariantType) IsInstance(o px.Value, g px.Guard) bool

func (*VariantType) MetaType

func (t *VariantType) MetaType() px.ObjectType

func (*VariantType) Name

func (t *VariantType) Name() string

func (*VariantType) PType

func (t *VariantType) PType() px.Type

func (*VariantType) Parameters

func (t *VariantType) Parameters() []px.Value

func (*VariantType) Resolve

func (t *VariantType) Resolve(c px.Context) px.Type

func (*VariantType) SerializationString

func (t *VariantType) SerializationString() string

func (*VariantType) String

func (t *VariantType) String() string

func (*VariantType) ToString

func (t *VariantType) ToString(b io.Writer, s px.FormatContext, g px.RDetect)

func (*VariantType) Types

func (t *VariantType) Types() []px.Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL