neo4j

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package neo4j provides Neo4j graph client helpers.

New code should use the core-owned graph boundary:

import "github.com/InsideGallery/core/db/neo4j"

client, err := neo4j.NewGraphClient(ctx, neo4j.Options{Host: "neo4j://127.0.0.1:7687"})

Prefer Graph, Options, and Result in application-facing code so the Neo4j SDK driver type stays inside this adapter package.

Compatibility: Client and GetConnection remain available for existing SDK-shaped callers. Prefer NewGraphClient for new integrations.

Index

Constants

View Source
const (
	TypeBasicAuth    = "BasicAuth"
	TypeKerberosAuth = "KerberosAuth"
	TypeBearerAuth   = "BearerAuth"
)
View Source
const EnvPrefix = "NEO4J"

EnvPrefix environment prefix for gremlin config

Variables

This section is empty.

Functions

This section is empty.

Types

type Client deprecated

type Client struct {
	neo4j.DriverWithContext
	// contains filtered or unexported fields
}

Client is the legacy Neo4j SDK-shaped client.

Deprecated: use GraphClient and core-owned option/result types for new code.

func GetConnection deprecated

func GetConnection(
	ctx context.Context,
	cfg *ConnectionConfig,
) (*Client, error)

GetConnection creates the legacy Neo4j SDK-shaped client.

Deprecated: use NewGraphClient for new code.

func (*Client) Close

func (c *Client) Close() error

type ConnectionConfig

type ConnectionConfig struct {
	Login    string `env:"_LOGIN" envDefault:"neo4j"`
	Password string `env:"_PASSWORD" envDefault:""`
	Realm    string `env:"_REALM" envDefault:""`
	Ticket   string `env:"_TICKET" envDefault:""`
	Token    string `env:"_TOKEN" envDefault:""`
	Host     string `env:"_HOST" envDefault:"neo4j://127.0.0.1:8080"`
	TypeAuth string `env:"_AUTH" envDefault:"NoAuth"`
}

ConnectionConfig contains required data for gremlin

func GetConnectionConfigFromEnv

func GetConnectionConfigFromEnv() (*ConnectionConfig, error)

GetConnectionConfigFromEnv return aerospike configs bases on environment variables

func (*ConnectionConfig) TokenManager

func (c *ConnectionConfig) TokenManager(m auth.TokenManager) auth.TokenManager

type Graph added in v1.1.0

type Graph interface {
	Verify(ctx context.Context) (Result, error)
	Close(ctx context.Context) error
}

Graph is the core-owned Neo4j contract for new consumers.

type GraphClient added in v1.1.0

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

GraphClient wraps the Neo4j driver behind core-owned operation inputs and results.

func NewGraphClient added in v1.1.0

func NewGraphClient(ctx context.Context, options Options) (*GraphClient, error)

NewGraphClient creates a Neo4j graph client from core-owned options.

func (*GraphClient) Close added in v1.1.0

func (c *GraphClient) Close(ctx context.Context) error

Close closes the Neo4j graph client.

func (*GraphClient) Verify added in v1.1.0

func (c *GraphClient) Verify(ctx context.Context) (Result, error)

Verify verifies Neo4j connectivity.

type Options added in v1.1.0

type Options struct {
	Host     string
	Login    string
	Password string
	Realm    string
	Ticket   string
	Token    string
	TypeAuth string
}

Options is the core-owned input for creating a Neo4j graph client.

type Result added in v1.1.0

type Result struct {
	Connected bool
}

Result is the core-owned result for Neo4j graph client operations.

Jump to

Keyboard shortcuts

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