specv3

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSupportedNodeIDFunction

func IsSupportedNodeIDFunction(function string) bool

func IsSupportedNodeIDValueType

func IsSupportedNodeIDValueType(t ValueType) bool

func IsSupportedPropValueType

func IsSupportedPropValueType(t ValueType) bool

Types

type Edge

type Edge struct {
	Name  string       `yaml:"name" json:"name"`
	Src   *EdgeNodeRef `yaml:"src" json:"src"`
	Dst   *EdgeNodeRef `yaml:"dst" json:"dst"`
	Rank  *Rank        `yaml:"rank,omitempty" json:"rank,omitempty,optional"`
	Props Props        `yaml:"props,omitempty" json:"props,omitempty,optional"`

	IgnoreExistedIndex *bool `yaml:"ignoreExistedIndex,omitempty" json:"ignoreExistedIndex,omitempty,optional,default=false"`

	Filter *specbase.Filter `yaml:"filter,omitempty" json:"filter,omitempty,optional"`

	Mode specbase.Mode `yaml:"mode,omitempty" json:"mode,omitempty,optional,default=insert"`
	// contains filtered or unexported fields
}

func NewEdge

func NewEdge(name string, opts ...EdgeOption) *Edge

func (*Edge) Complete

func (e *Edge) Complete()

func (*Edge) Options

func (e *Edge) Options(opts ...EdgeOption) *Edge

func (*Edge) Statement

func (e *Edge) Statement(records ...Record) (statement string, nRecord int, err error)

func (*Edge) Validate

func (e *Edge) Validate() error

type EdgeNodeRef

type EdgeNodeRef struct {
	Name string  `yaml:"-" json:"-"`
	ID   *NodeID `yaml:"id" json:"id"`
}

func (*EdgeNodeRef) Complete

func (n *EdgeNodeRef) Complete()

func (*EdgeNodeRef) IDValue

func (n *EdgeNodeRef) IDValue(record Record) (string, error)

func (*EdgeNodeRef) Validate

func (n *EdgeNodeRef) Validate() error

type EdgeOption

type EdgeOption func(*Edge)

func WithEdgeDst

func WithEdgeDst(dst *EdgeNodeRef) EdgeOption

func WithEdgeFilter

func WithEdgeFilter(f *specbase.Filter) EdgeOption

func WithEdgeIgnoreExistedIndex

func WithEdgeIgnoreExistedIndex(ignore bool) EdgeOption

func WithEdgeMode

func WithEdgeMode(m specbase.Mode) EdgeOption

func WithEdgeProps

func WithEdgeProps(props ...*Prop) EdgeOption

func WithEdgeSrc

func WithEdgeSrc(src *EdgeNodeRef) EdgeOption

func WithRank

func WithRank(rank *Rank) EdgeOption

type Edges

type Edges []*Edge

func (Edges) Complete

func (es Edges) Complete()

func (Edges) Validate

func (es Edges) Validate() error

type Graph

type Graph struct {
	Name  string `yaml:"name" json:"name"`
	Nodes Nodes  `yaml:"tags,omitempty" json:"tags,omitempty,optional"`
	Edges Edges  `yaml:"edges,omitempty" json:"edges,omitempty,optional"`
}

func NewGraph

func NewGraph(name string, opts ...GraphOption) *Graph

func (*Graph) AddEdges

func (g *Graph) AddEdges(edges ...*Edge)

func (*Graph) AddNodes

func (g *Graph) AddNodes(nodes ...*Node)

func (*Graph) Complete

func (g *Graph) Complete()

func (*Graph) EdgeStatement

func (g *Graph) EdgeStatement(e *Edge, records ...Record) (statement string, nRecord int, err error)

func (*Graph) EdgeStatementBuilder

func (g *Graph) EdgeStatementBuilder(e *Edge) specbase.StatementBuilder

func (*Graph) GetEdgeByName

func (g *Graph) GetEdgeByName(name string) (*Edge, bool)

func (*Graph) GetNodeByName

func (g *Graph) GetNodeByName(name string) (*Node, bool)

func (*Graph) NodeStatement

func (g *Graph) NodeStatement(n *Node, records ...Record) (statement string, nRecord int, err error)

func (*Graph) NodeStatementBuilder

func (g *Graph) NodeStatementBuilder(n *Node) specbase.StatementBuilder

func (*Graph) Validate

func (g *Graph) Validate() error

type GraphOption

type GraphOption func(*Graph)

func WithGraphEdges

func WithGraphEdges(edges ...*Edge) GraphOption

func WithGraphNodes

func WithGraphNodes(nodes ...*Node) GraphOption

type Node

type Node struct {
	Name  string  `yaml:"name" json:"name"`
	ID    *NodeID `yaml:"id" json:"id"`
	Props Props   `yaml:"props,omitempty" json:"props,omitempty,optional"`

	IgnoreExistedIndex *bool `yaml:"ignoreExistedIndex,omitempty" json:"ignoreExistedIndex,omitempty,default=false"`

	Filter *specbase.Filter `yaml:"filter,omitempty" json:"filter,omitempty,optional"`

	Mode specbase.Mode `yaml:"mode,omitempty" json:"mode,omitempty,default=insert"`
	// contains filtered or unexported fields
}

