pathbuilder

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: AGPL-3.0 Imports: 1 Imported by: 1

Documentation

Overview

Package Pathbuilder defines Pathbuilder

Package pathbuilder provides the Pathbuilder and related classes

Index

Constants

View Source
const DatatypeEmpty = "empty"

Variables

This section is empty.

Functions

func EqualBundles

func EqualBundles(left, right *Bundle) bool

EqualBundles checks if two bundles are equal. Bundles are equal if they are both nil, or if their machine names are equal.

Types

type Bundle

type Bundle struct {
	// Path represents the path of this object
	Path

	Parent       *Bundle   // Parent Bundle (if any)
	ChildBundles []*Bundle // Children of this Bundle
	ChildFields  []Field   // Fields in this Bundle
	// contains filtered or unexported fields
}

Bundle represents a class of objects

func (Bundle) AllFields

func (bundle Bundle) AllFields() []Field

func (Bundle) Bundle

func (bundle Bundle) Bundle(machine string) *Bundle

Bundle returns the bundle with the given machine name. If such a bundle does not exists, returns nil.

func (Bundle) Bundles

func (bundle Bundle) Bundles() []*Bundle

Bundles returns an ordered list of child bundles. Bundles are ordered by their weight.

func (Bundle) Field

func (bundle Bundle) Field(id string) Field

Field returns the field with the given id. if the field does not exist, it returns the empty field.

func (Bundle) Fields

func (bundle Bundle) Fields() []Field

Fields

func (Bundle) IsToplevel

func (bundle Bundle) IsToplevel() bool

IsToplevel checks if this bundle is toplevel

func (Bundle) Paths

func (bundle Bundle) Paths() []Path

Paths recursively returns all paths in this in this bundle

type Field

type Field struct {
	Path
}

Field represents a field in the Pathbuilder

type Path

type Path struct {
	ID   string // Identifier of this path
	UUID string // UUID of this path

	Weight  int  // Display Order in the frontend
	Enabled bool // Is the path enabled or not

	IsGroup bool // Is this path a group or a field?

	GroupID string // Identifier of the group this path belongs to
	Bundle  string // Identifier of the bundle this path belongs to

	Field                string // Identifier of the field this path belongs to
	FieldType            string // Actual Field Type
	FieldTypeInformative string // Field type to display to the user

	DisplayWidget   string // Widget used for display
	FormatterWidget string // Widget used for formatting

	Cardinality int // Cardinality of this path

	PathArray        []string // Paths that make up the item
	DatatypeProperty string   // Datatype property (in case of a field)
	Disamb           int      // index where the path will be disambiguated

	Name        string // Name of this path
	ShortName   string // ShortName of this path
	Description string // Description of this path
}

Path represents a single path in the Pathbuilder

func (Path) Datatype

func (p Path) Datatype() string

func (Path) MachineName

func (p Path) MachineName() (machine string)

MachineName returns the machine name of this path.

The machine name is an identifier that is guaranteed to be unique among the respective bundle, but not globally. If a valid path, the machine name is not the empty string.

func (Path) MakeCardinality

func (p Path) MakeCardinality() int

MakeCardinality returns the cardinality to use for a call to make()

type Pathbuilder

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

Pathbuilder represents a WissKI Pathbuilder

A Pathbuilder consists of an order collection of bundles. A singular bundle can be accessed using it's identifier.

func NewPathbuilder

func NewPathbuilder() Pathbuilder

func (Pathbuilder) Bundle

func (pb Pathbuilder) Bundle(machine string) *Bundle

Bundle returns the main bundle with the given machine name. If such a bundle does not exist, returns nil.

func (Pathbuilder) Bundles

func (pb Pathbuilder) Bundles() []*Bundle

Bundles returns an ordered list of main bundles in this Pathbuilder

func (Pathbuilder) FindBundle

func (pb Pathbuilder) FindBundle(machine string) *Bundle

FindBundle returns the (main or nested) bundle with the given machine name. If such a bundle does not exist, returns nil.

func (Pathbuilder) Get

func (pb Pathbuilder) Get(id string) *Bundle

Get returns the bundle with the given id

func (Pathbuilder) GetOrCreate

func (pb Pathbuilder) GetOrCreate(id string) *Bundle

GetOrCreate either gets or creates a bundle

func (Pathbuilder) Paths

func (pb Pathbuilder) Paths() []Path

Paths recursively returns all paths in this bundle

Directories

Path Synopsis
Package dot transforms a pathbuilder into a dot file
Package dot transforms a pathbuilder into a dot file
Package pbtxt exports a pathbuilder as text
Package pbtxt exports a pathbuilder as text
Package pbxml implements the XML formats for a pathbuilder.
Package pbxml implements the XML formats for a pathbuilder.

Jump to

Keyboard shortcuts

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