codec

package
v0.0.0-...-f832334 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOperationChain

func NewOperationChain(name string, operations []graph.Operation, outputType string) graph.OperationChain

func StringSliceContains

func StringSliceContains(s []string, i string) bool

func StringSliceIndex

func StringSliceIndex(s []string, value string) int

Types

type AbstractOperation

type AbstractOperation struct {
	Type string `json:"type" bson:"type" yaml:"type" hcl:"type"`
}

func (AbstractOperation) GetInputType

func (op AbstractOperation) GetInputType() string

func (AbstractOperation) GetOutputType

func (op AbstractOperation) GetOutputType() string

func (AbstractOperation) GetTypeName

func (op AbstractOperation) GetTypeName() string

func (AbstractOperation) Validate

func (op AbstractOperation) Validate(schema graph.Schema) error

type AbstractOperationInput

type AbstractOperationInput struct {
	InputType string `json:"input_type" bson:"input_type" yaml:"input_type" hcl:"input_type"`
}

func (AbstractOperationInput) GetInputType

func (op AbstractOperationInput) GetInputType() string

type AbstractOperationKey

type AbstractOperationKey struct {
	*AbstractOperation
	Key string `json:"key" bson:"key" yaml:"key" hcl:"key"`
}

func (AbstractOperationKey) GetKey

func (op AbstractOperationKey) GetKey() string

type AbstractOperationOutput

type AbstractOperationOutput struct {
	OutputType string `json:"output_type" bson:"output_type" yaml:"output_type" hcl:"output_type"`
}

func (AbstractOperationOutput) GetOutputType

func (op AbstractOperationOutput) GetOutputType() string

type AbstractOperationSeeds

type AbstractOperationSeeds struct {
	Seeds SeedCollection `json:"seeds" bson:"seeds" yaml:"seeds" hcl:"seeds"`
}

func (AbstractOperationSeeds) GetSeeds

func (op AbstractOperationSeeds) GetSeeds() []string

func (AbstractOperationSeeds) HasSeeds

func (op AbstractOperationSeeds) HasSeeds() bool

func (*AbstractOperationSeeds) SetSeeds

func (op *AbstractOperationSeeds) SetSeeds(seeds SeedCollection)

type AbstractOperationUpdate

type AbstractOperationUpdate struct {
	Update update.Update `json:"update" bson:"update" yaml:"update" hcl:"update"`
}

func (AbstractOperationUpdate) HasUpdate

func (op AbstractOperationUpdate) HasUpdate() bool

func (AbstractOperationUpdate) HasUpdateFilters

func (op AbstractOperationUpdate) HasUpdateFilters() bool

func (*AbstractOperationUpdate) SetUpdate

func (op *AbstractOperationUpdate) SetUpdate(u update.Update)

type AbstractOperationView

type AbstractOperationView struct {
	View view.View `json:"view" bson:"view" yaml:"view" hcl:"view"`
}

func (AbstractOperationView) HasFilters

func (op AbstractOperationView) HasFilters() bool

func (*AbstractOperationView) SetView

func (op *AbstractOperationView) SetView(v view.View)

type GroupCollection

type GroupCollection struct {
	Input  bool     `json:"input" bson:"input" yaml:"input" hcl:"input"`
	All    bool     `json:"all" bson:"all" yaml:"all" hcl:"all"`
	Groups []string `json:"groups" bson:"groups" yaml:"groups" hcl:"groups"`
}

func NewGroupCollection

func NewGroupCollection(text string) GroupCollection

func (GroupCollection) GetGroups

func (gc GroupCollection) GetGroups() []string

func (GroupCollection) HasGroup

func (gc GroupCollection) HasGroup(group string) bool

func (GroupCollection) HasInput

func (gc GroupCollection) HasInput() bool

func (GroupCollection) Sgol

func (gc GroupCollection) Sgol() string

type NamedQuery

type NamedQuery struct {
	Name     string   `json:"name" hcl:"name"`
	Sgol     string   `json:"sgol" hcl:"sgol"`
	Required []string `json:"required,omitempty" hcl:"required,omitempty"`
	Optional []string `json:"optional,omitempty" hcl:"optional,omitempty"`
}

