parser

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Relations map[string]*Relation `json:"relations" yaml:"relations"`
	Metadata  Metadata             `json:"metadata" yaml:"metadata"`
}

type EntityMap

type EntityMap map[string]*Entity

type Metadata

type Metadata struct {
	Comment    string                 `json:"comment" yaml:"comment"`
	Attributes map[string]interface{} `json:"attributes" yaml:"attributes"`
}

type ParsedSchema

type ParsedSchema struct {
	Entities   EntityMap `json:"entities" yaml:"entities"`
	SchemaHash string    `json:"schemaHash" yaml:"schemaHash"`
	Warnings   []string  `json:"warnings,omitempty" yaml:"warnings,omitempty"`
}

func Parse

func Parse(zedFile string) (ret *ParsedSchema, err error)

Parse parses the provided zedFile and returns a mapping of the definitions it contains.

err will be non-nil if an error occurs while opening or compiling the schema file

type Relation

type Relation struct {
	Type                   string          `json:"type" yaml:"type"`
	Metadata               Metadata        `json:"metadata" yaml:"metadata"`
	DownstreamPermissions  []RelationTuple `json:"downstreamPermissions,omitempty" yaml:"downstreamPermissions,omitempty"`
	AllowedDirectRelations []RelationTuple `json:"allowedDirectRelations,omitempty" yaml:"allowedDirectRelations,omitempty"`
}

type RelationTuple

type RelationTuple struct {
	Entity   string `json:"entity" yaml:"entity"`
	Relation string `json:"relation,omitempty" yaml:"relation,omitempty"`
}

Jump to

Keyboard shortcuts

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