gremlin

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyntaxAerospike   = "aerospike"
	SyntaxNeptun      = "neptun"
	DefaultPropertyID = "id"
)
View Source
const EnvPrefix = "GREMLIN"

EnvPrefix environment prefix for gremlin config

Variables

View Source
var (
	PropertyID interface{} = DefaultPropertyID
	Syntax                 = SyntaxAerospike
)
View Source
var ErrCastType = errors.New("error cast type")

Functions

func ExecIterate

func ExecIterate(ch <-chan error) error

func GetConnection

func GetConnection(
	cfg *ConnectionConfig,
	configurations ...func(settings *gremlingo.DriverRemoteConnectionSettings),
) (*gremlingo.DriverRemoteConnection, error)

func MergeE

func MergeE(
	t *gremlingo.GraphTraversal,
	edge string,
	id string,
	vertex1, vertex2 *gremlingo.Vertex,
	properties map[interface{}]interface{},
) *gremlingo.GraphTraversal

func MergeV

func MergeV(
	t *gremlingo.GraphTraversal,
	label, id string,
	properties map[interface{}]interface{},
) *gremlingo.GraphTraversal

func PrepareProperties

func PrepareProperties(properties ...interface{}) map[interface{}]interface{}

func WrapCount

func WrapCount(t *gremlingo.GraphTraversal) (int64, error)

func WrapLabelFilter

func WrapLabelFilter(t *gremlingo.GraphTraversal, label string) *gremlingo.GraphTraversal

func WrapOrderAsc

func WrapOrderAsc(t *gremlingo.GraphTraversal, property string) *gremlingo.GraphTraversal

func WrapOrderDesc

func WrapOrderDesc(t *gremlingo.GraphTraversal, property string) *gremlingo.GraphTraversal

func WrapOrderGt

func WrapOrderGt(t *gremlingo.GraphTraversal, property string, value interface{}) *gremlingo.GraphTraversal

func WrapOrderGte

func WrapOrderGte(t *gremlingo.GraphTraversal, property string, value interface{}) *gremlingo.GraphTraversal

func WrapOrderLt

func WrapOrderLt(t *gremlingo.GraphTraversal, property string, value interface{}) *gremlingo.GraphTraversal

func WrapOrderLte

func WrapOrderLte(t *gremlingo.GraphTraversal, property string, value interface{}) *gremlingo.GraphTraversal

func WrapValuesToList

func WrapValuesToList(t *gremlingo.GraphTraversal, values string) ([]*gremlingo.Result, error)

Types

type Cache

type Cache struct {
	*registry.Registry[string, string, any]
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache

func (*Cache) AddVertex

func (c *Cache) AddVertex(label, id string, vertex *gremlingo.Vertex) error

func (*Cache) DeleteVertex

func (c *Cache) DeleteVertex(label, id string) error

func (*Cache) GetVertex

func (c *Cache) GetVertex(label, id string) (*gremlingo.Vertex, error)

func (*Cache) Truncate

func (c *Cache) Truncate()

type CallbackOp

type CallbackOp struct {
	*ResultOp
	// contains filtered or unexported fields
}

func NewCallbackOp

func NewCallbackOp(
	fn func(cache *Cache, source *gremlingo.GraphTraversalSource) ([]*gremlingo.Result, error),
) *CallbackOp

func (*CallbackOp) Execute

func (o *CallbackOp) Execute(cache *Cache, source *gremlingo.GraphTraversalSource) error

type Client

type Client struct {
	Connection *gremlingo.DriverRemoteConnection
}

func New

func New(
	cfg *ConnectionConfig,
	configurations ...func(settings *gremlingo.DriverRemoteConnectionSettings),
) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Execute

func (c *Client) Execute(cache *Cache, ops ...Operation) error

func (*Client) S

type CommonVertexGetter

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

func NewCommonVertexGetter

func NewCommonVertexGetter(vertex *gremlingo.Vertex, id string) CommonVertexGetter

func (CommonVertexGetter) Get

type ConnectionConfig

type ConnectionConfig struct {
	URL string `env:"_URL" envDefault:"ws://127.0.0.1:8182/gremlin"`
}

ConnectionConfig contains required data for gremlin

func GetConnectionConfigFromEnv

func GetConnectionConfigFromEnv() (*ConnectionConfig, error)

GetConnectionConfigFromEnv return aerospike configs bases on environment variables

type DropVertexOp

type DropVertexOp struct {
	*ResultOp
	// contains filtered or unexported fields
}

func NewDropVertexOp

func NewDropVertexOp(vertex VertexGetter) *DropVertexOp

func (*DropVertexOp) Execute

func (o *DropVertexOp) Execute(cache *Cache, source *gremlingo.GraphTraversalSource) error

type LabelVertexGetter

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

func NewLabelVertexGetter

func NewLabelVertexGetter(label string, id string) LabelVertexGetter

func (LabelVertexGetter) Get

type Operation

type Operation interface {
	Execute(cache *Cache, source *gremlingo.GraphTraversalSource) error
	Result() []*gremlingo.Result
}

type ResultOp

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

func (*ResultOp) Result

func (o *ResultOp) Result() []*gremlingo.Result

type UpsertEdgeOp

type UpsertEdgeOp struct {
	*ResultOp
	// contains filtered or unexported fields
}

func NewUpsertEdgeOp

func NewUpsertEdgeOp(
	edge string,
	id string,
	from VertexGetter,
	to VertexGetter,
	properties ...interface{},
) *UpsertEdgeOp

func (*UpsertEdgeOp) Execute

func (o *UpsertEdgeOp) Execute(cache *Cache, source *gremlingo.GraphTraversalSource) error

type UpsertVertexOp

type UpsertVertexOp struct {
	*ResultOp
	// contains filtered or unexported fields
}

func NewUpsertVertexOp

func NewUpsertVertexOp(label string, id string, properties ...interface{}) *UpsertVertexOp

func (*UpsertVertexOp) Execute

func (o *UpsertVertexOp) Execute(cache *Cache, source *gremlingo.GraphTraversalSource) error

type VertexGetter

type VertexGetter interface {
	Get(cache *Cache, source *gremlingo.GraphTraversalSource) (string, *gremlingo.Vertex, error)
}

Jump to

Keyboard shortcuts

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