type Operation

type Operation interface {
	GetTypeName() string
	Validate(schema graph.Schema) error
	GetInputType() bool
	GetOutputType() bool
	Sgol() (string, error)
}

type OperationAdd

type OperationAdd struct {
	*AbstractOperation
	Input    bool              `json:"input" bson:"input" yaml:"input" hcl:"input"`
	Entities []elements.Entity `json:"entities" bson:"entities" yaml:"entities" hcl:"entities"`
	Edges    []elements.Edge   `json:"edges" bson:"edges" yaml:"edges" hcl:"edges"`
}

func NewOperationAdd

func NewOperationAdd(input bool) OperationAdd

func NewOperationAddWithElements

func NewOperationAddWithElements(entities []elements.Entity, edges []elements.Edge) OperationAdd

func (OperationAdd) HasInput

func (op OperationAdd) HasInput() bool

func (OperationAdd) Sgol

func (op OperationAdd) Sgol() (string, error)

type OperationChain

type OperationChain struct {
	Name       string            `json:"name" yaml:"name" hcl:"name"`
	Operations []graph.Operation `json:"operations" yaml:"operations" hcl:"operations"`
	OutputType string            `json:"output_type" "yaml":"output_type" hcl:"output_type"`
	Limit      int               `json:"limit" bson:"limit" yaml:"limit" hcl:"limit"`
}

func (OperationChain) GetFirstOperation

func (oc OperationChain) GetFirstOperation() (graph.Operation, error)

func (OperationChain) GetLastOperation

func (oc OperationChain) GetLastOperation() (graph.Operation, error)

func (OperationChain) GetLimit

func (oc OperationChain) GetLimit() int

func (OperationChain) GetName

func (chain OperationChain) GetName() string

func (OperationChain) GetOperations

func (oc OperationChain) GetOperations() []graph.Operation

func (OperationChain) GetOutputType

func (oc OperationChain) GetOutputType() string

func (OperationChain) Hash

func (oc OperationChain) Hash() (string, error)

func (OperationChain) Sgol

func (chain OperationChain) Sgol() (string, error)

func (OperationChain) Validate

func (chain OperationChain) Validate(schema graph.Schema) error

type OperationDiscard

type OperationDiscard struct {
	*AbstractOperation
}

func NewOperationDiscard

func NewOperationDiscard() OperationDiscard

func (OperationDiscard) Sgol

func (op OperationDiscard) Sgol() (string, error)

type OperationFetch

type OperationFetch struct {
	*AbstractOperationKey
}

func NewOperationFetch

func NewOperationFetch(key string) OperationFetch

func (OperationFetch) Sgol

func (op OperationFetch) Sgol() (string, error)

type OperationHas

type OperationHas struct {
	*AbstractOperation
	*AbstractOperationOutput
	*AbstractOperationView
	*AbstractOperationUpdate
	*AbstractOperationSeeds
	SourceGroups            GroupCollection `json:"source" bson:"source" yaml:"source" hcl:"source"`
	Edges                   GroupCollection `json:"edges" bson:"edges" yaml:"edges" hcl:"edges"`
	DestinationGroups       GroupCollection `json:"destination" bson:"destination" yaml:"destination" hcl:"destination"`
	Direction               string          `json:"direction" bson:"direction" yaml:"direction" hcl:"direction"`
	EdgeIdentifierToExtract string          `json:"edgeIdentifierToExtract" bson:"edgeIdentifierToExtract" yaml:"edgeIdentifierToExtract" hcl:"edgeIdentifierToExtract"`
	SeedMatching            string          `json:"seedMatching" bson:"seedMatching" yaml:"seedMatching" hcl:"seedMatching"`
	Depth                   int             `json:"depth" bson:"depth" yaml:"depth" hcl:"depth"`
}

func NewOperationHas

func NewOperationHas() *OperationHas

func (OperationHas) GetDestinationGroups

func (op OperationHas) GetDestinationGroups() []string

func (OperationHas) GetEdgeGroups

func (op OperationHas) GetEdgeGroups() []string

func (OperationHas) GetSourceGroups

func (op OperationHas) GetSourceGroups() []string

func (OperationHas) HasEdgeGroup

