age

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

Index

Constants

View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)
View Source
const MinInt = -MaxInt - 1
View Source
const MinUint = 0

Variables

This section is empty.

Functions

func GetReady

func GetReady(db *sql.DB, graphName string) (bool, error)

GetReady prepare AGE extension load AGE extension set graph path

func IsEntity

func IsEntity(v interface{}) bool

Types

type AGErrorListener

type AGErrorListener struct {
	*antlr.DefaultErrorListener
	// contains filtered or unexported fields
}

func NewAGErrorListener

func NewAGErrorListener() *AGErrorListener

func (*AGErrorListener) SyntaxError

func (el *AGErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)

type AGMapper

type AGMapper struct {
	AGUnmarshaler
}

func NewAGMapper

func NewAGMapper(typeMap map[string]reflect.Type) *AGMapper

func (*AGMapper) PutType

func (m *AGMapper) PutType(label string, tp reflect.Type)

type AGUnmarshaler

type AGUnmarshaler struct {
	Unmarshaller
	// contains filtered or unexported fields
}

func NewAGUnmarshaler

func NewAGUnmarshaler() *AGUnmarshaler

type Age

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

func ConnectAge

func ConnectAge(graphName string, dsn string) (*Age, error)

* @param dsn host=127.0.0.1 port=5432 dbname=postgres user=postgres password=agens sslmode=disable

func NewAge

func NewAge(graphName string, db *sql.DB) *Age

func (*Age) Begin

func (a *Age) Begin() (*AgeTx, error)

func (*Age) Close

func (a *Age) Close() error

func (*Age) DB

func (a *Age) DB() *sql.DB

func (*Age) GetReady

func (age *Age) GetReady() (bool, error)

type AgeError

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

func (*AgeError) Error

func (e *AgeError) Error() string

type AgeParseError

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

func (*AgeParseError) Error

func (e *AgeParseError) Error() string

type AgeTx

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

func (*AgeTx) Commit

func (t *AgeTx) Commit() error

func (*AgeTx) ExecCypher

func (a *AgeTx) ExecCypher(columnCount int, cypher string, args ...interface{}) (*CypherCursor, error)

* CREATE , DROP ....

func (*AgeTx) ExecCypherMap

func (a *AgeTx) ExecCypherMap(columnCount int, cypher string, args ...interface{}) (*CypherMapCursor, error)

func (*AgeTx) Rollback

func (t *AgeTx) Rollback() error

type Cursor

type Cursor interface {
	Next() bool
	Close() error
}

func NewCypherCursor

func NewCypherCursor(columnCount int, rows *sql.Rows) Cursor

func NewCypherMapCursor

func NewCypherMapCursor(columnCount int, rows *sql.Rows) Cursor

type CursorProvider

type CursorProvider func(columnCount int, rows *sql.Rows) Cursor

type CypherCursor

type CypherCursor struct {
	Cursor
	// contains filtered or unexported fields
}

func ExecCypher

func ExecCypher(tx *sql.Tx, graphName string, columnCount int, cypher string, args ...interface{}) (*CypherCursor, error)

ExecCypher : execute cypher query CREATE , DROP .... MATCH .... RETURN .... CREATE , DROP .... RETURN ...

func (*CypherCursor) Close

func (c *CypherCursor) Close() error

func (*CypherCursor) GetRow

func (c *CypherCursor) GetRow() ([]Entity, error)

func (*CypherCursor) Next

func (c *CypherCursor) Next() bool

type CypherMapCursor

type CypherMapCursor struct {
	CypherCursor
	// contains filtered or unexported fields
}

func ExecCypherMap

func ExecCypherMap(tx *sql.Tx, graphName string, columnCount int, cypher string, args ...interface{}) (*CypherMapCursor, error)

ExecCypherMap CREATE , DROP .... MATCH .... RETURN .... CREATE , DROP .... RETURN ...

func (*CypherMapCursor) GetRow