Node is VERTEX in 3.x

func NewNode

func NewNode(name string, opts ...NodeOption) *Node

func (*Node) Complete

func (n *Node) Complete()

func (*Node) Options

func (n *Node) Options(opts ...NodeOption) *Node

func (*Node) Statement

func (n *Node) Statement(records ...Record) (statement string, nRecord int, err error)

func (*Node) Validate

func (n *Node) Validate() error

type NodeID

type NodeID struct {
	Name        string        `yaml:"-" json:"-"`
	Type        ValueType     `yaml:"type" json:"type"`
	Index       int           `yaml:"index" json:"index"`
	ConcatItems []interface{} `yaml:"concatItems,omitempty" json:"concatItems,omitempty,optional"` // only support string and int, string for constant, int is for Index
	Function    *string       `yaml:"function" json:"function,omitempty,optional"`
	// contains filtered or unexported fields
}

NodeID is the VID in 3.x

func (*NodeID) Complete

func (id *NodeID) Complete()

func (*NodeID) Validate

func (id *NodeID) Validate() error

func (*NodeID) Value

func (id *NodeID) Value(record Record) (string, error)

type NodeOption

type NodeOption func(*Node)

func WithNodeFilter

func WithNodeFilter(f *specbase.Filter) NodeOption

func WithNodeID

func WithNodeID(id *NodeID) NodeOption

func WithNodeIgnoreExistedIndex

func WithNodeIgnoreExistedIndex(ignore bool) NodeOption

func WithNodeMode

func WithNodeMode(m specbase.Mode) NodeOption

func WithNodeProps

func WithNodeProps(props ...*Prop) NodeOption

type Nodes

type Nodes []*Node

func (Nodes) Complete

func (ns Nodes) Complete()

func (Nodes) Validate

func (ns Nodes) Validate() error

type Prop

type Prop struct {
	Name               string    `yaml:"name" json:"name"`
	Type               ValueType `yaml:"type" json:"type"`
	Index              int       `yaml:"index" json:"index"`
	Nullable           bool      `yaml:"nullable" json:"nullable,omitempty,optional,default=false"`
	NullValue          string    `yaml:"nullValue" json:"nullValue,omitempty,optional"`
	AlternativeIndices []int     `yaml:"alternativeIndices,omitempty" json:"alternativeIndices,omitempty,optional"`
	DefaultValue       *string   `yaml:"defaultValue" json:"defaultValue,omitempty,optional"`
	// contains filtered or unexported fields
}

func (*Prop) Complete

func (p *Prop) Complete()

func (*Prop) SetValue

func (p *Prop) SetValue(record Record) (string, error)

func (*Prop) Validate

func (p *Prop) Validate() error

func (*Prop) Value

func (p *Prop) Value(record Record) (string, error)

type Props

type Props []*Prop

func (Props) Append

func (ps Props) Append(props ...*Prop) Props

func (Props) Complete

func (ps Props) Complete()

func (Props) NameList

func (ps Props) NameList() []string

func (Props) SetValueList

func (ps Props) SetValueList(record Record) ([]string, error)

func (Props) Validate

func (ps Props) Validate() error

func (Props) ValueList

func (ps Props) ValueList(record Record) ([]string, error)

type Rank

type Rank struct {
	Index int `yaml:"index" json:"index"`
	// contains filtered or unexported fields
}

func (*Rank) Complete

func (*Rank) Complete()

func (*Rank) Validate

func (r *Rank) Validate() error

func (*Rank) Value

func (r *Rank) Value(record Record) (string, error)

type Record

type Record = specbase.Record

type Records

type Records = specbase.Records

type ValueType

type ValueType string
const (
	ValueTypeBool          ValueType = "BOOL"
	ValueTypeInt           ValueType = "INT"
	ValueTypeInt8          ValueType = "INT8"
	ValueTypeInt16         ValueType = "INT16"
	ValueTypeInt32         ValueType = "INT32"
	ValueTypeInt64         ValueType = "INT64"
	ValueTypeString        ValueType = "STRING"
	ValueTypeFixedString   ValueType = "FIXED_STRING"
	ValueTypeFloat         ValueType = "FLOAT"
	ValueTypeDouble        ValueType = "DOUBLE"
	ValueTypeDate          ValueType = "DATE"
	ValueTypeTime          ValueType = "TIME"
	ValueTypeDateTime      ValueType = "DATETIME"
	ValueTypeTimestamp     ValueType = "TIMESTAMP"
	ValueTypeGeo           ValueType = "GEOGRAPHY"
	ValueTypeGeoPoint      ValueType = "GEOGRAPHY(POINT)"
	ValueTypeGeoLineString ValueType = "GEOGRAPHY(LINESTRING)"
	ValueTypeGeoPolygon    ValueType = "GEOGRAPHY(POLYGON)"

	ValueTypeDefault = ValueTypeString
)

func (ValueType) Equal

func (t ValueType) Equal(vt ValueType) bool

func (ValueType) String

func (t ValueType) String() string

Jump to

Keyboard shortcuts

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