documents

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDocument

type BaseDocument struct {
	Key string     `json:"_key,omitempty"`
	ID  DocumentID `json:"_id,omitempty"`
	Rev string     `json:"_rev,omitempty"`
}

BaseDocument is a minimal document for use in non-edge collection.

func NewBaseDocument

func NewBaseDocument(meta *pbcmdb.Meta) *BaseDocument

type DocumentID

type DocumentID string

DocumentID is a document ID Consists of two parts - collection name and key

func (DocumentID) Collection

func (id DocumentID) Collection() string

Collection returns the collection part of the ID.

func (DocumentID) Key

func (id DocumentID) Key() string

Key returns the key part of the ID.

func (DocumentID) Parent

func (id DocumentID) Parent() DocumentID

Parent - return parent's Document ID

func (DocumentID) ProfileName

func (id DocumentID) ProfileName() string

ProfileName returns the profile name part of the ID.

func (DocumentID) String

func (id DocumentID) String() string

func (DocumentID) Topic

func (id DocumentID) Topic() string

Topic representation of DocumentID

func (DocumentID) Validate

func (id DocumentID) Validate() error

Validate validates the given id

type EdgeDocument

type EdgeDocument struct {
	BaseDocument
	From DocumentID `json:"_from,omitempty"`
	To   DocumentID `json:"_to,omitempty"`
	Type string     `json:"_type,omitempty"`
}

EdgeDocument is a minimal document for use in edge collection.

type Node

type Node struct {
	Id     DocumentID      `json:"id,omitempty"`
	LinkId DocumentID      `json:"link_id,omitempty"`
	Key    string          `json:"key,omitempty"`
	Name   string          `json:"name,omitempty"`
	Type   string          `json:"type,omitempty"`
	Object json.RawMessage `json:"object,omitempty"`
	Link   json.RawMessage `json:"link,omitempty"`
	Path   json.RawMessage `json:"path,omitempty"`
}

func NewNode

func NewNode(element *pbqdsl.Element) *Node

func (*Node) ToElement

func (node *Node) ToElement() *pbqdsl.Element

type Nodes

type Nodes []*Node

func NewNodes

func NewNodes() Nodes

func (*Nodes) Add

func (nodes *Nodes) Add(node ...*Node)

func (*Nodes) AddElement

func (nodes *Nodes) AddElement(element *pbqdsl.Element)

Jump to

Keyboard shortcuts

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