func (c *CypherMapCursor) GetRow() ([]interface{}, error)

func (*CypherMapCursor) PutType

func (c *CypherMapCursor) PutType(label string, tp reflect.Type)

type Edge

type Edge struct {
	*LabeledEntity
	// contains filtered or unexported fields
}

func NewEdge

func NewEdge(id int64, label string, start int64, end int64, props map[string]interface{}) *Edge

func (*Edge) EndId

func (e *Edge) EndId() int64

func (*Edge) GType

func (e *Edge) GType() GTYPE

func (*Edge) StartId

func (e *Edge) StartId() int64

func (*Edge) String

func (e *Edge) String() string

type Entity

type Entity interface {
	GType() GTYPE
	String() string
}

Entity object interface for parsed AGE result data : Vertex, Edge, Path and SimpleEntity

type GTYPE

type GTYPE uint8

GTYPE representing entity types for AGE result data : Vertex, Edge, Path and SimpleEntity

const (
	G_OTHER GTYPE = 1 + iota
	G_VERTEX
	G_EDGE
	G_PATH
	G_MAP_PATH
	G_STR
	G_INT
	G_INTBIG
	G_FLOAT
	G_FLOATBIG
	G_BOOL
	G_NULL
	G_MAP
	G_ARR
)

type LabeledEntity

type LabeledEntity struct {
	Entity
	// contains filtered or unexported fields
}

func (*LabeledEntity) Id

func (n *LabeledEntity) Id() int64

func (*LabeledEntity) Label

func (n *LabeledEntity) Label() string

func (*LabeledEntity) Prop

func (n *LabeledEntity) Prop(key string) interface{}

func (*LabeledEntity) Props

func (n *LabeledEntity) Props() map[string]interface{}

return properties

type MapPath

type MapPath struct {
	Entity
	// contains filtered or unexported fields
}

func NewMapPath

func NewMapPath(entities []interface{}) *MapPath

func (*MapPath) GType

func (e *MapPath) GType() GTYPE

func (*MapPath) Get

func (e *MapPath) Get(index int) interface{}

func (*MapPath) Size

func (e *MapPath) Size() int

func (*MapPath) String

func (p *MapPath) String() string

type MapperVisitor

type MapperVisitor struct {
	UnmarshalVisitor
	// contains filtered or unexported fields
}

func (*MapperVisitor) PutType

func (v *MapperVisitor) PutType(label string, tp reflect.Type)

func (*MapperVisitor) VisitAgeout

func (v *MapperVisitor) VisitAgeout(ctx *parser.AgeoutContext) interface{}

func (*MapperVisitor) VisitChildren

func (v *MapperVisitor) VisitChildren(node antlr.RuleNode) interface{}

func (*MapperVisitor) VisitEdge

func (v *MapperVisitor) VisitEdge(ctx *parser.EdgeContext) interface{}

Visit a parse tree produced by AgeParser#edge.

func (*MapperVisitor) VisitPath

func (v *MapperVisitor) VisitPath(ctx *parser.PathContext) interface{}

func (*MapperVisitor) VisitVertex

func (v *MapperVisitor) VisitVertex(ctx *parser.VertexContext) interface{}

type Path

type Path struct {
	Entity
	// contains filtered or unexported fields
}

func NewPath

func NewPath(entities []Entity) *Path

func (*Path) GType

func (e *Path) GType() GTYPE

func (*Path) Get

func (e *Path) Get(index int) Entity

func (*Path) GetAsEdge

func (e *Path) GetAsEdge(index int) *Edge

func (*Path) GetAsVertex

func (e *Path) GetAsVertex(index int) *Vertex

func (*Path) Size

func (e *Path) Size() int

func (*Path) String

func (p *Path) String() string

type SimpleEntity

type SimpleEntity struct {
	Entity
	// contains filtered or unexported fields
}

func NewSimpleEntity

func NewSimpleEntity(value interface{}) *SimpleEntity

func (*SimpleEntity) AsArr

