field

package
Version: v0.0.0-...-b45a7ae Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcreteField

type ConcreteField struct {
	Name       string
	Definition Field
}

type Field

type Field interface {
	json.Marshaler

	ValueStringSerializer
}

type OrderedStructType

type OrderedStructType struct {
	StructType
	Ordering []string
}

func FieldsStructTypeFromList

func FieldsStructTypeFromList(fields []ConcreteField) OrderedStructType

func (OrderedStructType) FieldNames

func (f OrderedStructType) FieldNames() []string

type StructType

type StructType interface {
	AsMap() map[string]Field

	// Get ordered names of all fields in this type
	FieldNames() []string

	Get(name string) (field Field, found bool)
}

type StructTypeMap

type StructTypeMap map[string]Field

func (StructTypeMap) AsMap

func (f StructTypeMap) AsMap() map[string]Field

func (StructTypeMap) FieldNames

func (f StructTypeMap) FieldNames() []string

func (StructTypeMap) Get

func (f StructTypeMap) Get(name string) (field Field, found bool)

type ValueStringSerializer

type ValueStringSerializer interface {
	SerializeValueToString(value interface{}) string
	DeserializeValueFromString(s string) (interface{}, error)
}

TODO: when generics come to golang, this should replace interface{} TODO: think a bit about name

Jump to

Keyboard shortcuts

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