system

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermDeleteObject = Permission(1) << iota
	PermViewName     = Permission(1) << iota
	PermChangeName   = Permission(1) << iota
	PermViewData     = Permission(1) << iota
	PermChangeData   = Permission(1) << iota
	PermCreated      = Permission(1) << iota
	PermUser         = Permission(1) << iota
	PermViewAbstract = Permission(1) << iota

	PermAddAbstract    = Permission(1) << iota
	PermRemoveAbstract = Permission(1) << iota
	PermViewSpecial    = Permission(1) << iota
	PermAddSpecial     = Permission(1) << iota
	PermRemoveSpecial  = Permission(1) << iota
	PermViewTarget     = Permission(1) << iota
	PermAddTarget      = Permission(1) << iota
	PermRemoveTarget   = Permission(1) << iota

	PermViewOrigin   = Permission(1) << iota
	PermAddOrigin    = Permission(1) << iota
	PermRemoveOrigin = Permission(1) << iota
	PermViewObject   = Permission(1) << iota
	PermAddObject    = Permission(1) << iota
	PermRemoveObject = Permission(1) << iota
	PermViewSpace    = Permission(1) << iota
	PermAddSpace     = Permission(1) << iota

	PermRemoveSpace = Permission(1) << iota
	PermReserved1   = Permission(1) << iota
	PermReserved2   = Permission(1) << iota
	PermReserved3   = Permission(1) << iota
	PermMeta1       = Permission(1) << iota
	PermMeta2       = Permission(1) << iota
	PermMeta3       = Permission(1) << iota
	PermMeta4       = Permission(1) << iota
)

4 permission bytes

View Source
const MaxDuration = (1<<31 - 1) * time.Second
View Source
const PermChangeAbstract = PermAddAbstract | PermRemoveAbstract
View Source
const PermChangeObject = PermAddObject | PermRemoveObject
View Source
const PermChangeOrigin = PermAddOrigin | PermRemoveOrigin
View Source
const PermChangeSpace = PermAddSpace | PermRemoveSpace
View Source
const PermChangeSpecial = PermAddSpecial | PermRemoveSpecial
View Source
const PermChangeTarget = PermAddTarget | PermRemoveTarget
View Source
const PermissionSize = 4

Variables

This section is empty.

Functions

func InterfaceReference

func InterfaceReference(lib Library, name string, full bool) string

func IsError

func IsError(code Code) bool

func MustReadResource

func MustReadResource[T any](val any, obj T) T

MustReadResource behaves similar to ReadResource but creates a new instance from the passed type and panics in case of an error.

func MustWriteResource

func MustWriteResource(obj any) any

MustWriteResource behaves like WriteResource but panics in case of an error.

func ReadResource

func ReadResource(val any, obj any) error

ReadResource turns a nested structure composed of maps, slices and primitive values into a Go variable.

func WriteResource

func WriteResource(obj any) (any, error)

WriteResource obtains a nested structure composed of maps, slices and primitive values from a Go variable.

Types

type AccessGroup

type AccessGroup struct {
	Name        string
	Permissions uint32
	Tokens      []LayerToken
}

AccessGroup is a group of layer tokens having at least the group's permissions.

func ReadAccessGroup

func ReadAccessGroup(groupString string) (*AccessGroup, error)

ReadAccessGroup parses a string obtained by AccessGroup.String and returns an access group instance.

func (*AccessGroup) RegisterLayerToken

func (ac *AccessGroup) RegisterLayerToken(token LayerToken) error

RegisterLayerToken adds a layer token to this access group. It returns an error if the layer token does not have sufficient permissions for that group.

func (AccessGroup) String

func (ac AccessGroup) String() string

String returns a string representation of this access group. The string can be parsed using ReadAccessGroup.

func (*AccessGroup) UnregisterLayerToken

func (ac *AccessGroup) UnregisterLayerToken(token string)

UnregisterLayerToken removes a token from this access group. If the token is not present, nothing will happen.

type AccessOptions

type AccessOptions struct {
	Access      string
	AccessNames []string `json:"accessNames"`
}

type AggregateNode

type AggregateNode struct {
	Source   ValueSource   `json:"source"`
	Function AggregateType `json:"function"`
}

AggregateNode turns a list or a keyed list context into a single value

func (AggregateNode) InterfaceSchema