func (e *SimpleEntity) AsArr() []interface{}

func (*SimpleEntity) AsBigFloat

func (e *SimpleEntity) AsBigFloat() *big.Float

func (*SimpleEntity) AsBigInt

func (e *SimpleEntity) AsBigInt() *big.Int

func (*SimpleEntity) AsBool

func (e *SimpleEntity) AsBool() bool

func (*SimpleEntity) AsFloat

func (e *SimpleEntity) AsFloat() float64

func (*SimpleEntity) AsInt

func (e *SimpleEntity) AsInt() int

func (*SimpleEntity) AsInt64

func (e *SimpleEntity) AsInt64() int64

func (*SimpleEntity) AsMap

func (e *SimpleEntity) AsMap() map[string]interface{}

func (*SimpleEntity) AsStr

func (e *SimpleEntity) AsStr() string

func (*SimpleEntity) GType

func (e *SimpleEntity) GType() GTYPE

func (*SimpleEntity) IsNull

func (e *SimpleEntity) IsNull() bool

func (*SimpleEntity) String

func (e *SimpleEntity) String() string

func (*SimpleEntity) Value

func (e *SimpleEntity) Value() interface{}

type UnmarshalVisitor

type UnmarshalVisitor struct {
	parser.AgeVisitor
	// contains filtered or unexported fields
}

func (*UnmarshalVisitor) Visit

func (v *UnmarshalVisitor) Visit(tree antlr.ParseTree) interface{}

func (*UnmarshalVisitor) VisitAgeout

func (v *UnmarshalVisitor) VisitAgeout(ctx *parser.AgeoutContext) interface{}

func (*UnmarshalVisitor) VisitArr

func (v *UnmarshalVisitor) VisitArr(ctx *parser.ArrContext) interface{}

Visit a parse tree produced by AgeParser#arr.

func (*UnmarshalVisitor) VisitChildren

func (v *UnmarshalVisitor) VisitChildren(node antlr.RuleNode) interface{}

func (*UnmarshalVisitor) VisitEdge

func (v *UnmarshalVisitor) VisitEdge(ctx *parser.EdgeContext) interface{}

Visit a parse tree produced by AgeParser#edge.

func (*UnmarshalVisitor) VisitErrorNode

func (v *UnmarshalVisitor) VisitErrorNode(node antlr.ErrorNode) interface{}

func (*UnmarshalVisitor) VisitPair

func (v *UnmarshalVisitor) VisitPair(ctx *parser.PairContext) interface{}

Visit a parse tree produced by AgeParser#pair.

func (*UnmarshalVisitor) VisitPath

func (v *UnmarshalVisitor) VisitPath(ctx *parser.PathContext) interface{}

Visit a parse tree produced by AgeParser#path.

func (*UnmarshalVisitor) VisitProperties

func (v *UnmarshalVisitor) VisitProperties(ctx *parser.PropertiesContext) interface{}

Visit a parse tree produced by AgeParser#properties.

func (*UnmarshalVisitor) VisitTerminal

func (v *UnmarshalVisitor) VisitTerminal(node antlr.TerminalNode) interface{}

func (*UnmarshalVisitor) VisitValue

func (v *UnmarshalVisitor) VisitValue(ctx *parser.ValueContext) interface{}

Visit a parse tree produced by AgeParser#value.

func (*UnmarshalVisitor) VisitVertex

func (v *UnmarshalVisitor) VisitVertex(ctx *parser.VertexContext) interface{}

Visit a parse tree produced by AgeParser#vertex.

type Unmarshaller

type Unmarshaller interface {
	// contains filtered or unexported methods
}

type Vertex

type Vertex struct {
	*LabeledEntity
}

func NewVertex

func NewVertex(id int64, label string, props map[string]interface{}) *Vertex

func (*Vertex) GType

func (v *Vertex) GType() GTYPE

func (*Vertex) String

func (v *Vertex) String() string

Jump to

Keyboard shortcuts

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