Documentation
¶
Index ¶
- func DefinePrimitiveTypeClass(goKind reflect.Kind, terminusClass string)
- func DefineTypeClass(goType reflect.Type, terminusClass string, ...)
- func GetSchemaClass(typ reflect.Type) (string, bool)
- func SerializeObject(buf map[string]any, object any, mapCallback FieldSerializeMapCallback) error
- type AbstractModel
- type Class
- type ClassDocumentationPropertiesItem
- type ClassDocumentationType
- type ClassKey
- type ClassKeyType
- type ComplexTypeConverterFunc
- type Context
- type ContextDocumentation
- type Enum
- func (e *Enum) Deserialize(m RawSchemaItem) error
- func (e *Enum) FromValue(name string, enumValues []string)
- func (e *Enum) MarshalJSON() ([]byte, error)
- func (e *Enum) Name() string
- func (e *Enum) Serialize(buf RawSchemaItem) error
- func (e *Enum) Type() ItemType
- func (e *Enum) UnmarshalJSON(bytes []byte) error
- type Field
- type FieldSerializeMapCallback
- type FieldType
- type IdentityKeeper
- type ItemType
- type RawSchemaItem
- type Schema
- type Serializable
- type SubDocumentModel
- type TaggedUnion
- func (t *TaggedUnion) Deserialize(m RawSchemaItem) error
- func (t *TaggedUnion) FromObject(obj any)
- func (t *TaggedUnion) MarshalJSON() ([]byte, error)
- func (t *TaggedUnion) Name() string
- func (t *TaggedUnion) Serialize(buf RawSchemaItem) error
- func (t *TaggedUnion) Type() ItemType
- func (t *TaggedUnion) UnmarshalJSON(bytes []byte) error
- type TaggedUnionModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineTypeClass ¶
func DefineTypeClass(goType reflect.Type, terminusClass string, toSchemaConverter ComplexTypeConverterFunc)
func SerializeObject ¶
func SerializeObject(buf map[string]any, object any, mapCallback FieldSerializeMapCallback) error
Types ¶
type AbstractModel ¶
type AbstractModel struct{} // TODO: implement
type Class ¶
type Class struct { ID string `mapstructure:"@id"` Key ClassKey `mapstructure:"@key"` Documentation []ClassDocumentationType `mapstructure:"@documentation,omitempty"` Base string `mapstructure:"@base"` Inherits []string `mapstructure:"-"` Fields map[string]Field `mapstructure:"-"` SubDocument bool `mapstructure:"-"` Abstract bool `mapstructure:"-"` }
func (*Class) Deserialize ¶
func (c *Class) Deserialize(m RawSchemaItem) error
func (*Class) FromObject ¶
func (*Class) MarshalJSON ¶
func (*Class) Serialize ¶
func (c *Class) Serialize(buf RawSchemaItem) error
func (*Class) UnmarshalJSON ¶
type ClassDocumentationType ¶
type ClassKey ¶
type ClassKey struct { Type ClassKeyType `mapstructure:"@type"` Fields []string `mapstructure:"@fields,omitempty"` }
type ClassKeyType ¶
type ClassKeyType string
const ( ClassKeyRandom ClassKeyType = "Random" ClassKeyLexical ClassKeyType = "Lexical" ClassKeyHash ClassKeyType = "Hash" ClassKeyValueHash ClassKeyType = "ValueHash" )
type ComplexTypeConverterFunc ¶
func GetConverter ¶
func GetConverter(typ reflect.Type) (ComplexTypeConverterFunc, bool)
type Context ¶
type Context struct { Schema string `json:"@schema" mapstructure:"@schema"` Base string `json:"@base" mapstructure:"@base"` Documentation *ContextDocumentation `json:"@documentation,omitempty" mapstructure:"@documentation,omitempty"` }
func (*Context) Deserialize ¶
func (c *Context) Deserialize(m RawSchemaItem) error
func (*Context) Serialize ¶
func (c *Context) Serialize(buf RawSchemaItem) error
type ContextDocumentation ¶
type Enum ¶
func (*Enum) Deserialize ¶
func (e *Enum) Deserialize(m RawSchemaItem) error
func (*Enum) MarshalJSON ¶
func (*Enum) Serialize ¶
func (e *Enum) Serialize(buf RawSchemaItem) error
func (*Enum) UnmarshalJSON ¶
type Field ¶
type Field struct { Type FieldType `json:"@type,omitempty"` Class string `json:"@class,omitempty"` // For all types except Foreign ID string `json:"@id,omitempty"` // For Foreign type Cardinality uint `json:"@cardinality,omitempty"` // For Set type MinCardinality uint `json:"@min_cardinality,omitempty"` // For Set type MaxCardinality uint `json:"@max_cardinality,omitempty"` // For Set type Dimensions uint `json:"@dimensions,omitempty"` // For Array type Tags map[string]string `json:"-" mapstructure:"-"` }
type IdentityKeeper ¶
type RawSchemaItem ¶
func (RawSchemaItem) ToSchemaItem ¶
func (rsi RawSchemaItem) ToSchemaItem(schemaItemBuf Serializable) error
func (RawSchemaItem) Type ¶
func (rsi RawSchemaItem) Type() (ItemType, error)
type Schema ¶
type Schema struct { Context Context SchemaItems []Serializable }
func (*Schema) Deserialize ¶
func (s *Schema) Deserialize(items []RawSchemaItem) error
func (*Schema) MarshalJSON ¶
func (*Schema) Serialize ¶
func (s *Schema) Serialize(buf []RawSchemaItem) error
func (*Schema) UnmarshalJSON ¶
type Serializable ¶
type Serializable interface { Deserialize(RawSchemaItem) error Serialize(RawSchemaItem) error // FIXME: maybe make parameter as pointer? }
type SubDocumentModel ¶
type SubDocumentModel struct{}
type TaggedUnion ¶
type TaggedUnion struct { ID string `mapstructure:"@id"` Key ClassKey `mapstructure:"@key"` Documentation []ClassDocumentationType `mapstructure:"@documentation,omitempty"` // TODO: implement -- how to describe in object Base string `mapstructure:"@base"` Fields map[string]Field `mapstructure:"-"` }
func (*TaggedUnion) Deserialize ¶
func (t *TaggedUnion) Deserialize(m RawSchemaItem) error
func (*TaggedUnion) FromObject ¶
func (t *TaggedUnion) FromObject(obj any)
func (*TaggedUnion) MarshalJSON ¶
func (t *TaggedUnion) MarshalJSON() ([]byte, error)
func (*TaggedUnion) Name ¶
func (t *TaggedUnion) Name() string
func (*TaggedUnion) Serialize ¶
func (t *TaggedUnion) Serialize(buf RawSchemaItem) error
func (*TaggedUnion) Type ¶
func (t *TaggedUnion) Type() ItemType
func (*TaggedUnion) UnmarshalJSON ¶
func (t *TaggedUnion) UnmarshalJSON(bytes []byte) error
type TaggedUnionModel ¶
type TaggedUnionModel struct{}
Click to show internal directories.
Click to hide internal directories.