func (en AggregateNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type AggregateType

type AggregateType string

AggregateType defines the type of aggregation

const (
	AggregateTypeCount   AggregateType = "count"
	AggregateTypeMinimum AggregateType = "minimum"
	AggregateTypeMaximum AggregateType = "maximum"
	AggregateTypeSum     AggregateType = "sum"
	AggregateTypeAverage AggregateType = "average"
)

type Callback

type Callback func(message StreamMessage)

type ChangeType

type ChangeType string
const (
	CngChange ChangeType = "change"
	CngAdd    ChangeType = "add"
	CngRemove ChangeType = "remove"
)

type CmdType

type CmdType string
const (
	CmdInfo                CmdType = "info"
	CmdRegisterLayerTokens CmdType = "registerLayerTokens"
	CmdGetLayerTokens      CmdType = "getLayerTokens"
	CmdSubscribe           CmdType = "subscribe"
	CmdUnsubscribe         CmdType = "unsubscribe"
	CmdEvent               CmdType = "event"
)

type Code

type Code int
const (
	// CodeUndefined should not be used and will most likely trigger an error
	CodeUndefined Code = iota

	// CodeSuccess200 represents a 200 (OK) status
	CodeSuccess200 Code = iota

	// CodePartial206 represents a 206 (partial content) status
	CodePartial206 Code = iota

	// CodeError403 represents a 403 (authentication required) error
	CodeError403 Code = iota

	// CodeError400BadRequest represents a 400 (bad request) error
	CodeError400BadRequest Code = iota

	// CodeError404NotFound represents a 404 (not found) error
	CodeError404NotFound Code = iota

	// CodeError416InvalidRange represents a 416 (range not satisfiable) error
	CodeError416InvalidRange Code = iota

	// CodeError500OrUnknown represents a server-side error or an unknown error
	CodeError500OrUnknown Code = iota
)

type Context

type Context struct {
	Environment Environment `json:"environment"`
	Value       any         `json:"value"`
}

type ContextNode

type ContextNode struct {
	Context Context `json:"context" yaml:"context"`
	Node    Node    `json:"node" yaml:"node"`
}

func (ContextNode) InterfaceSchema

func (en ContextNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type ContextType

type ContextType string

ContextType defines the type of context

const (
	ContextTypeBlank    ContextType = "blank"
	ContextTypeSpecials ContextType = "specials"
	ContextTypeRelation ContextType = "relation"
)

type CreateLayerRequest added in v0.0.14

type CreateLayerRequest struct {
	Abstracts core.IDSet `json:"abstracts"`
	Name      string     `json:"name"`
}

type CreateObjectRequest

type CreateObjectRequest struct {
	Abstracts core.IDSet `json:"abstracts"`
	Name      string     `json:"name"`
	Dependent bool       `json:"dependent"`
	Layer     core.ID    `json:"layer"`
}

type CreateRelationRequest

type CreateRelationRequest struct {
	Name      string     `json:"name,omitempty"`
	Origin    core.ID    `json:"origin"`
	Target    core.ID    `json:"target"`
	Abstracts core.IDSet `json:"abstracts"`
	Layer     core.ID    `json:"layer"`
	Key       any        `json:"key,omitempty"`
	KeyFormat FormatType `json:"keyFormat,omitempty"`
}

type EndpointNode

type EndpointNode struct {
	Type       EndpointType `json:"type" yaml:"type"`
	ID         core.ID      `json:"id" yaml:"id"`
	Name       string       `json:"name" yaml:"name"`
	Node       Node         `json:"node" yaml:"node"`
	Context    Context      `json:"context,omitempty" yaml:"context,omitempty"`
	Interface  *Interface   `json:"interface,omitempty" yaml:"interface,omitempty"`
	Parameters []Parameter  `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

EndpointNode injects a constant context into the first node

func (EndpointNode) InterfaceSchema

func (en EndpointNode) InterfaceSchema(universe Universe) (Interface, error)

type EndpointType

type EndpointType string
const (
	EndpointTypeGet EndpointType = "get"
	EndpointTypePut EndpointType = "put"
)

type Environment

type Environment struct {
	Type  EnvironmentType `json:"type"`
	Model string          `json:"model,omitempty"`
}

type EnvironmentType

type EnvironmentType string

EnvironmentType defines the type of environment

const (
	EnvironmentTypePrimitive EnvironmentType = "primitive"
	EnvironmentTypeList      EnvironmentType = "list"
	EnvironmentTypeKeyedList EnvironmentType = "keyed_list"
)

type EventType

type EventType string
const (
	EventName     EventType = "name"
	EventData     EventType = "data"
	EventSpecials EventType = "specials"
	EventValue    EventType = "value"
	EventResource EventType = "resource"
)

type FieldType

type FieldType string

FieldType represents the source of a value for a field.

const (
	FieldTypeID      FieldType = "id"
	FieldTypeName    FieldType = "name"
	FieldTypeSize    FieldType = "size"
	FieldTypeCreated FieldType = "created"
	FieldTypeUser    FieldType = "user"
	FieldTypeData    FieldType = "data"
)

type Filter

type Filter struct {
	Source   ValueSource  `json:"source"`
	Operator OperatorType `json:"operator"`
	Value    any          `json:"value"`
}

type FilterNode

type FilterNode struct {
	Filter Filter `json:"filter"`
	Node   Node   `json:"node"`
}

FilterNode modifies a list or a keyed list context by removing elements

func (FilterNode) InterfaceSchema

func (en FilterNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type FormatType

type FormatType string

FormatType specifies the way of mapping binary data to or from JSON values.

const (
	FormatTypeRaw     FormatType = "raw"
	FormatTypeHex     FormatType = "hex"
	FormatTypeBase64  FormatType = "base64"
	FormatTypeString  FormatType = "string"
	FormatTypeInteger FormatType = "integer"
	FormatTypeFloat   FormatType = "float"
	FormatTypeBoolean FormatType = "boolean"
)

type GenericInterface

type GenericInterface struct {
	Name TemplateString `json:"name" yaml:"name"`
}

func (GenericInterface) ApplyTemplate

func (GenericInterface) Equals

func (s GenericInterface) Equals(s2 GenericInterface) bool

func (GenericInterface) JSONSchema

func (s GenericInterface) JSONSchema(lib *Library) (map[string]any, error)

type GenericSlot

type GenericSlot struct {
	Name        TemplateString `json:"name" yaml:"name"`
	Description string         `json:"description" yaml:"description"`
}

type GenericValuation

type GenericValuation map[string]Interface

A GenericValuation maps a type onto generic placeholders

type GetNodeRequest

type GetNodeRequest struct {
	Node Node `json:"node"`
}

type GetResourceRequest

type GetResourceRequest struct {
	ObjectID core.ID         `json:"objectId"`
	Object   ResourceType    `json:"object"`
	Schema   ResourceSchema  `json:"schema"`
	Filter   ResourceFilters `json:"filter,omitempty"`
	Order    ResourceOrders  `json:"order,omitempty"`
	Offset   *int            `json:"offset,omitempty"`
	Limit    *int            `json:"limit,omitempty"`
}

type GroupNode

type GroupNode struct {
	Source ValueSource `json:"source"`
	Node   Node        `json:"node"`
}

GroupNode turns a list into a group context

func (GroupNode) InterfaceSchema

func (en GroupNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type Info

type Info struct {
	// APIVersion represents the API version
	APIVersion string `json:"apiVersion"`

	// ServerVersion represents the version of the server
	ServerVersion string `json:"serverVersion"`

	// UnixTime contains the server time
	UnixTime int64 `json:"unixTime"`

	// Layers contains layer info for the connecting client
	Layers []LayerInfo `json:"layers"`
}

type InstanceNode

type InstanceNode struct {
	Format   FormatType       `json:"format"`
	Switches []InstanceSwitch `json:"switches"`
}

InstanceNode turns a primitive context into a single value, based on the abstracts of the context value

func (InstanceNode) InterfaceSchema

func (en InstanceNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type InstanceSwitch

type InstanceSwitch struct {
	Type  string `json:"type"`
	Value any    `json:"value"`
}

type Interface

type Interface struct {
	Type      SchemaType          `json:"type" yaml:"type"`
	Named     *NamedInterface     `json:"named,omitempty" yaml:"named,omitempty"`
	Primitive *PrimitiveInterface `json:"primitive,omitempty" yaml:"primitive,omitempty"`
	Map       *MapInterface       `json:"map,omitempty" yaml:"map,omitempty"`
	List      *ListInterface      `json:"list,omitempty" yaml:"list,omitempty"`
	Generic   *GenericInterface   `json:"generic,omitempty" yaml:"generic,omitempty"`
	Reference *ReferenceInterface `json:"reference,omitempty" yaml:"reference,omitempty"`
}

func (Interface) ApplyGenerics

func (s Interface) ApplyGenerics(gv GenericValuation) (Interface, error)

func (Interface) ApplyTemplate

func (s Interface) ApplyTemplate(t TemplateValuation) (Interface, error)

func (Interface) Equals

func (s Interface) Equals(s2 Interface) bool

func (Interface) JSONSchema

func (s Interface) JSONSchema(lib *Library) (map[string]any, error)

type InterfaceMatcher

type InterfaceMatcher struct {
	// contains filtered or unexported fields
}

func NewInterfaceMatcher

func NewInterfaceMatcher(generics []GenericSlot, template []TemplateSlot) InterfaceMatcher

func (InterfaceMatcher) Generics

func (m InterfaceMatcher) Generics() GenericValuation

func (InterfaceMatcher) Match

func (m InterfaceMatcher) Match(ss, ts Interface) error

func (*InterfaceMatcher) MatchGenerics

func (m *InterfaceMatcher) MatchGenerics(gs, ts Interface) error

MatchGenerics attempts to find a generic valuation which transforms gs into ts when the returned valuation is applied to gs via gs.ApplyGenerics

func (*InterfaceMatcher) MatchGenericsGeneric

func (m *InterfaceMatcher) MatchGenericsGeneric(gs, ts GenericInterface) error

func (*InterfaceMatcher) MatchGenericsList

func (m *InterfaceMatcher) MatchGenericsList(gs, ts ListInterface) error

func (*InterfaceMatcher) MatchGenericsMap

func (m *InterfaceMatcher) MatchGenericsMap(gs, ts MapInterface) error

func (*InterfaceMatcher) MatchGenericsNamed

func (m *InterfaceMatcher) MatchGenericsNamed(gs, ts NamedInterface) error

func (*InterfaceMatcher) MatchGenericsPrimitive

func (m *InterfaceMatcher) MatchGenericsPrimitive(gs, ts PrimitiveInterface) error

func (*InterfaceMatcher) MatchGenericsReference

func (m *InterfaceMatcher) MatchGenericsReference(gs, ts ReferenceInterface) error

func (*InterfaceMatcher) MatchTemplate

func (m *InterfaceMatcher) MatchTemplate(gs, ts Interface) error

MatchTemplate attempts to find a template valuation which transforms gs into ts when the returned valuation is applied to gs via gs.ApplyTemplate

func (*InterfaceMatcher) MatchTemplateGeneric

func (m *InterfaceMatcher) MatchTemplateGeneric(gs, ts GenericInterface) error

func (*InterfaceMatcher) MatchTemplateList

func (m *InterfaceMatcher) MatchTemplateList(gs, ts ListInterface) error

func (*InterfaceMatcher) MatchTemplateMap

func (m *InterfaceMatcher) MatchTemplateMap(gs, ts MapInterface) error

func (*InterfaceMatcher) MatchTemplateNamed

func (m *InterfaceMatcher) MatchTemplateNamed(gs, ts NamedInterface) error

func (*InterfaceMatcher) MatchTemplatePrimitive

func (m *InterfaceMatcher) MatchTemplatePrimitive(gs, ts PrimitiveInterface) error

func (*InterfaceMatcher) MatchTemplateReference

func (m *InterfaceMatcher) MatchTemplateReference(gs, ts ReferenceInterface) error

func (InterfaceMatcher) Template

func (m InterfaceMatcher) Template() TemplateValuation

type LayerInfo

type LayerInfo struct {
	// LayerID represents the layer of this info
	LayerID core.ID `json:"layerId"`

	// UserID represents the user for whom this token was issues
	UserID core.ID `json:"userId"`

	// Permissions contains granted, mandatory and exclusive permissions for this layer
	Permissions string `json:"permissions"`
}

type LayerProfile

type LayerProfile map[string]*AccessGroup

LayerProfile maps names of access groups onto group instances.

func NewLayerProfile

func NewLayerProfile() LayerProfile

NewLayerProfile creates a LayerProfile instance.

func ReadLayerProfile

func ReadLayerProfile(profileString string) (LayerProfile, error)

ReadLayerProfile parses a string representation obtained via LayerProfile.String and returns a new LayerProfile instance.

func (*LayerProfile) AddAccessGroup

func (lp *LayerProfile) AddAccessGroup(name string, permissions uint32) (*AccessGroup, error)

AddAccessGroup creates a new access group and attaches it to the LayerProfile instance. If an access group with that name already exists, it will return that instance instead of creating a new one.

func (LayerProfile) GetAccessGroup

func (lp LayerProfile) GetAccessGroup(name string) *AccessGroup

GetAccessGroup returns an access group instance with the given name or nil if it does not exist.

func (LayerProfile) RemoveAccessGroup

func (lp LayerProfile) RemoveAccessGroup(name string)

RemoveAccessGroup removes an access group.

func (LayerProfile) String

func (lp LayerProfile) String() string

String returns a string representation of the layer profile.

type LayerToken

type LayerToken struct {
	LayerID   core.ID       `json:"layer"`
	UserID    core.ID       `json:"user"`
	Created   time.Time     `json:"created"`
	Expiry    time.Duration `json:"expiry"`
	Granted   uint32        `json:"granted"`
	Mandatory uint32        `json:"mandatory"`
	Exclusive uint32        `json:"exclusive"`
	IsAdmin   bool          `json:"admin"`
	Signature core.Binary   `json:"signature"`
	Token     string        `json:"token"`
}

LayerToken is a parsed layer token issued by the VYZE service.

func ReadLayerToken

func ReadLayerToken(tokenString string) (LayerToken, error)

ReadLayerToken parses a token string and returns a new LayerToken instance.

func (LayerToken) Expired

func (lt LayerToken) Expired() bool

Expired returns true if the token has expired.

func (LayerToken) Expires

func (lt LayerToken) Expires() time.Time

Expires returns the time the token expires.

type LayerTokenInfo

type LayerTokenInfo struct {
	// LayerID represents the layer of this token
	LayerID core.ID `json:"layer"`

	// UserID represents the user for whom this token was issued
	UserID core.ID `json:"user"`

	// Granted contains the granted permissions
	Granted uint32 `json:"granted"`

	// Mandatory contains the mandatory permissions
	Mandatory uint32 `json:"mandatory"`

	// Exclusive contains the exclusive permissions
	Exclusive uint32 `json:"exclusive"`

	// Created contains the creation date
	Created int64 `json:"created"`

	// Expiry contains the duration of validity
	Expiry int64 `json:"expiry"`

	// Admin indicates whether this user is an admin
	Admin bool `json:"admin"`
}

type LayerTokens

type LayerTokens struct {
	Tokens []LayerTokenInfo `json:"tokens"`
}

type Library

type Library struct {
	Name        string                    `json:"name" yaml:"name"`
	Filename    string                    `json:"filename" yaml:"filename"`
	Interfaces  map[string]NamedInterface `json:"schemas" yaml:"schemas"`
	Description string                    `json:"description" yaml:"description"`
}

func NewLibrary

func NewLibrary() Library

func (*Library) AddSchema

func (l *Library) AddSchema(schema NamedInterface)

func (*Library) GetSchema

func (l *Library) GetSchema(name string) *NamedInterface

func (Library) JSONSchema

func (l Library) JSONSchema() (json.RawMessage, error)

func (*Library) Load

func (l *Library) Load(filename string)

func (Library) Matches

func (l Library) Matches(s Interface) []Interface

func (*Library) Save

func (l *Library) Save(filename string)

type ListInterface

type ListInterface struct {
	Entry Interface `json:"entry" yaml:"entry"`
}

func (ListInterface) ApplyGenerics

func (s ListInterface) ApplyGenerics(gv GenericValuation) (ListInterface, error)

func (ListInterface) ApplyTemplate

func (s ListInterface) ApplyTemplate(t TemplateValuation) (ListInterface, error)

func (ListInterface) Equals

func (s ListInterface) Equals(s2 ListInterface) bool

func (ListInterface) JSONSchema

func (s ListInterface) JSONSchema(lib *Library) (map[string]any, error)

type ListNode

type ListNode struct {
	Entry     Node       `json:"entry"`
	KeyFormat FormatType `json:"keyFormat,omitempty" yaml:"keyFormat,omitempty"`
	KeyName   string     `json:"keyName,omitempty" yaml:"keyName,omitempty"`
	ValueName string     `json:"valueName,omitempty" yaml:"valueName,omitempty"`
}

ListNode turns a list or a keyed list context into a primitive context

func (ListNode) InterfaceSchema

func (en ListNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type MapInterface

type MapInterface struct {
	Entries []MapInterfaceEntry `json:"entries" yaml:"entries"`
}

func (MapInterface) ApplyGenerics

func (s MapInterface) ApplyGenerics(gv GenericValuation) (MapInterface, error)

func (MapInterface) ApplyTemplate

func (s MapInterface) ApplyTemplate(t TemplateValuation) (MapInterface, error)

func (MapInterface) Equals

func (s MapInterface) Equals(s2 MapInterface) bool

func (MapInterface) GetEntry

func (s MapInterface) GetEntry(name string) (MapInterfaceEntry, bool)

func (MapInterface) JSONSchema

func (s MapInterface) JSONSchema(lib *Library) (map[string]any, error)

type MapInterfaceEntry

type MapInterfaceEntry struct {
	Key       TemplateString     `json:"key" yaml:"key"`
	Expansion *TemplateExpansion `json:"expansion,omitempty" yaml:"expansion,omitempty"`
	Schema    Interface          `json:"schema" yaml:"schema"`
}

func (MapInterfaceEntry) ApplyGenerics

func (MapInterfaceEntry) ApplyTemplate

type MapNode

type MapNode struct {
	Entries []MapNodeEntry `json:"entries"`
}

MapNode turns a primitive context into a map of multiple primitive contexts

func (MapNode) GetEntry

func (en MapNode) GetEntry(name string) *MapNodeEntry

func (MapNode) InterfaceSchema

func (en MapNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type MapNodeEntry

type MapNodeEntry struct {
	Name string `json:"name" yaml:"name"`
	Node Node   `json:"node" yaml:"node"`
}

type MappingType

type MappingType string

MappingType specifies how multiple relations should be mapped onto or from JSON values.

const (
	MappingTypePrimitive MappingType = "primitive"
	MappingTypeList      MappingType = "list"
)

type MessageEvent

type MessageEvent struct {
	Event json.RawMessage `json:"event"`
}

type MessageInfo

type MessageInfo struct {
	// APIVersion represents the API version
	APIVersion string `json:"apiVersion"`

	// ServerVersion represents the version of the server
	ServerVersion string `json:"serverVersion"`

	// UnixTime contains the server time
	UnixTime int64 `json:"unixTime"`

	// Session provides information about the session
	Session SessionInfo `json:"session"`

	// Subscriptions contains the number of currently open subscriptions
	Subscriptions int `json:"subscriptions"`
}

type MessageSubscribe

type MessageSubscribe struct {
	Event  EventType                `json:"event"`
	Params StreamSubscriptionParams `json:"params"`
}

MessageSubscribe binds a stream message and stream subscription request together

type NamedInterface

type NamedInterface struct {
	ID       core.ID        `json:"id" yaml:"id"`
	Name     string         `json:"name" yaml:"name"`
	Template []TemplateSlot `json:"template,omitempty" yaml:"template,omitempty"`
	Generics []GenericSlot  `json:"generics,omitempty" yaml:"generics,omitempty"`
	Schema   Interface      `json:"schema" yaml:"schema"`
}

func (NamedInterface) ApplyGenerics

func (s NamedInterface) ApplyGenerics(gv GenericValuation) (NamedInterface, error)

func (NamedInterface) ApplyTemplate

func (s NamedInterface) ApplyTemplate(t TemplateValuation) (NamedInterface, error)

func (NamedInterface) Equals

func (s NamedInterface) Equals(s2 NamedInterface) bool

func (NamedInterface) JSONSchema

func (s NamedInterface) JSONSchema(lib *Library) (map[string]any, error)

type Node

type Node struct {
	Type      NodeType       `json:"type"`
	Endpoint  *EndpointNode  `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
	Reference *ReferenceNode `json:"reference,omitempty" yaml:"reference,omitempty"`
	Context   *ContextNode   `json:"context,omitempty" yaml:"context,omitempty"`
	Relation  *RelationNode  `json:"relation,omitempty" yaml:"relation,omitempty"`
	Specials  *SpecialsNode  `json:"specials,omitempty" yaml:"specials,omitempty"`
	Value     *ValueNode     `json:"value,omitempty" yaml:"value,omitempty"`
	Instance  *InstanceNode  `json:"instance,omitempty" yaml:"instance,omitempty"`
	Group     *GroupNode     `json:"group,omitempty" yaml:"group,omitempty"`
	List      *ListNode      `json:"list,omitempty" yaml:"list,omitempty"`
	Filter    *FilterNode    `json:"filter,omitempty" yaml:"filter,omitempty"`
	Sort      *SortNode      `json:"sort,omitempty" yaml:"sort,omitempty"`
	Slice     *SliceNode     `json:"slice,omitempty" yaml:"slice,omitempty"`
	Aggregate *AggregateNode `json:"aggregate,omitempty" yaml:"aggregate,omitempty"`
	Map       *MapNode       `json:"map,omitempty" yaml:"map,omitempty"`
}

func (Node) InterfaceSchema

func (n Node) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

func (Node) Resolve

func (n Node) Resolve(universe Universe) (Node, error)

type NodeType

type NodeType string

NodeType defines the type of node

const (
	NodeTypeEndpoint  NodeType = "endpoint"
	NodeTypeContext   NodeType = "context"
	NodeTypeRelation  NodeType = "relation"
	NodeTypeSpecials  NodeType = "specials"
	NodeTypeValue     NodeType = "value"
	NodeTypeInstance  NodeType = "instance"
	NodeTypeGroup     NodeType = "group"
	NodeTypeList      NodeType = "list"
	NodeTypeFilter    NodeType = "filter"
	NodeTypeSort      NodeType = "sort"
	NodeTypeSlice     NodeType = "slice"
	NodeTypeAggregate NodeType = "aggregate"
	NodeTypeMap       NodeType = "map"
	NodeTypeReference NodeType = "reference"
)

type Object

type Object struct {
	ID      core.ID `json:"id"`
	Name    string  `json:"name"`
	Created int64   `json:"created"`
	User    core.ID `json:"user"`
}

type OperatorType

type OperatorType string

OperatorType defines the operator to be used for filters

const (
	OperatorTypeEqual        OperatorType = "eq"
	OperatorTypeGreater      OperatorType = "gt"
	OperatorTypeGreaterEqual OperatorType = "ge"
	OperatorTypeLess         OperatorType = "lt"
	OperatorTypeLessEqual    OperatorType = "le"
	OperatorTypeNotEqual     OperatorType = "ne"
)

type Order

type Order struct {
	Source     ValueSource `json:"source"`
	Descending bool        `json:"descending"`
}

type Parameter

type Parameter struct {
	Name        string    `json:"name" yaml:"name"`
	Description string    `json:"description" yaml:"description"`
	Interface   Interface `json:"interface" yaml:"interface"`
}

type PermTriple

type PermTriple [3]Permission

func ParsePermTriple

func ParsePermTriple(str string) PermTriple

func (PermTriple) Bytes

func (t PermTriple) Bytes() []byte

func (PermTriple) Equal

func (t PermTriple) Equal(other PermTriple) bool

func (PermTriple) MarshalJSON

func (t PermTriple) MarshalJSON() ([]byte, error)

func (PermTriple) String

func (t PermTriple) String() string

func (*PermTriple) UnmarshalJSON

func (t *PermTriple) UnmarshalJSON(b []byte) error

type Permission

type Permission uint32

func ParsePermission

func ParsePermission(str string) Permission

func (Permission) Bytes

func (p Permission) Bytes() []byte

func (Permission) String

func (p Permission) String() string

type Permissions

type Permissions map[core.ID]PermTriple

func (Permissions) MarshalJSON

func (t Permissions) MarshalJSON() ([]byte, error)

func (*Permissions) UnmarshalJSON

func (t *Permissions) UnmarshalJSON(b []byte) error

type PrimitiveInterface

type PrimitiveInterface struct {
	Model string        `json:"model,omitempty" yaml:"model,omitempty"`
	Value PrimitiveType `json:"value" yaml:"value"`
}

func (PrimitiveInterface) ApplyGenerics

func (PrimitiveInterface) ApplyTemplate

func (PrimitiveInterface) Equals

func (PrimitiveInterface) JSONSchema

func (s PrimitiveInterface) JSONSchema(lib *Library) (map[string]any, error)

type PrimitiveType

type PrimitiveType string
const (
	PrimitiveTypeVoid    PrimitiveType = "void"
	PrimitiveTypeID      PrimitiveType = "id"
	PrimitiveTypeString  PrimitiveType = "string"
	PrimitiveTypeInteger PrimitiveType = "integer"
	PrimitiveTypeFloat   PrimitiveType = "float"
	PrimitiveTypeBoolean PrimitiveType = "boolean"
)

type PutNodeRequest

type PutNodeRequest struct {
	Node  Node    `json:"node"`
	Value any     `json:"value"`
	Layer core.ID `json:"layer"`
}

type PutResourceRequest

type PutResourceRequest struct {
	ObjectID core.ID        `json:"objectId"`
	Object   ResourceType   `json:"object"`
	Schema   ResourceSchema `json:"schema"`
	Value    any            `json:"value"`
	Layer    core.ID        `json:"layer"`
}

type ReferenceInterface

type ReferenceInterface struct {
	Generics GenericValuation  `json:"generics,omitempty" yaml:"generics,omitempty"`
	Template TemplateValuation `json:"template,omitempty" yaml:"template,omitempty"`
	Name     string            `json:"name" yaml:"name"`
}

func (ReferenceInterface) ApplyGenerics

func (ReferenceInterface) ApplyTemplate

func (ReferenceInterface) Equals

func (ReferenceInterface) JSONSchema

func (s ReferenceInterface) JSONSchema(lib *Library) (map[string]any, error)

type ReferenceNode

type ReferenceNode struct {
	Name string `json:"name"`
}

ReferenceNode is replaced by its reference, thereby accepting and producing the same contexts as the referenced node

func (ReferenceNode) InterfaceSchema

func (en ReferenceNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type RelationNode

type RelationNode struct {
	Type     EnvironmentType `json:"type" yaml:"type"`
	Relation string          `json:"relation" yaml:"relation"`
	Reverse  bool            `json:"reverse" yaml:"reverse"`
	Node     Node            `json:"node" yaml:"node"`

	PutAdd        bool `json:"putAdd" yaml:"putAdd"`
	PutDuplicates bool `json:"putDuplicates" yaml:"putDuplicates"`
}

func (RelationNode) InterfaceSchema

func (en RelationNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type Resolver

type Resolver interface {
	Resolve(ident string, base string) core.ID
}

A Resolver maps identifiers onto object IDs

type ResourceCallback

type ResourceCallback func(message StreamResourceEvent)

type ResourceField

type ResourceField struct {
	// Name is the name of the field as it appears in the
	Name string `json:"name"`

	// Relation is the ID or the identifier of the relation of this field
	Relation *string `json:"relation,omitempty"`

	// Mapping is the type of mapping for this field
	Mapping MappingType `json:"mapping"`

	// MappingParams are the parameters of the mapping specified in Mapping
	MappingParams map[string]any `json:"mappingParams,omitempty"`

	// Field is the type of this field
	Field FieldType `json:"field"`

	// Format is the format used for the values carried by this field
	Format FormatType `json:"format"`
}

ResourceField represents a key in the JSON object to be rendered to or from a ResourceSchema.

func (ResourceField) GetMappingParam

func (f ResourceField) GetMappingParam(key string, def string) any

func (*ResourceField) SetMappingParam

func (f *ResourceField) SetMappingParam(key string, val any)

type ResourceFilter

type ResourceFilter struct {
	Name     string       `json:"name"`
	Value    interface{}  `json:"value"`
	Operator OperatorType `json:"operator"`
}

type ResourceFilters

type ResourceFilters []ResourceFilter

type ResourceInstance

type ResourceInstance struct {
	ObjectID core.ID        `json:"objectId"`
	Schema   ResourceSchema `json:"schema"`
}

ResourceInstance represents a resource object for single instances.

func NewResourceInstance

func NewResourceInstance(id core.ID, schema *ResourceSchema) *ResourceInstance

NewResourceInstance creates a new resource object for single instances.

type ResourceMapping

type ResourceMapping struct {
	ValueType   MappingType
	ValueParams map[string]any
}

ResourceMapping represents the type of mapping used to map object or relation field values onto a JSON object.

func NewListMapping

func NewListMapping() ResourceMapping

func NewPrimitiveMapping

func NewPrimitiveMapping() ResourceMapping

func (*ResourceMapping) Set

func (rm *ResourceMapping) Set(key string, value any) *ResourceMapping

type ResourceOptions

type ResourceOptions struct {
	Instant  bool `json:"instant"`
	Interval int  `json:"interval"`
}

type ResourceOrder

type ResourceOrder struct {
	Name      string `json:"name"`
	Ascending bool   `json:"ascending"`
}

type ResourceOrders

type ResourceOrders []ResourceOrder

type ResourceSchema

type ResourceSchema struct {
	Fields []ResourceField `json:"fields"`
}

ResourceSchema represents a mapping between JSON objects and VYZE objects.

func ExtractSchema

func ExtractSchema(obj any, resolver Resolver, base string) (ResourceSchema, error)

ExtractSchema extracts a ResourceSchema instance from a go structure.

func MustExtractSchema

func MustExtractSchema(obj any, univ *Universe, base string) *ResourceSchema

MustExtractSchema behaves like ExtractSchema but panics in case of an error.

func NewResourceSchema

func NewResourceSchema() *ResourceSchema

NewResourceSchema creates a new ResourceSchema instance.

func (*ResourceSchema) AddObjectField

func (r *ResourceSchema) AddObjectField(name string, fieldType FieldType, formatType FormatType) *ResourceSchema

AddObjectField attaches a new object field to the resource schema.

func (*ResourceSchema) AddRelationField

func (r *ResourceSchema) AddRelationField(name string, relation string, fieldType FieldType, formatType FormatType, mapping ResourceMapping) *ResourceSchema

AddRelationField attaches a new relation field to the resource schema.

func (ResourceSchema) GetField

func (r ResourceSchema) GetField(name string) *ResourceField

GetField returns a field of this schema identified by its name.

func (*ResourceSchema) Resolve

func (r *ResourceSchema) Resolve(resolver Resolver, base string) error

type ResourceSpecials

type ResourceSpecials struct {
	ObjectID core.ID         `json:"objectId"`
	Schema   ResourceSchema  `json:"schema"`
	Filter   ResourceFilters `json:"filter,omitempty"`
	Order    ResourceOrders  `json:"order,omitempty"`
	Offset   *int            `json:"offset,omitempty"`
	Limit    *int            `json:"limit,omitempty"`
}

ResourceSpecials represents a resource object for lists of instances.

func NewResourceSpecials

func NewResourceSpecials(id core.ID, schema *ResourceSchema) *ResourceSpecials

NewResourceSpecials creates a new resource object for lists of instances.

func (*ResourceSpecials) AddFilter

func (rs *ResourceSpecials) AddFilter(name string, value any, operatorType OperatorType) *ResourceSpecials

AddFilter attaches a filter to the resource object.

func (*ResourceSpecials) AddOrder

func (rs *ResourceSpecials) AddOrder(name string, ascending bool) *ResourceSpecials

AddOrder attaches an order to the resource object.

func (*ResourceSpecials) SetLimit

func (rs *ResourceSpecials) SetLimit(limit int) *ResourceSpecials

SetLimit sets the limit for the resource object ensuring no more than limit instances are returned.

func (*ResourceSpecials) SetOffset

func (rs *ResourceSpecials) SetOffset(offset int) *ResourceSpecials

SetOffset sets the offset for the resource object.

type ResourceStreamInstance

type ResourceStreamInstance struct {
	// contains filtered or unexported fields
}

func (*ResourceStreamInstance) Subscribe

func (sub *ResourceStreamInstance) Subscribe(cb ResourceCallback)

func (*ResourceStreamInstance) Value

func (sub *ResourceStreamInstance) Value() any

type ResourceStreamList

type ResourceStreamList struct {
	// contains filtered or unexported fields
}

func (*ResourceStreamList) GetValue

func (sub *ResourceStreamList) GetValue(id core.ID) any

func (*ResourceStreamList) Subscribe

func (sub *ResourceStreamList) Subscribe(cb ResourceCallback)

func (*ResourceStreamList) Values

func (sub *ResourceStreamList) Values() []any

type ResourceType

type ResourceType string

ResourceType specifies the type of source of one or multiple instances.

const (
	ResourceTypeSpecials ResourceType = "specials"
	ResourceTypeInstance ResourceType = "instance"
)

type ReturnType

type ReturnType string

ReturnType specifies how data from multiple relations should be returned.

const (
	ReturnTypeObjects        ReturnType = "objects"
	ReturnTypeRelations      ReturnType = "relations"
	ReturnTypePairs          ReturnType = "pairs"
	ReturnTypeMap            ReturnType = "map"
	ReturnTypeKeyedObjects   ReturnType = "keyed_objects"
	ReturnTypeKeyedRelations ReturnType = "keyed_relations"
	ReturnTypeKeyedPairs     ReturnType = "keyed_pairs"
)

type SchemaType

type SchemaType string
const (
	SchemaTypeNamed     SchemaType = "named"
	SchemaTypePrimitive SchemaType = "primitive"
	SchemaTypeMap       SchemaType = "map"
	SchemaTypeList      SchemaType = "list"
	SchemaTypeGeneric   SchemaType = "generic"
	SchemaTypeReference SchemaType = "reference"
)

type SessionInfo

type SessionInfo struct {
	Created  time.Time `json:"created"`
	RsvCmds  int       `json:"commandsReceived"`
	RsvBytes int       `json:"bytesReceived"`
	RsvLast  time.Time `json:"lastReceived"`
	SntCmds  int       `json:"commandsSent"`
	SntBytes int       `json:"bytesSent"`
	SntLast  time.Time `json:"lastSent"`
}

type SliceNode

type SliceNode struct {
	Offset *int `json:"offset,omitempty" yaml:"offset,omitempty"`
	Limit  *int `json:"limit,omitempty" yaml:"limit,omitempty"`
	Node   Node `json:"node"`
}

SliceNode modifies a list or a keyed list context by taking a slice of successive elements from the list

func (SliceNode) InterfaceSchema

func (en SliceNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type SortNode

type SortNode struct {
	Order Order `json:"order"`
	Node  Node  `json:"node"`
}

SortNode modifies a list or a keyed list context by changing the order of elements

func (SortNode) InterfaceSchema

func (en SortNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type SourceType

type SourceType string
const (
	SourceTypeNode SourceType = "node"
	SourceTypeKey  SourceType = "key"
)

type SpecialsNode

type SpecialsNode struct {
	Type     EnvironmentType `json:"type" yaml:"type"`
	Direct   bool            `json:"direct" yaml:"direct"`
	Indirect bool            `json:"indirect" yaml:"indirect"`
	Node     Node            `json:"node" yaml:"node"`
}

func (SpecialsNode) InterfaceSchema

func (en SpecialsNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type StreamLayerTokens

type StreamLayerTokens struct {
	Tokens []string `json:"tokens"`
}

type StreamMessage

type StreamMessage struct {
	// MessageID is the core.ID of this message
	MessageID core.ID `json:"messageId"`

	// ReferenceID is the core.ID of the referenced message
	ReferenceID core.ID `json:"referenceId"`

	// Command is the type of the message
	Command CmdType `json:"command"`

	// Payload contains the command-specific parameters
	Payload json.RawMessage `json:"payload"`
}

type StreamResourceEvent

type StreamResourceEvent struct {
	ID      core.ID     `json:"id"`
	Type    ChangeType  `json:"type"`
	Removed interface{} `json:"removed,omitempty"`
	Added   interface{} `json:"added,omitempty"`
}

type StreamResourceParams

type StreamResourceParams struct {
	Object ResourceType    `json:"object"`
	Schema ResourceSchema  `json:"schema"`
	Filter ResourceFilters `json:"filter,omitempty"`
}

type StreamSubscriptionParams

type StreamSubscriptionParams struct {
	Object   core.ID         `json:"object"`
	Specials bool            `json:"specials"`
	Payload  bool            `json:"payload"`  // Payload specifies if payload should be included in triggered events
	Instant  bool            `json:"instant"`  // Instant specifies if the current state should instantly be transmitted
	Interval int             `json:"interval"` // Interval specifies how long changes should be collected before firing an update
	Params   json.RawMessage `json:"params"`
}

StreamSubscriptionParams contains generic parameters

type StreamUnsubscribe

type StreamUnsubscribe struct{}

type StructTemplateType

type StructTemplateType string
const (
	TemplateTypePrimitive StructTemplateType = "primitive"
	TemplateTypeList      StructTemplateType = "list"
)

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

func (*Subscription) Subscribe

func (sub *Subscription) Subscribe(cb Callback)

type SystemClient

type SystemClient struct {
	// contains filtered or unexported fields
}

func NewSystemClient

func NewSystemClient(endpoint string) *SystemClient

func (*SystemClient) CreateKeyedRelation

func (c *SystemClient) CreateKeyedRelation(originID core.ID, targetID core.ID, abstractIDs core.IDSet, name string, key any, keyFormat FormatType, accessName string, options *AccessOptions) (Object, error)

func (*SystemClient) CreateLayer added in v0.0.14

func (c *SystemClient) CreateLayer(abstractIDs core.IDSet, name string, options *AccessOptions) (Object, error)

func (*SystemClient) CreateObject

func (c *SystemClient) CreateObject(abstractIDs core.IDSet, name string, accessName string, options *AccessOptions) (Object, error)

func (*SystemClient) CreateRelation

func (c *SystemClient) CreateRelation(originID core.ID, targetID core.ID, abstractIDs core.IDSet, name string, accessName string, options *AccessOptions) (Object, error)

func (*SystemClient) DeleteData

func (c *SystemClient) DeleteData(id core.ID, options *AccessOptions) error

func (*SystemClient) DeleteObject

func (c *SystemClient) DeleteObject(id core.ID, options *AccessOptions) error

func (*SystemClient) GetAbstracts

func (c *SystemClient) GetAbstracts(id core.ID, self bool, direct bool, indirect bool, options *AccessOptions) (core.IDSet, error)

func (*SystemClient) GetData

func (c *SystemClient) GetData(id core.ID, formatType FormatType, options *AccessOptions) (any, error)

func (*SystemClient) GetInfo

func (c *SystemClient) GetInfo(options *AccessOptions) (Info, error)

func (*SystemClient) GetName

func (c *SystemClient) GetName(id core.ID, options *AccessOptions) (string, error)

func (*SystemClient) GetNode

func (c *SystemClient) GetNode(node Node, options *AccessOptions) (any, error)

func (*SystemClient) GetObject

func (c *SystemClient) GetObject(id core.ID, options *AccessOptions) (Object, error)

func (*SystemClient) GetResourceInstance

func (c *SystemClient) GetResourceInstance(resource *ResourceInstance, options *AccessOptions) (any, error)

GetResourceInstance returns a value specified by the resource parameter.

func (*SystemClient) GetResourceList

func (c *SystemClient) GetResourceList(resource *ResourceSpecials, options *AccessOptions) ([]any, error)

GetResourceList returns a slice of values specified by the resource parameter.

func (*SystemClient) GetSpecials

func (c *SystemClient) GetSpecials(id core.ID, self bool, direct bool, indirect bool, options *AccessOptions) (core.IDSet, error)

func (*SystemClient) LayerProfile

func (c *SystemClient) LayerProfile() *LayerProfile

func (*SystemClient) PutNode

func (c *SystemClient) PutNode(node Node, value any, accessName string, options *AccessOptions) (any, error)

func (*SystemClient) PutResourceInstance

func (c *SystemClient) PutResourceInstance(resource *ResourceInstance, value any, accessName string, options *AccessOptions) (core.ID, error)

func (*SystemClient) PutResourceSpecials

func (c *SystemClient) PutResourceSpecials(resource *ResourceSpecials, values any, accessName string, options *AccessOptions) (core.IDList, error)

func (*SystemClient) SetData

func (c *SystemClient) SetData(id core.ID, value any, formatType FormatType, options *AccessOptions) error

func (*SystemClient) SetDefaultOptions

func (c *SystemClient) SetDefaultOptions(options *AccessOptions)

func (*SystemClient) SetLayerProfile

func (c *SystemClient) SetLayerProfile(layerProfile LayerProfile)

func (*SystemClient) SetName

func (c *SystemClient) SetName(id core.ID, name string, options *AccessOptions) error

func (*SystemClient) VerifyToken

func (c *SystemClient) VerifyToken(token string) (LayerTokenInfo, error)

type SystemStreamClient

type SystemStreamClient struct {
	// contains filtered or unexported fields
}

func NewSystemStreamClient

func NewSystemStreamClient(endpoint string) *SystemStreamClient

func (*SystemStreamClient) Connect

func (sc *SystemStreamClient) Connect() error

func (*SystemStreamClient) Connected

func (sc *SystemStreamClient) Connected() bool

func (*SystemStreamClient) Disconnect

func (sc *SystemStreamClient) Disconnect() error

func (*SystemStreamClient) GetResourceInstance

func (sc *SystemStreamClient) GetResourceInstance(resource *ResourceInstance, options ResourceOptions) (*ResourceStreamInstance, error)

func (*SystemStreamClient) GetResourceList

func (sc *SystemStreamClient) GetResourceList(resource *ResourceSpecials, options ResourceOptions) (*ResourceStreamList, error)

func (*SystemStreamClient) Info

func (sc *SystemStreamClient) Info() (chan MessageInfo, error)

func (*SystemStreamClient) LayerTokens

func (sc *SystemStreamClient) LayerTokens() (chan LayerTokens, error)

func (*SystemStreamClient) RegisterLayerProfile

func (sc *SystemStreamClient) RegisterLayerProfile(profile LayerProfile) error

func (*SystemStreamClient) RegisterLayerToken

func (sc *SystemStreamClient) RegisterLayerToken(token LayerToken) error

type TemplateExpansion

type TemplateExpansion struct {
	// Source must point to a template list value
	Source string

	// Target points to a new template primitive value
	Target string
}

type TemplateSlot

type TemplateSlot struct {
	Name        string             `json:"name" yaml:"name"`
	Type        StructTemplateType `json:"type" yaml:"type"`
	Description string             `json:"description" yaml:"description"`
}

type TemplateString

type TemplateString string

func (TemplateString) Apply

Apply replaces placeholders with values from the template provided

func (TemplateString) Resolved

func (t TemplateString) Resolved() bool

Resolved tells whether this template string has been properly resolved, i.e. does not contain placeholders

type TemplateValuation

type TemplateValuation map[string]TemplateValue

func (TemplateValuation) Apply

Apply returns a new template where all source values of the template are fetched from the sources template

func (TemplateValuation) Camel

func (t TemplateValuation) Camel() string

Camel creates a string in pascal case suited to become part of a struct name

func (TemplateValuation) Copy

Copy returns a copy of the template

func (TemplateValuation) Expand

Expand creates a template for each value in the value list

type TemplateValue

type TemplateValue struct {
	Type   StructTemplateType `json:"type" yaml:"type"`
	Value  any                `json:"value,omitempty" yaml:"value,omitempty"`
	Source string             `json:"source,omitempty" yaml:"source,omitempty"`
}

func (TemplateValue) Apply

func (tv TemplateValue) Apply(template TemplateValuation) TemplateValue

Apply fetches the value for the template value from the given template

func (TemplateValue) Camel

func (tv TemplateValue) Camel() string

Camel returns a camel case representation of the template value

type Universe

type Universe struct {
	ID           core.ID               `json:"id" yaml:"id"`
	Name         string                `json:"name" yaml:"name"`
	Description  string                `json:"description" yaml:"description"`
	Bases        []string              `json:"bases" yaml:"bases"`
	Dependencies []string              `json:"dependencies" yaml:"dependencies"`
	Identifiers  []UniverseIdentifier  `json:"objects" yaml:"objects"`
	Models       []UniverseObjectInfo  `json:"info" yaml:"info"`
	Relations    []UniverseRelation    `json:"relations" yaml:"relations"`
	Abstractions []UniverseAbstraction `json:"abstractions" yaml:"abstractions"`
	Endpoints    []EndpointNode        `json:"endpoints" yaml:"endpoints"`
	Interfaces   []NamedInterface      `json:"interfaces" yaml:"interfaces"`
}

A Universe serves as universal exchange format and captures a subpart of the VYZE graph

func (*Universe) AbstractsOf

func (rf *Universe) AbstractsOf(ri UniverseIdentifier) map[string]bool

func (*Universe) Clean

func (rf *Universe) Clean()

func (*Universe) Copy

func (rf *Universe) Copy(base string, bases bool, deps bool, objects bool) Universe

func (*Universe) Dump

func (rf *Universe) Dump(w io.Writer, compressed bool) error

func (*Universe) DumpFile

func (rf *Universe) DumpFile(filepath string) error

func (*Universe) Extend

func (rf *Universe) Extend(base string) Universe

Extend transform the universe file into an extension

func (*Universe) GetEndpoint

func (rf *Universe) GetEndpoint(name string) *EndpointNode

func (*Universe) GetInterface

func (rf *Universe) GetInterface(name string) *NamedInterface

func (*Universe) GetModel

func (rf *Universe) GetModel(ident string, base string) *UniverseObjectInfo

func (*Universe) GetOrigin

func (rf *Universe) GetOrigin(model UniverseIdentifier) *UniverseIdentifier

func (*Universe) GetTarget

func (rf *Universe) GetTarget(model UniverseIdentifier) *UniverseIdentifier

func (*Universe) HasAbstract

func (rf *Universe) HasAbstract(model UniverseIdentifier, abs UniverseIdentifier) bool

func (*Universe) JSONSchema

func (rf *Universe) JSONSchema() (json.RawMessage, error)

func (*Universe) Library

func (rf *Universe) Library() Library

func (*Universe) Load

func (rf *Universe) Load(r io.Reader, compressed bool) error

func (*Universe) LoadFile

func (rf *Universe) LoadFile(filepath string) error

func (*Universe) Resolve

func (rf *Universe) Resolve(ident string, base string) core.ID

type UniverseAbstraction

type UniverseAbstraction struct {
	Abstract UniverseIdentifier `json:"abstract" yaml:"abstract"`
	Special  UniverseIdentifier `json:"special" yaml:"special"`
}

func ParseUniverseFileAbstraction

func ParseUniverseFileAbstraction(str string) (ri UniverseAbstraction)

func (UniverseAbstraction) MarshalYAML

func (ri UniverseAbstraction) MarshalYAML() (interface{}, error)

func (*UniverseAbstraction) UnmarshalYAML

func (ri *UniverseAbstraction) UnmarshalYAML(value *yaml.Node) error

type UniverseIdentifier

type UniverseIdentifier struct {
	// Base is the base universe to which this object belongs
	Base string `json:"universe,omitempty" yaml:"universe,omitempty"`

	// Name is the name of the object
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// Target indicates if this object is inside or outside the universe
	Target string `json:"base,omitempty" yaml:"base,omitempty"`
}

func ParseUniverseObjectIdentifier

func ParseUniverseObjectIdentifier(str string) (ri UniverseIdentifier)

func (UniverseIdentifier) Canonical

func (ri UniverseIdentifier) Canonical(base string, target string) string

func (UniverseIdentifier) Equals

func (UniverseIdentifier) MarshalJSON

func (ri UniverseIdentifier) MarshalJSON() ([]byte, error)

func (UniverseIdentifier) MarshalYAML

func (ri UniverseIdentifier) MarshalYAML() (interface{}, error)

func (UniverseIdentifier) String

func (ri UniverseIdentifier) String() string

func (*UniverseIdentifier) UnmarshalJSON

func (ri *UniverseIdentifier) UnmarshalJSON(b []byte) error

func (*UniverseIdentifier) UnmarshalYAML

func (ri *UniverseIdentifier) UnmarshalYAML(value *yaml.Node) error

type UniverseObjectInfo

type UniverseObjectInfo struct {
	// Mapping contains the identifier
	Mapping UniverseIdentifier `json:"mapping" yaml:"mapping"`

	// Type specifies whether this object is a model, relation or data type
	Type string `json:"type,omitempty" yaml:"type,omitempty"`

	// ObjectID contains the ID of the associated object
	ObjectID *core.ID `json:"object,omitempty" yaml:"object,omitempty"`

	// Description contains the description of the model
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type UniverseRelation

type UniverseRelation struct {
	Relation UniverseIdentifier `json:"relation" yaml:"relation"`
	Origin   UniverseIdentifier `json:"origin" yaml:"origin"`
	Target   UniverseIdentifier `json:"target" yaml:"target"`
}

func ParseUniverseFileRelation

func ParseUniverseFileRelation(str string) (ri UniverseRelation)

func (UniverseRelation) MarshalYAML

func (ri UniverseRelation) MarshalYAML() (interface{}, error)

func (*UniverseRelation) UnmarshalYAML

func (ri *UniverseRelation) UnmarshalYAML(value *yaml.Node) error

type ValueNode

type ValueNode struct {
	Field  FieldType  `json:"field"`
	Format FormatType `json:"format"`
}

ValueNode turns a primitive context into a single value, based on direct information (id, name, value, user, ...) about the context value

func (ValueNode) InterfaceSchema

func (en ValueNode) InterfaceSchema(universe *Universe, environment Environment) (Interface, error)

type ValueSource

type ValueSource struct {
	Type   SourceType `json:"type" yaml:"type"`
	Format FormatType `json:"format" yaml:"format"`
	Node   *Node      `json:"node" yaml:"node"`
}

Jump to

Keyboard shortcuts

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