func (op OperationHas) HasEdgeGroup(group string) bool

func (OperationHas) HasEntityGroup

func (op OperationHas) HasEntityGroup(group string) bool

func (OperationHas) HasGroup

func (op OperationHas) HasGroup(group string) bool

func (OperationHas) HasInput

func (op OperationHas) HasInput() bool

func (*OperationHas) SetDestination

func (op *OperationHas) SetDestination(groups GroupCollection)

func (*OperationHas) SetEdges

func (op *OperationHas) SetEdges(groups GroupCollection)

func (*OperationHas) SetSource

func (op *OperationHas) SetSource(groups GroupCollection)

func (OperationHas) Sgol

func (op OperationHas) Sgol() (string, error)

func (OperationHas) Validate

func (op OperationHas) Validate(schema graph.Schema) error

type OperationInit

type OperationInit struct {
	*AbstractOperationKey
}

func NewOperationInit

func NewOperationInit(key string) OperationInit

func (OperationInit) Sgol

func (op OperationInit) Sgol() (string, error)

type OperationLimit

type OperationLimit struct {
	*AbstractOperation
	Limit int `json:"limit" bson:"limit" yaml:"limit" hcl:"limit"`
}

func NewOperationLimit

func NewOperationLimit(limit int) OperationLimit

func (OperationLimit) GetLimit

func (op OperationLimit) GetLimit() int

func (OperationLimit) Sgol

func (op OperationLimit) Sgol() (string, error)

type OperationNav

type OperationNav struct {
	*AbstractOperation
	*AbstractOperationOutput
	*AbstractOperationView
	*AbstractOperationUpdate
	*AbstractOperationSeeds
	SourceGroups            GroupCollection `json:"source" bson:"source" yaml:"source" hcl:"source"`
	Edges                   GroupCollection `json:"edges" bson:"edges" yaml:"edges" hcl:"edges"`
	DestinationGroups       GroupCollection `json:"destination" bson:"destination" yaml:"destination" hcl:"destination"`
	Direction               string          `json:"direction" bson:"direction" yaml:"direction" hcl:"direction"`
	EdgeIdentifierToExtract string          `json:"edgeIdentifierToExtract" bson:"edgeIdentifierToExtract" yaml:"edgeIdentifierToExtract" hcl:"edgeIdentifierToExtract"`
	SeedMatching            string          `json:"seedMatching" bson:"seedMatching" yaml:"seedMatching" hcl:"seedMatching"`
	Depth                   int             `json:"depth" bson:"depth" yaml:"depth" hcl:"depth"`
}

func NewOperationNav

func NewOperationNav() *OperationNav

func (OperationNav) GetDestinationGroups

func (op OperationNav) GetDestinationGroups() []string

func (OperationNav) GetEdgeGroups

func (op OperationNav) GetEdgeGroups() []string

func (OperationNav) GetSeeds

func (op OperationNav) GetSeeds() []string

func (OperationNav) GetSourceGroups

func (op OperationNav) GetSourceGroups() []string

func (OperationNav) HasEdgeGroup

func (op OperationNav) HasEdgeGroup(group string) bool

func (OperationNav) HasEntityGroup

func (op OperationNav) HasEntityGroup(group string) bool

func (OperationNav) HasGroup

func (op OperationNav) HasGroup(group string) bool

func (OperationNav) HasInput

func (op OperationNav) HasInput() bool

func (OperationNav) HasSeeds

func (op OperationNav) HasSeeds() bool

func (*OperationNav) SetDestination

func (op *OperationNav) SetDestination(groups GroupCollection)

func (*OperationNav) SetEdges

func (op *OperationNav) SetEdges(groups GroupCollection)

func (*OperationNav) SetSeeds

func (op *OperationNav) SetSeeds(seeds SeedCollection)

func (*OperationNav) SetSource

func (op *OperationNav) SetSource(groups GroupCollection)

func (OperationNav) Sgol

func (op OperationNav) Sgol() (string, error)

func (OperationNav) Validate

func (op OperationNav) Validate(schema graph.Schema) error

type OperationPlaceholder

type OperationPlaceholder struct {
	*AbstractOperation
}

func NewOperationPlaceholder

