Documentation ¶
Overview ¶
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Copyright 2017 karma.run AG. All rights reserved. Use of this source code is governed by an AGPL license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func ModelToHuman(m Model) string
- func ValueFromModel(metaId string, model Model, recursions map[*Recursion]struct{}) val.Value
- type Annotation
- func (m Annotation) Concrete() Model
- func (m Annotation) Copy() Model
- func (m Annotation) Equals(n Model) bool
- func (a Annotation) Nullable() bool
- func (m Annotation) Transform(f func(Model) Model) Model
- func (w Annotation) Traverse(p []string, f func([]string, Model))
- func (w Annotation) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Annotation) Unwrap() Model
- func (m Annotation) Validate(v val.Value, p err.ErrorPath) err.Error
- func (m Annotation) ValueType() val.Type
- func (r Annotation) Zero() val.Value
- func (a Annotation) Zeroable() bool
- type Any
- func (m Any) Concrete() Model
- func (m Any) Copy() Model
- func (m Any) Equals(n Model) bool
- func (Any) Nullable() bool
- func (m Any) Transform(f func(Model) Model) Model
- func (r Any) Traverse(p []string, f func([]string, Model))
- func (a Any) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Any) Unwrap() Model
- func (m Any) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Any) ValueType() val.Type
- func (r Any) Zero() val.Value
- func (Any) Zeroable() bool
- type Bool
- func (m Bool) Concrete() Model
- func (m Bool) Copy() Model
- func (m Bool) Equals(n Model) bool
- func (Bool) Nullable() bool
- func (m Bool) Transform(f func(Model) Model) Model
- func (r Bool) Traverse(p []string, f func([]string, Model))
- func (b Bool) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Bool) Unwrap() Model
- func (m Bool) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Bool) ValueType() val.Type
- func (r Bool) Zero() val.Value
- func (Bool) Zeroable() bool
- type DateTime
- func (m DateTime) Concrete() Model
- func (o DateTime) Copy() Model
- func (m DateTime) Equals(n Model) bool
- func (DateTime) Nullable() bool
- func (m DateTime) Transform(f func(Model) Model) Model
- func (r DateTime) Traverse(p []string, f func([]string, Model))
- func (o DateTime) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m DateTime) Unwrap() Model
- func (m DateTime) Validate(v val.Value, p err.ErrorPath) err.Error
- func (DateTime) ValueType() val.Type
- func (r DateTime) Zero() val.Value
- func (DateTime) Zeroable() bool
- type Enum
- func (m Enum) Concrete() Model
- func (s Enum) Copy() Model
- func (m Enum) Equals(n Model) bool
- func (Enum) Nullable() bool
- func (m Enum) Transform(f func(Model) Model) Model
- func (s Enum) Traverse(p []string, f func([]string, Model))
- func (m Enum) TraverseValue(v val.Value, f func(val.Value, Model))
- func (m Enum) Unwrap() Model
- func (m Enum) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Enum) ValueType() val.Type
- func (m Enum) Zero() val.Value
- func (Enum) Zeroable() bool
- type Float
- func (m Float) Concrete() Model
- func (f Float) Copy() Model
- func (m Float) Equals(n Model) bool
- func (Float) Nullable() bool
- func (m Float) Transform(f func(Model) Model) Model
- func (r Float) Traverse(p []string, f func([]string, Model))
- func (s Float) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Float) Unwrap() Model
- func (m Float) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Float) ValueType() val.Type
- func (r Float) Zero() val.Value
- func (Float) Zeroable() bool
- type Int16
- func (m Int16) Concrete() Model
- func (i Int16) Copy() Model
- func (m Int16) Equals(n Model) bool
- func (Int16) Nullable() bool
- func (m Int16) Transform(f func(Model) Model) Model
- func (r Int16) Traverse(p []string, f func([]string, Model))
- func (i Int16) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Int16) Unwrap() Model
- func (m Int16) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Int16) ValueType() val.Type
- func (r Int16) Zero() val.Value
- func (Int16) Zeroable() bool
- type Int32
- func (m Int32) Concrete() Model
- func (i Int32) Copy() Model
- func (m Int32) Equals(n Model) bool
- func (Int32) Nullable() bool
- func (m Int32) Transform(f func(Model) Model) Model
- func (r Int32) Traverse(p []string, f func([]string, Model))
- func (i Int32) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Int32) Unwrap() Model
- func (m Int32) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Int32) ValueType() val.Type
- func (r Int32) Zero() val.Value
- func (Int32) Zeroable() bool
- type Int64
- func (m Int64) Concrete() Model
- func (i Int64) Copy() Model
- func (m Int64) Equals(n Model) bool
- func (Int64) Nullable() bool
- func (m Int64) Transform(f func(Model) Model) Model
- func (r Int64) Traverse(p []string, f func([]string, Model))
- func (i Int64) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Int64) Unwrap() Model
- func (m Int64) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Int64) ValueType() val.Type
- func (r Int64) Zero() val.Value
- func (Int64) Zeroable() bool
- type Int8
- func (m Int8) Concrete() Model
- func (i Int8) Copy() Model
- func (m Int8) Equals(n Model) bool
- func (Int8) Nullable() bool
- func (m Int8) Transform(f func(Model) Model) Model
- func (r Int8) Traverse(p []string, f func([]string, Model))
- func (i Int8) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Int8) Unwrap() Model
- func (m Int8) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Int8) ValueType() val.Type
- func (r Int8) Zero() val.Value
- func (Int8) Zeroable() bool
- type List
- func (m List) Concrete() Model
- func (l List) Copy() Model
- func (m List) Equals(n Model) bool
- func (List) Nullable() bool
- func (m List) Transform(f func(Model) Model) Model
- func (r List) Traverse(p []string, f func([]string, Model))
- func (l List) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m List) Unwrap() Model
- func (m List) Validate(v val.Value, p err.ErrorPath) err.Error
- func (List) ValueType() val.Type
- func (r List) Zero() val.Value
- func (List) Zeroable() bool
- type Map
- func (m Map) Concrete() Model
- func (m Map) Copy() Model
- func (m Map) Equals(n Model) bool
- func (Map) Nullable() bool
- func (m Map) Transform(f func(Model) Model) Model
- func (r Map) Traverse(p []string, f func([]string, Model))
- func (m Map) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Map) Unwrap() Model
- func (m Map) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Map) ValueType() val.Type
- func (r Map) Zero() val.Value
- func (Map) Zeroable() bool
- type Model
- type Null
- func (m Null) Concrete() Model
- func (l Null) Copy() Model
- func (m Null) Equals(n Model) bool
- func (Null) Nullable() bool
- func (m Null) Transform(f func(Model) Model) Model
- func (r Null) Traverse(p []string, f func([]string, Model))
- func (l Null) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Null) Unwrap() Model
- func (m Null) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Null) ValueType() val.Type
- func (r Null) Zero() val.Value
- func (Null) Zeroable() bool
- type Optional
- func (m Optional) Concrete() Model
- func (m Optional) Copy() Model
- func (m Optional) Equals(n Model) bool
- func (Optional) Nullable() bool
- func (m Optional) Transform(f func(Model) Model) Model
- func (m Optional) Traverse(p []string, f func([]string, Model))
- func (m Optional) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Optional) Unwrap() Model
- func (m Optional) Validate(v val.Value, p err.ErrorPath) err.Error
- func (m Optional) ValueType() val.Type
- func (m Optional) Zero() val.Value
- func (Optional) Zeroable() bool
- type Recursion
- func (m *Recursion) Concrete() Model
- func (r *Recursion) Copy() Model
- func (m *Recursion) Equals(n Model) bool
- func (r *Recursion) Nullable() bool
- func (r *Recursion) Transform(f func(Model) Model) Model
- func (r *Recursion) Traverse(p []string, f func([]string, Model))
- func (r *Recursion) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m *Recursion) Unwrap() Model
- func (m *Recursion) Validate(v val.Value, p err.ErrorPath) err.Error
- func (m *Recursion) ValueType() val.Type
- func (r *Recursion) Zero() val.Value
- func (r *Recursion) Zeroable() bool
- type Ref
- func (m Ref) Concrete() Model
- func (r Ref) Copy() Model
- func (m Ref) Equals(n Model) bool
- func (Ref) Nullable() bool
- func (m Ref) Transform(f func(Model) Model) Model
- func (r Ref) Traverse(p []string, f func([]string, Model))
- func (r Ref) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Ref) Unwrap() Model
- func (m Ref) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Ref) ValueType() val.Type
- func (r Ref) Zero() val.Value
- func (Ref) Zeroable() bool
- type Set
- func (m Set) Concrete() Model
- func (l Set) Copy() Model
- func (m Set) Equals(n Model) bool
- func (Set) Nullable() bool
- func (m Set) Transform(f func(Model) Model) Model
- func (r Set) Traverse(p []string, f func([]string, Model))
- func (l Set) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Set) Unwrap() Model
- func (m Set) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Set) ValueType() val.Type
- func (r Set) Zero() val.Value
- func (Set) Zeroable() bool
- type String
- func (m String) Concrete() Model
- func (s String) Copy() Model
- func (m String) Equals(n Model) bool
- func (String) Nullable() bool
- func (m String) Transform(f func(Model) Model) Model
- func (r String) Traverse(p []string, f func([]string, Model))
- func (s String) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m String) Unwrap() Model
- func (m String) Validate(v val.Value, p err.ErrorPath) err.Error
- func (String) ValueType() val.Type
- func (r String) Zero() val.Value
- func (String) Zeroable() bool
- type Struct
- func (m Struct) Concrete() Model
- func (m Struct) Copy() Model
- func (m Struct) Equals(w Model) bool
- func (m Struct) Field(k string) Model
- func (m Struct) ForEach(f func(string, Model) bool)
- func (m Struct) Get(k string) (Model, bool)
- func (m Struct) Keys() []string
- func (m Struct) Len() int
- func (Struct) Nullable() bool
- func (m Struct) Set(k string, w Model)
- func (m Struct) Transform(f func(Model) Model) Model
- func (m Struct) Traverse(p []string, f func([]string, Model))
- func (s Struct) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Struct) Unwrap() Model
- func (m Struct) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Struct) ValueType() val.Type
- func (m Struct) Zero() val.Value
- func (m Struct) Zeroable() bool
- type Tuple
- func (m Tuple) Concrete() Model
- func (s Tuple) Copy() Model
- func (m Tuple) Equals(n Model) bool
- func (Tuple) Nullable() bool
- func (m Tuple) Transform(f func(Model) Model) Model
- func (s Tuple) Traverse(p []string, f func([]string, Model))
- func (s Tuple) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Tuple) Unwrap() Model
- func (m Tuple) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Tuple) ValueType() val.Type
- func (r Tuple) Zero() val.Value
- func (m Tuple) Zeroable() bool
- type Uint16
- func (m Uint16) Concrete() Model
- func (i Uint16) Copy() Model
- func (m Uint16) Equals(n Model) bool
- func (Uint16) Nullable() bool
- func (m Uint16) Transform(f func(Model) Model) Model
- func (r Uint16) Traverse(p []string, f func([]string, Model))
- func (i Uint16) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Uint16) Unwrap() Model
- func (m Uint16) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Uint16) ValueType() val.Type
- func (r Uint16) Zero() val.Value
- func (Uint16) Zeroable() bool
- type Uint32
- func (m Uint32) Concrete() Model
- func (i Uint32) Copy() Model
- func (m Uint32) Equals(n Model) bool
- func (Uint32) Nullable() bool
- func (m Uint32) Transform(f func(Model) Model) Model
- func (r Uint32) Traverse(p []string, f func([]string, Model))
- func (i Uint32) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Uint32) Unwrap() Model
- func (m Uint32) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Uint32) ValueType() val.Type
- func (r Uint32) Zero() val.Value
- func (Uint32) Zeroable() bool
- type Uint64
- func (m Uint64) Concrete() Model
- func (i Uint64) Copy() Model
- func (m Uint64) Equals(n Model) bool
- func (Uint64) Nullable() bool
- func (m Uint64) Transform(f func(Model) Model) Model
- func (r Uint64) Traverse(p []string, f func([]string, Model))
- func (i Uint64) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Uint64) Unwrap() Model
- func (m Uint64) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Uint64) ValueType() val.Type
- func (r Uint64) Zero() val.Value
- func (Uint64) Zeroable() bool
- type Uint8
- func (m Uint8) Concrete() Model
- func (i Uint8) Copy() Model
- func (m Uint8) Equals(n Model) bool
- func (Uint8) Nullable() bool
- func (m Uint8) Transform(f func(Model) Model) Model
- func (r Uint8) Traverse(p []string, f func([]string, Model))
- func (i Uint8) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Uint8) Unwrap() Model
- func (m Uint8) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Uint8) ValueType() val.Type
- func (r Uint8) Zero() val.Value
- func (Uint8) Zeroable() bool
- type Union
- func (m Union) Case(k string) Model
- func (m Union) Cases() []string
- func (m Union) Concrete() Model
- func (m Union) Copy() Model
- func (m Union) Equals(w Model) bool
- func (m Union) ForEach(f func(string, Model) bool)
- func (m Union) Get(k string) (Model, bool)
- func (m Union) Keys() []string
- func (m Union) Len() int
- func (Union) Nullable() bool
- func (m Union) Set(k string, w Model)
- func (m Union) Transform(f func(Model) Model) Model
- func (m Union) Traverse(p []string, f func([]string, Model))
- func (s Union) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Union) Unwrap() Model
- func (m Union) Validate(v val.Value, p err.ErrorPath) err.Error
- func (Union) ValueType() val.Type
- func (m Union) Zero() val.Value
- func (m Union) Zeroable() bool
- type Unique
- func (m Unique) Concrete() Model
- func (o Unique) Copy() Model
- func (m Unique) Equals(n Model) bool
- func (u Unique) Nullable() bool
- func (m Unique) Transform(f func(Model) Model) Model
- func (r Unique) Traverse(p []string, f func([]string, Model))
- func (o Unique) TraverseValue(j val.Value, f func(val.Value, Model))
- func (m Unique) Unwrap() Model
- func (m Unique) Validate(v val.Value, p err.ErrorPath) err.Error
- func (m Unique) ValueType() val.Type
- func (r Unique) Zero() val.Value
- func (u Unique) Zeroable() bool
- type ValidationError
- func (e ValidationError) AppendPath(a err.ErrorPathElement, b ...err.ErrorPathElement) err.PathedError
- func (e ValidationError) Child() err.Error
- func (e ValidationError) Error() string
- func (e ValidationError) ErrorPath() err.ErrorPath
- func (e ValidationError) String() string
- func (e ValidationError) Value() val.Union
Constants ¶
const (
FormatDateTime = time.RFC3339
)
Variables ¶
var EmptyStruct = NewStruct(0)
Functions ¶
func ModelToHuman ¶
Types ¶
type Annotation ¶
func (Annotation) Concrete ¶
func (m Annotation) Concrete() Model
func (Annotation) Copy ¶
func (m Annotation) Copy() Model
func (Annotation) Equals ¶
func (m Annotation) Equals(n Model) bool
func (Annotation) Nullable ¶
func (a Annotation) Nullable() bool
func (Annotation) TraverseValue ¶
func (Annotation) Unwrap ¶
func (m Annotation) Unwrap() Model
func (Annotation) ValueType ¶
func (m Annotation) ValueType() val.Type
func (Annotation) Zero ¶
func (r Annotation) Zero() val.Value
func (Annotation) Zeroable ¶
func (a Annotation) Zeroable() bool
type Model ¶
type Model interface { // Validate returns nil for val.Values that fit the given Model // It returns an error for everything else Validate(v val.Value, p err.ErrorPath) err.Error // Copy copies a Model tree. It's equivalent to calling // Transform(mdl.TransformationIdentity) Copy() Model // Transform traverses a Model tree and returns the result // of mapping each of its nodes through function f. Transform(f func(Model) Model) Model // Zero returns the zero-value for the current model. // This is not possible with all model configurations, // especially not Refs. See Zeroable. Zero() val.Value // Zeroable reports wether calling Zero() on this Model is legal. Zeroable() bool // Unwrap returns the shallowest Model defined in // this package in a Model tree. Unwrap() Model // Concrete unwraps a Model to the shallowest Model that // affects its Value representation. In other words, // it removes semantic wrappers. Concrete() Model // Equals reports wether a Model tree equals another. Equals(Model) bool // Nullable reports wether a Model can be Null. Nullable() bool // TraverseValue traverses a Value tree v, calling function f // for every legal Value/Model combination therein. TraverseValue(v val.Value, f func(val.Value, Model)) // Traverse is obsolete but still needed. Do not use it. Traverse([]string, func([]string, Model)) // Returns the top-level Type of the Values in the set // of a Model. Returns TypeInvalid in case of Any and Or. ValueType() val.Type }
Model represents a possibly nested and/or recursive data type.
func ModelFromValue ¶
func ModelFromValue(metaId string, u val.Union, recursions map[string]*Recursion) (Model, err.PathedError)
ModelFromValue returns a Model from its Value representation.
func NewOptional ¶
func TightestModelForValue ¶
NOTE: Abstain from using directly!
Consider calling kvm.inferType instead.
type ValidationError ¶
func (ValidationError) AppendPath ¶
func (e ValidationError) AppendPath(a err.ErrorPathElement, b ...err.ErrorPathElement) err.PathedError
func (ValidationError) Child ¶
func (e ValidationError) Child() err.Error
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) ErrorPath ¶
func (e ValidationError) ErrorPath() err.ErrorPath
func (ValidationError) String ¶
func (e ValidationError) String() string
func (ValidationError) Value ¶
func (e ValidationError) Value() val.Union