schema

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const DisplayNameKey = "displayName"
View Source
const FromKey = "from"
View Source
const IDKey = "id"
View Source
const NameKey = "name"
View Source
const PositionKey = "position"
View Source
const ProxyDisplayName = "Belongs To"
View Source
const ProxyName = "belongs_to"
View Source
const ToKey = "to"
View Source
const TypeKey = "type"

TypeKey and other *Keys must match the json struct tag for the property

Variables

This section is empty.

Functions

func FromMap

func FromMap(jsonMap map[string]any) (any, error)

func IsLinkedProperty

func IsLinkedProperty(jsonMap map[string]any) (bool, error)

func IsModel

func IsModel(jsonMap map[string]any) (bool, error)

func IsProxy

func IsProxy(r NullableRelationship) bool

func IsRelationship

func IsRelationship(jsonMap map[string]any) (bool, error)

func IsType

func IsType(jsonMap map[string]any, schemaType Type) (bool, error)

Types

type Element

type Element struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
}

func ElementFromMap

func ElementFromMap(jsonMap map[string]any) Element

func (Element) IsLinkedProperty

func (e Element) IsLinkedProperty() bool

func (Element) IsModel

func (e Element) IsModel() bool

type Elements

type Elements struct {
	Models           []Model
	Relationships    []Relationship
	LinkedProperties []LinkedProperty
}

type LinkedProperty

type LinkedProperty struct {
	Element
	From     string `json:"from"`
	To       string `json:"to"`
	Position int    `json:"position"`
}

func LinkedPropertyFromMap

func LinkedPropertyFromMap(jsonMap map[string]any) (*LinkedProperty, error)

func (*LinkedProperty) Logger

func (m *LinkedProperty) Logger(logger *slog.Logger) *slog.Logger

type Model

type Model struct {
	Element
	Properties []Property
}

func ModelFromMap

func ModelFromMap(jsonMap map[string]any) (*Model, error)

func (*Model) Logger

func (m *Model) Logger(logger *slog.Logger) *slog.Logger

type NullableRelationship

type NullableRelationship struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	DisplayName string  `json:"displayName"`
	From        *string `json:"from"`
	To          *string `json:"to"`
}

NullableRelationship represents an item in metadata/schema/relationships.json where unlike a usual Relationship, the special proxy relationship will have "to" and "from" null.

func (NullableRelationship) IsProxy

func (r NullableRelationship) IsProxy() bool

type Property

type Property struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	// DataType may be a string or may be a JSON object
	DataType json.RawMessage `json:"dataType"`
	Required bool            `json:"required"`
	Index    int             `json:"index"`
}

type Relationship

type Relationship struct {
	Element
	From string `json:"from"`
	To   string `json:"to"`
}

func RelationshipFromMap

func RelationshipFromMap(jsonMap map[string]any) (*Relationship, error)

func (*Relationship) Logger

func (m *Relationship) Logger(logger *slog.Logger) *slog.Logger

type Type

type Type string
const LinkedPropertyType Type = "schemaLinkedProperty"
const ModelType Type = "concept"
const RelationshipType Type = "schemaRelationship"

Jump to

Keyboard shortcuts

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