func NewOperationPlaceholder(key string) OperationPlaceholder

func (OperationPlaceholder) Sgol

func (op OperationPlaceholder) Sgol() (string, error)

type OperationRelate

type OperationRelate struct {
	*AbstractOperation
	Keys []string `json:"keys" bson:"keys" yaml:"keys" hcl:"keys"`
}

func NewOperationRelate

func NewOperationRelate(keys []string) OperationRelate

func (OperationRelate) Sgol

func (op OperationRelate) Sgol() (string, error)

type OperationRun

type OperationRun struct {
	*AbstractOperation
	Function *exp.Function `json:"function" bson:"function" yaml:"function" hcl:"function"`
}

func NewOperationRun

func NewOperationRun() *OperationRun

func (*OperationRun) SetFunction

func (op *OperationRun) SetFunction(f *exp.Function)

func (OperationRun) Sgol

func (op OperationRun) Sgol() (string, error)

type OperationSeed

type OperationSeed struct {
	*AbstractOperation
}

func NewOperationSeed

func NewOperationSeed() OperationSeed

func (OperationSeed) Sgol

func (op OperationSeed) Sgol() (string, error)

type OperationSelect

type OperationSelect struct {
	*AbstractOperation
	*AbstractOperationOutput
	*AbstractOperationView
	*AbstractOperationUpdate
	*AbstractOperationSeeds
	Groups GroupCollection `json:"groups" bson:"groups" yaml:"groups" hcl:"groups"`
}

func NewOperationSelect

func NewOperationSelect() *OperationSelect

func (OperationSelect) GetGroupNames

func (op OperationSelect) GetGroupNames() []string

func (OperationSelect) HasGroup

func (op OperationSelect) HasGroup(group string) bool

func (*OperationSelect) SetGroups

func (op *OperationSelect) SetGroups(groups GroupCollection)

func (OperationSelect) Sgol

func (op OperationSelect) Sgol() (string, error)

func (OperationSelect) Validate

func (op OperationSelect) Validate(schema graph.Schema) error

type Parser

type Parser struct {
	Clauses  []string `json:"clauses" hcl:"clauses"`
	Entities []string `json:"entities" hcl:"entities"`
	Edges    []string `json:"edges" hcl:"edges"`
}

func (*Parser) ParseBlocks

func (p *Parser) ParseBlocks(tokens []string) [][]string

func (*Parser) ParseEdges

func (p *Parser) ParseEdges(text string) []string

func (*Parser) ParseEntities

func (p *Parser) ParseEntities(text string) []string

func (*Parser) ParseFilter

func (p *Parser) ParseFilter(block []string) (exp.Node, map[string]exp.Node, string, map[string]exp.Node, error)

func (*Parser) ParseGroups

func (p *Parser) ParseGroups(text string) []string

func (*Parser) ParseHas

func (p *Parser) ParseHas(block []string) (*OperationHas, error)

func (*Parser) ParseNav

func (p *Parser) ParseNav(block []string) (*OperationNav, error)

func (*Parser) ParseOperations

func (p *Parser) ParseOperations(blocks [][]string) ([]graph.Operation, string, error)

func (*Parser) ParseQuery

func (p *Parser) ParseQuery(q string) (graph.OperationChain, error)

func (*Parser) ParseRun

func (p *Parser) ParseRun(block []string) (*OperationRun, error)

func (*Parser) ParseSelect

func (p *Parser) ParseSelect(block []string) (*OperationSelect, error)

func (*Parser) ParseTokens

func (p *Parser) ParseTokens(text string) ([]string, error)

func (*Parser) ParseUpdate

func (p *Parser) ParseUpdate(block []string) (string, map[string]exp.Node, error)

func (*Parser) Rejoin

func (p *Parser) Rejoin(block []string) string

type QueryFunction

type QueryFunction struct {
	Names string
	Args  []string
}

type SeedCollection

type SeedCollection struct {
	Vertices []string `json:"verticies" bson:"verticies" yaml:"verticies" hcl:"vertitices"`
}

func NewSeedCollection

func NewSeedCollection(text string) SeedCollection

func (SeedCollection) Sgol

func (sc SeedCollection) Sgol() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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