neo4j

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Neo4jQueryCallStack = testutils.NewCallStack()

Functions

func GetProperty

func GetProperty[T PropertyValue](e Entity, key string) (T, error)

Get a property from an entity at a given key and cast or decode it to a specific type.

func GetRecordValue

func GetRecordValue[T RecordValue](record *Record, key string) (T, error)

Get a value from a record at a given key and cast or decode it to a specific type.

Types

type EagerResult

type EagerResult struct {
	Keys    []string
	Records []*Record
}

The result of a Neo4j query.

func ExecuteQuery

func ExecuteQuery(connection, query string, parameters map[string]any, opts ...Neo4jOption) (*EagerResult, error)

Executes a query or mutation on the Neo4j database.

type Entity

type Entity interface {
	GetElementId() string
	GetProperties() map[string]any
}

type Neo4jOption

type Neo4jOption func(*neo4jOptions)

func WithDbName

func WithDbName(dbName string) Neo4jOption

type Node

type Node struct {
	ElementId string
	Labels    []string
	Props     map[string]any
}

func (*Node) GetElementId

func (n *Node) GetElementId() string

func (*Node) GetProperties

func (n *Node) GetProperties() map[string]any

type Path

type Path struct {
	Nodes         []Node
	Relationships []Relationship
}

type Point2D

type Point2D struct {
	X float64
	Y float64

	// Id of coordinate reference system.
	SpatialRefId uint32
}

Point2D represents a two dimensional point in a particular coordinate reference system.

func (Point2D) String

func (p Point2D) String() string

String returns string representation of this point.

type Point3D

type Point3D struct {
	X float64
	Y float64
	Z float64

	// Id of coordinate reference system.
	SpatialRefId uint32
}

Point3D represents a three dimensional point in a particular coordinate reference system.

func (Point3D) String

func (p Point3D) String() string

String returns string representation of this point.

type PropertyValue

type PropertyValue interface {
	bool | int64 | float64 | string | time.Time |
		[]byte | []any | Point2D | Point3D
}

A type constraint for retrieving property values from a Neo4j entity.

type Record

type Record struct {
	Keys   []string
	Values []string
}

A record in a Neo4j query result.

func (*Record) AsMap

func (r *Record) AsMap() map[string]string

func (*Record) Get

func (r *Record) Get(key string) (string, bool)

func (*Record) JSONMarshal added in v0.17.0

func (r *Record) JSONMarshal() ([]byte, error)

type RecordValue

type RecordValue interface {
	bool | int64 | float64 | string | time.Time |
		[]byte | []any | map[string]any |
		Node | Relationship | Path | Point2D | Point3D
}

A type constraint for retrieving values from a Neo4j record.

type Relationship

type Relationship struct {
	ElementId      string
	StartElementId string
	EndElementId   string
	Type           string
	Props          map[string]any
}

A relationship in a Neo4j query result.

func (*Relationship) GetElementId

func (r *Relationship) GetElementId() string

func (*Relationship) GetProperties

func (r *Relationship) GetProperties() map[string]any

Jump to

Keyboard shortcuts

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