graph

package
v0.0.0-...-90603f3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWithError

func RespondWithError(w http.ResponseWriter, ext string, message string)

func StringifyMapKeys

func StringifyMapKeys(in interface{}) interface{}

https://github.com/gohugoio/hugo/pull/4138

Types

type Backend

type Backend interface {
	Type() string
	Connect(options map[string]string) error
	Ready(options map[string]string) (bool, error)
	Schema(options map[string]string) (Schema, error)
	OperationDefinitions(options map[string]string) ([]operations.OperationDefinition, error)
	FilterFunctions(options map[string]string) ([]FilterFunctionDefinition, error)
	Validate(chain OperationChain, options map[string]string) error
	Execute(chain OperationChain, options map[string]string) (QueryResponse, error)
	NewEntity(group string, vertex string, properties map[string]interface{}) *elements.Entity
	NewEdge(group string, source string, destination string, directed bool, properties map[string]interface{}) *elements.Edge
}

func ConnectToBackend

func ConnectToBackend(pluginPath string, symbol string, options map[string]string) (Backend, error)

func LoadBackendFromPlugin

func LoadBackendFromPlugin(path string, symbol string) (Backend, error)

type Feature

type Feature struct {
	Id           interface{}            `json:"id" bson:"id" yaml:"id" hcl:"id"`
	Type         string                 `json:"type" bson:"type" yaml:"type" hcl:"type"`
	Properties   map[string]interface{} `json:"properties" bson:"properties" yaml:"properties" hcl:"properties"`
	GeometryName string                 `json:"geometry_name" bson:"geometry_name" yaml:"geometry_name" hcl:"geometry_name"`
	Geometry     Geometry               `json:"geometry" bson:"geometry" yaml:"geometry" hcl:"geometry"`
}

func NewFeature

func NewFeature(id interface{}, properties map[string]interface{}, geom Geometry) Feature

type FeatureCollection

type FeatureCollection struct {
	Type          string    `json:"type" bson:"type" yaml:"type" hcl:"type"`
	TotalFeatures int       `json:"totalFeatures" bson:"totalFeatures" yaml:"totalFeatures" hcl:"totalFeatures"`
	Features      []Feature `json:"features" bson:"features" yaml:"features" hcl:"features"`
}

func NewFeatureCollection

func NewFeatureCollection(features []Feature) FeatureCollection

type FilterFunctionDefinition

type FilterFunctionDefinition struct {
	Class string `json:"class" bson:"class" yaml:"class" hcl:"class"`
}

func (FilterFunctionDefinition) Json

func (ff FilterFunctionDefinition) Json() (string, error)

func (FilterFunctionDefinition) Yaml

func (ff FilterFunctionDefinition) Yaml() (string, error)

type Geometry

type Geometry struct {
	Type        string      `json:"type" bson:"type" yaml:"type" hcl:"type"`
	Coordinates interface{} `json:"coordinates" bson:"coordinates" yaml:"coordinates" hcl:"coordinates"`
}

func NewLine

func NewLine(coordinates [][]float64) Geometry

func NewPoint

func NewPoint(lon float64, lat float64) Geometry

func NewPolygon

func NewPolygon(coordinates [][]float64) Geometry

type Operation

type Operation interface {
	GetTypeName() string
	Validate(schema Schema) error
	Sgol() (string, error)
}

type OperationChain

type OperationChain interface {
	GetName() string
	Validate(schema Schema) error
	GetOperations() []Operation
	GetFirstOperation() (Operation, error)
	GetLastOperation() (Operation, error)
	GetLimit() int
	GetOutputType() string
	Hash() (string, error)
	Sgol() (string, error)
}

type Parser

type Parser interface {
	ParseQuery(q string) (OperationChain, error)
}

type QueryResponse

type QueryResponse struct {
	Success bool         `json:"success" bson:"success" yaml:"success" hcl:"success"`
	Message string       `json:"message" bson:"message" yaml:"message" hcl:"message"`
	Query   string       `json:"query" bson:"query" yaml:"query" hcl:"query"`
	Results QueryResults `json:"results" bson:"results" yaml:"results" hcl:"results"`
}

func NewQueryResponse

func NewQueryResponse(success bool, message string, query string) QueryResponse

func ParseQueryResponse

func ParseQueryResponse(text string) (QueryResponse, error)

func (*QueryResponse) Json

func (qr *QueryResponse) Json() (string, error)

func (*QueryResponse) WriteToResponse

func (qr *QueryResponse) WriteToResponse(w http.ResponseWriter, ext string)

type QueryResults

type QueryResults struct {
	Entities []elements.Entity `json:"entities,omitempty" bson:"entities" yaml:"entities,omitempty" hcl:"entities"`
	Edges    []elements.Edge   `json:"edges,omitempty" bson:"edges" yaml:"edges,omitempty" hcl:"edges"`
}

func (*QueryResults) FeatureCollection

func (results *QueryResults) FeatureCollection() (FeatureCollection, error)

func (*QueryResults) Json

func (results *QueryResults) Json() (string, error)

type Schema

type Schema interface {
	GetEntityGroupNames() []string
	GetEdgeGroupNames() []string
	GetTypeNames() []string
	ContainsGroups(groups []string) bool
	ContainsEntities(entities []string) bool
	ContainsEdges(edges []string) bool
	GetEntityPropertyNames(entity string) []string
	//GetEntityPropertyType(entity string, propertyName string) string
	GetEntityPropertyTypes(group string) map[string]string
	GetEdgePropertyNames(edge string) []string
	GetEdgePropertyTypes(group string) map[string]string
	//GetEdgePropertyType(edge string, propertyName string) string
	Json() (string, error)
	Yaml() (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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