schemas

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructDAG

func ConstructDAG(fileDescriptor *desc.FileDescriptor, subject string) (nodes map[string]Node, err error)

func MergeDAGs

func MergeDAGs(dags []map[string]Node) map[string]Node

func Subject

func Subject(topic string, section Section) string

Subject returns the subject given a topic and a section (key or value).

Types

type DAGsBuilder

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

func NewDAGsBuilder

func NewDAGsBuilder() *DAGsBuilder

func (*DAGsBuilder) AddDag

func (d *DAGsBuilder) AddDag(fileDescriptor *desc.FileDescriptor, subject string) error

func (*DAGsBuilder) Records

func (d *DAGsBuilder) Records() (records Records, err error)

type Entries

type Entries []Entry

type Entry

type Entry struct {
	Topic    string
	Section  Section
	Filepath string
}

type Node

type Node struct {
	Subject    string
	Descriptor *desc.FileDescriptor
	References []string
	// Is this node a dependency of another node?
	Dependency bool
	// Level in the graph
	Level int
	// LevelHash contains the hash of the subject + filepath of the content so we can make the level unique
	// in order to achieve a stable sort
	// We use subject + filepath because in the same level we might have the same file twice one having the
	// subject being the topic name and the other being the filepath itself, which could lead to the same hash.
	LevelHash uint32
}

func GetDepOrder

func GetDepOrder(nodes map[string]Node) []Node

GetDepOrder returns a list of Nodes in order they should be inserted.

type Record

type Record struct {
	Subject    string
	Schema     string
	References []string
}

type Records

type Records []Record

func BuildRecords

func BuildRecords(storer store.Storer, entries Entries) (records Records, err error)

BuildRecords takes a list of entries and a storer and compiles a list of records.

func GetResults

func GetResults(nodeList []Node) (Records, error)

type Section

type Section string
const (
	SectionKey   Section = "key"
	SectionValue Section = "value"
)

Jump to

Keyboard shortcuts

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