schema

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationSchemaNullable structmeta.AnnotationName = "schema/nullable"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnySchema

type AnySchema struct {
}

func (*AnySchema) AssignType

func (as *AnySchema) AssignType(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

type ArrayItemType

type ArrayItemType struct {
	ValueType yamlmeta.Type
}

func NewArrayItemType

func NewArrayItemType(item *yamlmeta.ArrayItem) (*ArrayItemType, error)

func (ArrayItemType) AssignTypeTo

func (t ArrayItemType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (ArrayItemType) CheckType

func (a ArrayItemType) CheckType(node yamlmeta.TypeWithValues, prependErrorMessage string) (chk yamlmeta.TypeCheck)

func (ArrayItemType) GetValueType

func (a ArrayItemType) GetValueType() yamlmeta.Type

type ArrayType

type ArrayType struct {
	ItemsType yamlmeta.Type
}

func NewArrayType

func NewArrayType(a *yamlmeta.Array) (*ArrayType, error)

func (*ArrayType) AssignTypeTo

func (t *ArrayType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (ArrayType) CheckType

func (a ArrayType) CheckType(node yamlmeta.TypeWithValues, prependErrorMessage string) (chk yamlmeta.TypeCheck)

func (ArrayType) GetValueType

func (a ArrayType) GetValueType() yamlmeta.Type

type DocumentSchema

type DocumentSchema struct {
	Name    string
	Source  *yamlmeta.Document
	Allowed *DocumentType
}

func NewDocumentSchema

func NewDocumentSchema(doc *yamlmeta.Document) (*DocumentSchema, error)

func (*DocumentSchema) AssignType

func (s *DocumentSchema) AssignType(typeable yamlmeta.Typeable) yamlmeta.TypeCheck

type DocumentType

type DocumentType struct {
	Source    *yamlmeta.Document
	ValueType yamlmeta.Type // typically one of: MapType, ArrayType, ScalarType
}

func (*DocumentType) AssignTypeTo

func (t *DocumentType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*DocumentType) CheckType

func (t *DocumentType) CheckType(_ yamlmeta.TypeWithValues, _ string) (chk yamlmeta.TypeCheck)

func (*DocumentType) GetValueType

func (t *DocumentType) GetValueType() yamlmeta.Type

type MapItemType

type MapItemType struct {
	Key          interface{} // usually a string
	ValueType    yamlmeta.Type
	DefaultValue interface{}
	Position     *filepos.Position
	Annotations  TypeAnnotations
}

func NewMapItemType

func NewMapItemType(item *yamlmeta.MapItem) (*MapItemType, error)

func (*MapItemType) AssignTypeTo

func (t *MapItemType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (MapItemType) CheckType

func (m MapItemType) CheckType(node yamlmeta.TypeWithValues, prependErrorMessage string) (chk yamlmeta.TypeCheck)

func (MapItemType) GetValueType

func (m MapItemType) GetValueType() yamlmeta.Type

func (MapItemType) IsNullable

func (t MapItemType) IsNullable() bool

type MapType

type MapType struct {
	Items []*MapItemType
}

func NewMapType

func NewMapType(m *yamlmeta.Map) (*MapType, error)

func (*MapType) AllowsKey

func (t *MapType) AllowsKey(key interface{}) bool

func (*MapType) AssignTypeTo

func (t *MapType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (*MapType) CheckType

func (m *MapType) CheckType(node yamlmeta.TypeWithValues, prependErrorMessage string) (chk yamlmeta.TypeCheck)

func (MapType) GetValueType

func (m MapType) GetValueType() yamlmeta.Type

type ScalarType

type ScalarType struct {
	Type interface{}
}

func (*ScalarType) AssignTypeTo

func (t *ScalarType) AssignTypeTo(typeable yamlmeta.Typeable) (chk yamlmeta.TypeCheck)

func (ScalarType) CheckType

func (m ScalarType) CheckType(node yamlmeta.TypeWithValues, prependErrorMessage string) (chk yamlmeta.TypeCheck)

func (ScalarType) GetValueType

func (m ScalarType) GetValueType() yamlmeta.Type

type TypeAnnotations

type TypeAnnotations map[structmeta.AnnotationName]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL