helix

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

HelixDB Go SDK

Go SDK for building and executing HelixDB server queries. Version v0.3.1 ships the operation-tree query builder and HTTP client.

Install

go get github.com/helixdb/helix-db/sdks/go@v0.3.1
import helix "github.com/helixdb/helix-db/sdks/go"

Query Functions

Write normal Go functions that return helix.Request. Set the query name with ReadQuery or WriteQuery, declare runtime parameters inline, then pass the request to Client.Exec.

type UserRow struct {
	ID       int64  `json:"$id"`
	Name     string `json:"name"`
	TenantID string `json:"tenantId"`
}

type FindUsersResponse struct {
	Users []UserRow `json:"users"`
}

func FindUsers(tenantID string, limit int64) helix.Request {
	q := helix.ReadQuery("find_users")

	tenant := q.ParamString("tenant_id", tenantID)
	maxRows := q.ParamI64("limit", limit)

	return q.
		VarAs("users",
			helix.G().
				NWithLabel("User").
				Where(helix.PredEq("tenantId", tenant)).
				Limit(maxRows).
				ValueMap("$id", "name", "tenantId"),
		).
		Returning("users")
}

Execute

client, err := helix.NewClient("http://localhost:6969")
if err != nil {
	return err
}

var out FindUsersResponse
err = client.Exec(ctx, FindUsers("acme", 25), &out)

Pass helix.WarmOnly() to mark a read for cache warming. Helix Cloud fans the request out to every eligible backend and returns 204 No Content after at least one succeeds, so do not expect a query payload. Combine it with helix.WriterOnly() to warm only the authoritative writer. Warm writes return 400 Bad Request before backend execution. A standalone local warm read can return its normal query payload instead.

err = client.Exec(ctx, FindUsers("acme", 25), nil, helix.WarmOnly())

Writes

type CreateUserResponse struct {
	User []UserRow `json:"user"`
}

func CreateUser(name string, tenantID string) helix.Request {
	q := helix.WriteQuery("create_user")

	nameParam := q.ParamString("name", name)
	tenant := q.ParamString("tenant_id", tenantID)

	return q.
		VarAs("user",
			helix.G().AddN("User", helix.Props{
				helix.Prop("name", nameParam),
				helix.Prop("tenantId", tenant),
			}),
		).
		Returning("user")
}

err = client.Exec(ctx, CreateUser("Alice", "acme"), &created,
	helix.WriterOnly(),
	helix.AwaitDurability(true),
)

Parameters

Parameter helpers insert both runtime values and parameter_types metadata:

q := helix.ReadQuery("recent_users")
tenant := q.ParamString("tenant_id", "acme")
createdAfter := q.ParamDateTime("created_after", "2026-01-01T00:00:00.000Z")
limit := q.ParamI64("limit", int64(10))

Parameter refs can be used in predicates, property inputs, and bounds.

For low-level request construction, wrap a typed batch with NewReadQueryRequest or NewWriteQueryRequest. Typed parameter metadata and its value are inserted atomically; explicitly untyped requests use WithUntypedParameter instead:

request := helix.NewReadQueryRequest(
	helix.Read().VarAs("users", helix.G().N(helix.AllNodes()).Count()).Returning("users"),
).
	WithQueryName("count_users").
	WithTypedParameter("tenant_id", helix.ParamTypeString(), helix.QueryString("acme"))

Direct Go values are serialized as literals in the inline AST. For example, helix.SourceEq("id", "foo") inlines the string "foo"; it does not create a runtime parameter. For request-specific values, declare a q.Param* value and pass the returned ref so stable query shapes can reuse server caches:

id := q.ParamString("id", userID)
helix.G().NWhere(helix.SourceEq("id", id))

Always pass explicit names to Returning(...) for values you want back. A zero-arg Returning() is supported for intentional empty responses and serializes as "returns":[].

Use TextSearchNodesWithin or TextSearchEdgesWithin after building a candidate traversal. These methods perform exact BM25 ranking over only the current IDs. Results equal an exhaustive search of the selected tenant partition, intersected with the unique input IDs, followed by deterministic top-k selection.

BM25 statistics still come from the full tenant partition.

func SearchVisibleDocuments(tenantID, queryText string, limit int64) helix.Request {
	q := helix.ReadQuery("search_visible_documents")
	tenant := q.ParamString("tenant_id", tenantID)
	query := q.ParamString("query", queryText)
	k := q.ParamI64("limit", limit)

	return q.
		VarAs("documents",
			helix.G().
				NWithLabel("Document").
				Where(helix.PredEq("tenantId", tenant)).
				TextSearchNodesWithin("Document", "body", query, k, tenant).
				Project(
					helix.ProjectPropAs("$id", "id"),
					helix.ProjectPropAs("$score", "score"),
					helix.ProjectProp("title"),
				),
		).
		Returning("documents")
}

The typed runtime-input forms are TextSearchNodesWithinWith and TextSearchEdgesWithinWith. Source-level TextSearchNodes[With] and TextSearchEdges[With] remain whole-partition searches.

Restricted results contain unique input IDs, return at most k, and order by $score descending then entity ID ascending. The selected input row keeps its bindings, path, and sack. An empty input returns without opening the text index. A wrong-kind input or more than 1,000,000 unique candidates is a query error. For a tenant-scoped index, pass the same tenant partition used to build the candidate stream.

Row Bindings

Use Bind(...) when a multi-hop traversal needs to keep earlier elements correlated with later results. Row bindings are row-local: each path keeps its own named bindings, and ProjectDistinctBindings(...) can emit one output row per projected tuple.

func ServiceWorkloads(tenantID string) helix.Request {
	q := helix.ReadQuery("service_workloads")
	tenant := q.ParamString("tenant_id", tenantID)

	return q.
		VarAs("dependencies",
			helix.G().
				NWithLabel("Service").
				Where(helix.PredEq("tenantId", tenant)).
				Bind("service").
				Out("ROUTES_TO").
				Where(helix.PredEq("tenantId", tenant)).
				Bind("pod").
				In("MANAGES").
				Where(helix.PredEq("tenantId", tenant)).
				Bind("owner").
				Union(
					helix.Sub().
						Where(helix.PredEq("type", "ReplicaSet")).
						In("CREATES").
						Where(helix.PredEq("type", "Deployment")).
						Where(helix.PredEq("tenantId", tenant)).
						Bind("workload"),
					helix.Sub().
						Where(helix.PredIsIn("type", []string{"Deployment", "StatefulSet", "DaemonSet"})).
						Bind("workload"),
				).
				ProjectDistinctBindings(
					helix.ProjectNamedBinding("service", "$id", "service_id"),
					helix.ProjectNamedBinding("workload", "$id", "workload_id"),
				),
		).
		Returning("dependencies")
}

Binding projections can read virtual fields such as $id, $label, $from, $to, $distance, and $score from either the current element or a named binding. Use ProjectBindingCoalesce(...) when optional branches may or may not create a binding.

Conflicts And Retries

Client.Exec does not retry HTTP 409 conflicts automatically. Callers should retry only when the operation is safe to replay. Remote errors are returned as *helix.HelixError with StatusCode and the static Code populated. Use helix.IsConflict(err) or errors.Is(err, helix.ErrConflict) to detect HTTP 409:

The canonical query error-code reference documents the complete catalog and migration contract.

func ExecWithConflictRetry(ctx context.Context, client *helix.Client, build func() helix.Request, out any) error {
	for attempt := 0; attempt < 3; attempt++ {
		err := client.Exec(ctx, build(), out)
		if err == nil || !helix.IsConflict(err) || attempt == 2 {
			return err
		}
		time.Sleep(time.Duration(attempt+1) * 50 * time.Millisecond)
	}
	return nil
}

Release scope

Version v0.3.1 does not distribute the generated native bindings required by the embedded database or native graph algorithms. A standard module install returns ErrNativeBindingsUnavailable from embedded constructors and ErrNativeGraphUnavailable from Client.Graph. Do not enable the helixdb_uniffi build tag unless you separately generate and link compatible bindings and native libraries.

Notes

  • Go queries post to /v2/query through client.Exec.
  • Stored-query registration and bundle generation are not supported.
  • Use MarshalRequest(req) only for tests, parity fixtures, or debugging.
  • int64 values serialize as JSON numbers; response decoding uses json.Decoder.UseNumber().
  • Datetime parameters serialize as RFC3339 UTC strings with millisecond precision.
  • Query JSON cannot represent bytes parameters; bytes remain valid node and edge property values.
  • Non-success responses return *HelixError with Kind: ErrorRemote, Details, and StatusCode; Cloud warm success is 204 No Content with no payload.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWriteTraversalInReadBatch = errors.New("helix: read batch cannot contain write traversal")
	ErrUnsupportedBytesParameter = errors.New("helix: query JSON cannot represent bytes parameters")
	ErrDuplicateParameter        = errors.New("helix: duplicate parameter")
	ErrEmptyParameterName        = errors.New("helix: parameter name must not be empty")
	ErrMixedParameterModes       = errors.New("helix: typed and untyped parameters cannot be mixed")
	ErrInvalidParameterType      = errors.New("helix: invalid parameter type")
	ErrInvalidDateTimeParameter  = errors.New("helix: invalid datetime parameter")
)
View Source
var ErrConflict = errors.New("helix: conflict")
View Source
var ErrNativeBindingsUnavailable = errors.New("helix embedded native bindings are not linked")
View Source
var ErrNativeGraphUnavailable = errors.New("helix: native graph bindings are not linked")

Functions

func IsConflict added in v0.1.1

func IsConflict(err error) bool

func MarshalRequest

func MarshalRequest(req Request) ([]byte, error)

Types

type AggregateFunction

type AggregateFunction string
const (
	AggregateCount AggregateFunction = "count"
	AggregateSum   AggregateFunction = "sum"
	AggregateMin   AggregateFunction = "min"
	AggregateMax   AggregateFunction = "max"
	AggregateMean  AggregateFunction = "mean"
)

type BatchCondition

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

func PrevNotEmpty

func PrevNotEmpty() BatchCondition

func VarEmpty

func VarEmpty(name string) BatchCondition

func VarMinSize

func VarMinSize(name string, size int) BatchCondition

func VarNotEmpty

func VarNotEmpty(name string) BatchCondition

func (BatchCondition) MarshalJSON

func (b BatchCondition) MarshalJSON() ([]byte, error)

func (*BatchCondition) UnmarshalJSON added in v0.3.0

func (b *BatchCondition) UnmarshalJSON(data []byte) error

type BatchEntry

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

func (BatchEntry) MarshalJSON

func (b BatchEntry) MarshalJSON() ([]byte, error)

func (*BatchEntry) UnmarshalJSON added in v0.3.0

func (b *BatchEntry) UnmarshalJSON(data []byte) error

type BatchQuery added in v0.3.0

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

BatchQuery is the closed read-or-write batch union used by QueryRequest.

func ReadBatchQuery added in v0.3.0

func ReadBatchQuery(batch *ReadBatch) BatchQuery

func WriteBatchQuery added in v0.3.0

func WriteBatchQuery(batch *WriteBatch) BatchQuery

func (BatchQuery) MarshalJSON added in v0.3.0

func (q BatchQuery) MarshalJSON() ([]byte, error)

func (BatchQuery) Validate added in v0.3.0

func (q BatchQuery) Validate() error

type BetweennessMode added in v0.3.0

type BetweennessMode uint8
const (
	BetweennessExact BetweennessMode = iota + 1
	BetweennessSampled
	BetweennessAuto
)

type BetweennessOptions added in v0.3.0

type BetweennessOptions struct {
	Mode         BetweennessMode
	SampleCount  uint64
	Seed         uint64
	ExactThrough uint64
	Normalized   bool
	Endpoints    bool
	Weighted     bool
}

func GraphifyBetweennessOptions added in v0.3.0

func GraphifyBetweennessOptions() BetweennessOptions

type BindingProjection added in v0.1.3

type BindingProjection struct {
	Kind   string            `json:"kind"`
	Target *BindingTarget    `json:"target,omitempty"`
	Source string            `json:"source,omitempty"`
	Alias  string            `json:"alias"`
	Refs   []BindingValueRef `json:"refs,omitempty"`
}

func ProjectBinding added in v0.1.3

func ProjectBinding(target BindingTarget, source, alias string) BindingProjection

func ProjectBindingCoalesce added in v0.1.3

func ProjectBindingCoalesce(refs []BindingValueRef, alias string) BindingProjection

func ProjectCurrentBinding added in v0.1.3

func ProjectCurrentBinding(source, alias string) BindingProjection

func ProjectNamedBinding added in v0.1.3

func ProjectNamedBinding(name, source, alias string) BindingProjection

func (BindingProjection) MarshalJSON added in v0.3.0

func (p BindingProjection) MarshalJSON() ([]byte, error)

type BindingTarget added in v0.1.3

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

func Binding added in v0.1.3

func Binding(name string) BindingTarget

func CurrentBinding added in v0.1.3

func CurrentBinding() BindingTarget

func (BindingTarget) MarshalJSON added in v0.1.3

func (t BindingTarget) MarshalJSON() ([]byte, error)

type BindingValueRef added in v0.1.3

type BindingValueRef struct {
	Target BindingTarget `json:"target"`
	Source string        `json:"source"`
}

func BindingValue added in v0.1.3

func BindingValue(target BindingTarget, source string) BindingValueRef

func CurrentBindingValue added in v0.1.3

func CurrentBindingValue(source string) BindingValueRef

func NamedBindingValue added in v0.1.3

func NamedBindingValue(name, source string) BindingValueRef

type Client

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

func NewClient

func NewClient(baseURL string, opts ...ClientOption) (*Client, error)

func NewEmbeddedClient added in v0.3.0

func NewEmbeddedClient(source HelixDbSource, opts ...ClientOption) (*Client, error)

func NewEmbeddedClientWithConfig added in v0.3.0

func NewEmbeddedClientWithConfig(source HelixDbSource, cache EmbeddedCacheConfig, opts ...ClientOption) (*Client, error)

func NewEmbeddedReaderClient added in v0.3.0

func NewEmbeddedReaderClient(source HelixDbSource, opts ...ClientOption) (*Client, error)

func NewEmbeddedReaderClientWithConfig added in v0.3.0

func NewEmbeddedReaderClientWithConfig(source HelixDbSource, cache EmbeddedCacheConfig, opts ...ClientOption) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) ClearAPIKey

func (c *Client) ClearAPIKey() *Client

func (*Client) Close added in v0.3.0

func (c *Client) Close() error

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, req Request, out any, opts ...ExecOption) error

func (*Client) Graph added in v0.3.0

func (c *Client) Graph(ctx context.Context, selection GraphSelection) (*NativeGraph, error)

Graph executes exactly one ordinary read and returns a reusable native graph.

func (*Client) WithAPIKey

func (c *Client) WithAPIKey(apiKey string) *Client

type ClientOption

type ClientOption func(*Client)

func WithAPIKey

func WithAPIKey(apiKey string) ClientOption

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

type Community added in v0.3.0

type Community struct {
	ID      string
	NodeIDs []string
}

type CommunityResult added in v0.3.0

type CommunityResult struct {
	Communities []Community
	Modularity  float64
	Levels      uint64
}

type CompareOp

type CompareOp string
const (
	CompareEq  CompareOp = "eq"
	CompareNeq CompareOp = "neq"
	CompareGt  CompareOp = "gt"
	CompareGte CompareOp = "gte"
	CompareLt  CompareOp = "lt"
	CompareLte CompareOp = "lte"
)

type Cycle added in v0.3.0

type Cycle struct {
	NodeIDs []string
	EdgeIDs []string
}

type CycleResult added in v0.3.0

type CycleResult struct {
	Cycles    []Cycle
	Truncated bool
}

type DateTime

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

func DateTimeFromMillis

func DateTimeFromMillis(millis int64) DateTime

func ParseDateTimeRFC3339

func ParseDateTimeRFC3339(input string) (DateTime, error)

func (DateTime) Millis

func (d DateTime) Millis() int64

func (DateTime) RFC3339

func (d DateTime) RFC3339() (string, error)

type DegreeKind added in v0.3.0

type DegreeKind uint8
const (
	DegreeIn DegreeKind = iota + 1
	DegreeOut
	DegreeTotal
)

type DiskSource added in v0.3.0

type DiskSource struct {
	Root     string
	Database string
}

type EdgeRef

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

func AllEdges added in v0.3.0

func AllEdges() EdgeRef

func EdgeID

func EdgeID(id uint64) EdgeRef

func EdgeIDs

func EdgeIDs(ids ...uint64) EdgeRef

func EdgeParam

func EdgeParam(name string) EdgeRef

func EdgeVar

func EdgeVar(name string) EdgeRef

func (EdgeRef) MarshalJSON

func (e EdgeRef) MarshalJSON() ([]byte, error)

type EdgeScore added in v0.3.0

type EdgeScore struct {
	EdgeID      string
	GraphifyKey *string
	Source      string
	Target      string
	Score       float64
}

type EdgeTraversalDirection added in v0.3.0

type EdgeTraversalDirection uint8
const (
	EdgeTraversalForward EdgeTraversalDirection = iota + 1
	EdgeTraversalReverse
)

type EmbeddedCacheConfig added in v0.3.0

type EmbeddedCacheConfig struct {
	VectorMemoryBytes uint64
	Mode              EmbeddedCacheMode
}

type EmbeddedCacheMode added in v0.3.0

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

type EmitBehavior

type EmitBehavior string
const (
	EmitNone   EmitBehavior = "none"
	EmitBefore EmitBehavior = "before"
	EmitAfter  EmitBehavior = "after"
	EmitAll    EmitBehavior = "all"
)

type ErrorKind

type ErrorKind string
const (
	ErrorNetwork             ErrorKind = "Network"
	ErrorRemote              ErrorKind = "Remote"
	ErrorSerialization       ErrorKind = "Serialization"
	ErrorInvalidURL          ErrorKind = "InvalidUrl"
	ErrorInvalidRequest      ErrorKind = "InvalidRequest"
	ErrorEmbedded            ErrorKind = "Embedded"
	ErrorEmbeddedUnavailable ErrorKind = "EmbeddedUnavailable"
)

type ExecOption

type ExecOption func(*execOptions)

func AwaitDurability

func AwaitDurability(should bool) ExecOption

func WarmOnly

func WarmOnly() ExecOption

func WriterOnly

func WriterOnly() ExecOption

type Expr

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

func ExprCase

func ExprCase(branches []WhenThen, elseExpr *Expr) Expr

func ExprDateTime

func ExprDateTime() Expr

func ExprID

func ExprID() Expr

func ExprParam

func ExprParam(name string) Expr

func ExprProp

func ExprProp(name string) Expr

func ExprTimestamp

func ExprTimestamp() Expr

func ExprVal

func ExprVal(value any) Expr

func (Expr) Add

func (e Expr) Add(other Expr) Expr

func (Expr) Div

func (e Expr) Div(other Expr) Expr

func (Expr) MarshalJSON

func (e Expr) MarshalJSON() ([]byte, error)

func (Expr) Mod

func (e Expr) Mod(other Expr) Expr

func (Expr) Mul

func (e Expr) Mul(other Expr) Expr

func (Expr) Neg

func (e Expr) Neg() Expr

func (Expr) Sub

func (e Expr) Sub(other Expr) Expr

type GraphDirection added in v0.3.0

type GraphDirection uint8

GraphDirection controls whether algorithms preserve stored edge direction.

const (
	GraphDirected GraphDirection = iota + 1
	GraphUndirected
)

type GraphEdge added in v0.3.0

type GraphEdge struct {
	ID             string
	GraphifyKey    *string
	Source         string
	Target         string
	Label          *string
	Weight         *float64
	AttributesJSON []byte
}

GraphEdge preserves stable Helix identity and optional Graphify key.

func (GraphEdge) Attributes added in v0.3.0

func (e GraphEdge) Attributes() (map[string]any, error)

type GraphNode added in v0.3.0

type GraphNode struct {
	ID             string
	Label          *string
	AttributesJSON []byte
}

GraphNode keeps selected attributes as lazy JSON bytes.

func (GraphNode) Attributes added in v0.3.0

func (n GraphNode) Attributes() (map[string]any, error)

type GraphSelection added in v0.3.0

type GraphSelection struct {
	NodeTraversal            *Traversal
	EdgeTraversal            *Traversal
	Direction                GraphDirection
	NodeProperties           []string
	EdgeProperties           []string
	ExternalIdentityProperty string
	GraphifyEdgeKeyProperty  string
	WeightProperty           string
	MaxNodes                 uint64
	MaxEdges                 uint64
	AllowFullScan            bool
}

GraphSelection builds the single ordinary read used by Client.Graph.

type HelixDbSource added in v0.3.0

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

type HelixError

type HelixError struct {
	Kind       ErrorKind
	Code       QueryErrorCode
	Details    string
	StatusCode int
	Err        error
}

func (*HelixError) Error

func (e *HelixError) Error() string

func (*HelixError) Unwrap

func (e *HelixError) Unwrap() error

type HybridCache added in v0.3.0

type HybridCache struct {
	SlateMemoryBytes     uint64
	SlateDiskPath        string
	SlateDiskBytes       uint64
	ObjectStoreDiskPath  string
	ObjectStoreDiskBytes uint64
}

type InMemorySource added in v0.3.0

type InMemorySource struct {
	Database string
}

type IndexDdlAccepted added in v0.3.0

type IndexDdlAccepted struct {
	Kind        string           `json:"kind"`
	OperationID IndexOperationID `json:"operation_id"`
	IndexID     string           `json:"index_id"`
	Generation  string           `json:"generation"`
}

IndexDdlAccepted reports newly accepted durable lifecycle work.

type IndexDdlAlreadyActive added in v0.3.0

type IndexDdlAlreadyActive struct {
	Kind       string `json:"kind"`
	IndexID    string `json:"index_id"`
	Generation string `json:"generation"`
}

IndexDdlAlreadyActive reports an identical active generation.

type IndexDdlExistingOperation added in v0.3.0

type IndexDdlExistingOperation struct {
	Kind        string           `json:"kind"`
	OperationID IndexOperationID `json:"operation_id"`
}

IndexDdlExistingOperation converges on already-running lifecycle work.

type IndexDdlReceipt added in v0.3.0

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

IndexDdlReceipt is implemented by every tagged CREATE/DROP receipt variant.

func UnmarshalIndexDdlReceipt added in v0.3.0

func UnmarshalIndexDdlReceipt(data []byte) (IndexDdlReceipt, error)

UnmarshalIndexDdlReceipt decodes a tagged receipt and ignores additive fields.

type IndexErrorCode added in v0.3.0

type IndexErrorCode string

IndexErrorCode is a stable machine-readable public lifecycle error.

const (
	IndexLifecycleUnavailable        IndexErrorCode = "index_lifecycle_unavailable"
	IndexAlreadyExists               IndexErrorCode = "index_already_exists"
	IndexDefinitionConflict          IndexErrorCode = "index_definition_conflict"
	IndexBusy                        IndexErrorCode = "index_busy"
	IndexNotFound                    IndexErrorCode = "index_not_found"
	IndexOperationNotFound           IndexErrorCode = "index_operation_not_found"
	IndexOperationNotAbortable       IndexErrorCode = "index_operation_not_abortable"
	IndexIDExhausted                 IndexErrorCode = "index_id_exhausted"
	VectorPhysicalIDExhausted        IndexErrorCode = "vector_physical_id_exhausted"
	IndexGenerationExhausted         IndexErrorCode = "index_generation_exhausted"
	IndexRevisionExhausted           IndexErrorCode = "index_revision_exhausted"
	IndexOperationRevisionExhausted  IndexErrorCode = "index_operation_revision_exhausted"
	StaleIndexGeneration             IndexErrorCode = "stale_index_generation"
	WriterFencedCommitOutcomeUnknown IndexErrorCode = "writer_fenced_commit_outcome_unknown"
)

type IndexOperationAborted added in v0.3.0

type IndexOperationAborted struct {
	Status string `json:"status"`
	IndexOperationStatusCommon
}

IndexOperationAborted completed cleanup for an explicitly aborted build.

type IndexOperationBlocked added in v0.3.0

type IndexOperationBlocked struct {
	Status string `json:"status"`
	IndexOperationStatusCommon
	BlockerCode IndexOperationBlockerCode `json:"blocker_code"`
	Message     string                    `json:"message,omitempty"`
}

IndexOperationBlocked requires an explicit retry or abort.

type IndexOperationBlockerCode added in v0.3.0

type IndexOperationBlockerCode string

IndexOperationBlockerCode is a stable reason explicit control is required.

const (
	IndexBlockerInvalidSourceData                   IndexOperationBlockerCode = "invalid_source_data"
	IndexBlockerUniquenessViolation                 IndexOperationBlockerCode = "uniqueness_violation"
	IndexBlockerOversizedEntity                     IndexOperationBlockerCode = "oversized_entity"
	IndexBlockerManifestLimit                       IndexOperationBlockerCode = "manifest_limit"
	IndexBlockerObjectStoreConfigurationUnavailable IndexOperationBlockerCode = "object_store_configuration_unavailable"
	IndexBlockerInvariantViolation                  IndexOperationBlockerCode = "invariant_violation"
)

type IndexOperationID added in v0.3.0

type IndexOperationID string

IndexOperationID is a canonical lowercase non-nil lifecycle UUID.

type IndexOperationProgress added in v0.3.0

type IndexOperationProgress struct {
	Entities         string `json:"entities"`
	InputBytes       string `json:"input_bytes"`
	OutputOperations string `json:"output_operations"`
	OutputBytes      string `json:"output_bytes"`
}

IndexOperationProgress contains decimal-string bounded-work counters.

type IndexOperationQueued added in v0.3.0

type IndexOperationQueued struct {
	Status string `json:"status"`
	IndexOperationStatusCommon
}

IndexOperationQueued is runnable, including bounded retry delay.

type IndexOperationRunning added in v0.3.0

type IndexOperationRunning struct {
	Status string `json:"status"`
	IndexOperationStatusCommon
}

IndexOperationRunning is currently claimed by a fenced writer.

type IndexOperationStatus added in v0.3.0

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

IndexOperationStatus is implemented by each tagged status variant.

func UnmarshalIndexOperationStatus added in v0.3.0

func UnmarshalIndexOperationStatus(data []byte) (IndexOperationStatus, error)

UnmarshalIndexOperationStatus decodes a tagged status and ignores additive fields.

type IndexOperationStatusCommon added in v0.3.0

type IndexOperationStatusCommon struct {
	OperationID   IndexOperationID       `json:"operation_id"`
	IndexID       string                 `json:"index_id"`
	Generation    string                 `json:"generation"`
	OperationKind string                 `json:"operation_kind"`
	Family        string                 `json:"family"`
	Stage         string                 `json:"stage"`
	Attempt       uint32                 `json:"attempt"`
	Progress      IndexOperationProgress `json:"progress"`
}

IndexOperationStatusCommon contains fields shared by every status variant.

type IndexOperationSucceeded added in v0.3.0

type IndexOperationSucceeded struct {
	Status string `json:"status"`
	IndexOperationStatusCommon
}

IndexOperationSucceeded completed a build or drop successfully.

type IndexSpec

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

func EdgeEqualityIndex

func EdgeEqualityIndex(label, property string) IndexSpec

func EdgeRangeDescIndex added in v0.1.2

func EdgeRangeDescIndex(label, property string) IndexSpec

func EdgeRangeIndex

func EdgeRangeIndex(label, property string) IndexSpec

func EdgeRangeIndexWithDirection added in v0.1.2

func EdgeRangeIndexWithDirection(label, property string, direction RangeIndexDirection) IndexSpec

func EdgeTextIndex

func EdgeTextIndex(label, property string, tenantProperty ...string) IndexSpec

func EdgeVectorIndex

func EdgeVectorIndex(label, property string, dimension uint, metric VectorDistanceMetric, tenantProperty ...string) IndexSpec

func NodeEqualityIndex

func NodeEqualityIndex(label, property string) IndexSpec

func NodeRangeDescIndex added in v0.1.2

func NodeRangeDescIndex(label, property string) IndexSpec

func NodeRangeIndex

func NodeRangeIndex(label, property string) IndexSpec

func NodeRangeIndexWithDirection added in v0.1.2

func NodeRangeIndexWithDirection(label, property string, direction RangeIndexDirection) IndexSpec

func NodeTextIndex

func NodeTextIndex(label, property string, tenantProperty ...string) IndexSpec

func NodeUniqueEqualityIndex

func NodeUniqueEqualityIndex(label, property string) IndexSpec

func NodeVectorIndex

func NodeVectorIndex(label, property string, dimension uint, metric VectorDistanceMetric, tenantProperty ...string) IndexSpec

func (IndexSpec) MarshalJSON

func (i IndexSpec) MarshalJSON() ([]byte, error)

type LayoutOptions added in v0.3.0

type LayoutOptions struct {
	K                *float64
	Iterations       uint64
	Seed             uint64
	Weighted         bool
	InitialPositions []NodePosition
}

type LouvainOptions added in v0.3.0

type LouvainOptions struct {
	Resolution float64
	Threshold  float64
	Seed       uint64
	MaxLevels  uint64
}

type MemoryCache added in v0.3.0

type MemoryCache struct{}

type NamedQuery

type NamedQuery struct {
	Name      string          `json:"name,omitempty"`
	Root      any             `json:"root"`
	Condition *BatchCondition `json:"condition,omitempty"`
}

type NativeGraph added in v0.3.0

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

NativeGraph is immutable; algorithms never query Helix after construction.

func (*NativeGraph) AttributesJSON added in v0.3.0

func (g *NativeGraph) AttributesJSON() ([]byte, error)

func (*NativeGraph) BetweennessCentrality added in v0.3.0

func (g *NativeGraph) BetweennessCentrality(options BetweennessOptions) ([]NodeScore, error)

func (*NativeGraph) Compose added in v0.3.0

func (g *NativeGraph) Compose(right *NativeGraph) (*NativeGraph, error)

func (*NativeGraph) ContainsEdge added in v0.3.0

func (g *NativeGraph) ContainsEdge(id string) bool

func (*NativeGraph) ContainsNode added in v0.3.0

func (g *NativeGraph) ContainsNode(id string) bool

func (*NativeGraph) Copy added in v0.3.0

func (g *NativeGraph) Copy() *NativeGraph

func (*NativeGraph) Degree added in v0.3.0

func (g *NativeGraph) Degree(id string, kind DegreeKind) (NodeDegree, error)

func (*NativeGraph) Degrees added in v0.3.0

func (g *NativeGraph) Degrees(kind DegreeKind) []NodeDegree

func (*NativeGraph) Edge added in v0.3.0

func (g *NativeGraph) Edge(id string) (*GraphEdge, error)

func (*NativeGraph) EdgeBetweennessCentrality added in v0.3.0

func (g *NativeGraph) EdgeBetweennessCentrality(options BetweennessOptions) ([]EdgeScore, error)

func (*NativeGraph) EdgeCount added in v0.3.0

func (g *NativeGraph) EdgeCount() uint64

func (*NativeGraph) Edges added in v0.3.0

func (g *NativeGraph) Edges() ([]GraphEdge, error)

func (*NativeGraph) EdgesBetween added in v0.3.0

func (g *NativeGraph) EdgesBetween(source, target string, direction TraversalDirection) ([]string, error)

func (*NativeGraph) HasEdgeBetween added in v0.3.0

func (g *NativeGraph) HasEdgeBetween(source, target string, direction TraversalDirection) (bool, error)

func (*NativeGraph) InEdgeIDs added in v0.3.0

func (g *NativeGraph) InEdgeIDs(id string) ([]string, error)

func (*NativeGraph) IncidentEdgeIDs added in v0.3.0

func (g *NativeGraph) IncidentEdgeIDs(id string) ([]string, error)

func (*NativeGraph) InducedSubgraph added in v0.3.0

func (g *NativeGraph) InducedSubgraph(ids []string) (*NativeGraph, error)

func (*NativeGraph) IsDirected added in v0.3.0

func (g *NativeGraph) IsDirected() bool

func (*NativeGraph) IsMultigraph added in v0.3.0

func (g *NativeGraph) IsMultigraph() bool

func (*NativeGraph) LouvainCommunities added in v0.3.0

func (g *NativeGraph) LouvainCommunities(options LouvainOptions) (CommunityResult, error)

func (*NativeGraph) Neighbors added in v0.3.0

func (g *NativeGraph) Neighbors(id string, direction TraversalDirection) ([]string, error)

func (*NativeGraph) Node added in v0.3.0

func (g *NativeGraph) Node(id string) (*GraphNode, error)

func (*NativeGraph) NodeCount added in v0.3.0

func (g *NativeGraph) NodeCount() uint64

func (*NativeGraph) Nodes added in v0.3.0

func (g *NativeGraph) Nodes() ([]GraphNode, error)

func (*NativeGraph) OutEdgeIDs added in v0.3.0

func (g *NativeGraph) OutEdgeIDs(id string) ([]string, error)

func (*NativeGraph) Predecessors added in v0.3.0

func (g *NativeGraph) Predecessors(id string) ([]string, error)

func (*NativeGraph) Relabel added in v0.3.0

func (g *NativeGraph) Relabel(mapping map[string]string) (*NativeGraph, error)

func (*NativeGraph) ShortestPath added in v0.3.0

func (g *NativeGraph) ShortestPath(source, target string, direction TraversalDirection, labels []string, maxDepth *uint64) (PathResult, error)

func (*NativeGraph) SimpleCycles added in v0.3.0

func (g *NativeGraph) SimpleCycles(lengthBound uint64, maxCycles *uint64) (CycleResult, error)

func (*NativeGraph) SpringLayout added in v0.3.0

func (g *NativeGraph) SpringLayout(options LayoutOptions) ([]NodePosition, error)

func (*NativeGraph) Successors added in v0.3.0

func (g *NativeGraph) Successors(id string) ([]string, error)

func (*NativeGraph) ToUndirected added in v0.3.0

func (g *NativeGraph) ToUndirected() (*NativeGraph, error)

func (*NativeGraph) Traverse added in v0.3.0

func (g *NativeGraph) Traverse(options TraversalOptions) (TraversalResult, error)

type NodeDegree added in v0.3.0

type NodeDegree struct {
	NodeID         string
	Degree         uint64
	WeightedDegree float64
}

type NodePosition added in v0.3.0

type NodePosition struct {
	NodeID string
	X      float64
	Y      float64
}

type NodeRef

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

func AllNodes

func AllNodes() NodeRef

func NodeID

func NodeID(id uint64) NodeRef

func NodeIDs

func NodeIDs(ids ...uint64) NodeRef

func NodeParam

func NodeParam(name string) NodeRef

func NodeVar

func NodeVar(name string) NodeRef

func (NodeRef) MarshalJSON

func (n NodeRef) MarshalJSON() ([]byte, error)

type NodeScore added in v0.3.0

type NodeScore struct {
	NodeID string
	Score  float64
}

type ObjectEntry

type ObjectEntry struct {
	Key   string
	Value PropertyValue
}

func Entry

func Entry(key string, value any) ObjectEntry

type ObjectStorageSource added in v0.3.0

type ObjectStorageSource struct {
	Database  string
	Bucket    string
	Region    string
	Endpoint  string
	AllowHTTP bool
}

type Order

type Order string
const (
	OrderAsc  Order = "asc"
	OrderDesc Order = "desc"
)

type Ordering

type Ordering struct {
	Property string
	Order    Order
}

func (Ordering) MarshalJSON

func (o Ordering) MarshalJSON() ([]byte, error)

type ParamKind

type ParamKind uint8

type ParamRef

type ParamRef struct {
	Name string
	Type QueryParamType
}

func (ParamRef) Bound

func (p ParamRef) Bound() StreamBound

func (ParamRef) Expr

func (p ParamRef) Expr() Expr

func (ParamRef) Input

func (p ParamRef) Input() PropertyInput

func (ParamRef) MarshalJSON

func (p ParamRef) MarshalJSON() ([]byte, error)

type PathEdge added in v0.3.0

type PathEdge struct {
	EdgeID             string
	GraphifyKey        *string
	Source             string
	Target             string
	TraversalDirection EdgeTraversalDirection
	Label              *string
	AttributesJSON     []byte
}

type PathError

type PathError struct {
	Path string
	Err  error
}

func (*PathError) Error

func (e *PathError) Error() string

func (*PathError) Unwrap

func (e *PathError) Unwrap() error

type PathResult added in v0.3.0

type PathResult struct {
	Kind    PathResultKind
	NodeIDs []string
	Edges   []PathEdge
}

type PathResultKind added in v0.3.0

type PathResultKind uint8
const (
	PathMissingSource PathResultKind = iota + 1
	PathMissingTarget
	PathNoPath
	PathFound
)

type Predicate

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

func PredAnd

func PredAnd(preds ...Predicate) Predicate

func PredBetween

func PredBetween(property string, min any, max any) Predicate

func PredCompare

func PredCompare(left Expr, op CompareOp, right Expr) Predicate

func PredContains

func PredContains(property, needle string) Predicate

func PredContainsExpr

func PredContainsExpr(property string, expr Expr) Predicate

func PredEndsWith

func PredEndsWith(property, suffix string) Predicate

func PredEq

func PredEq(property string, value any) Predicate

func PredGt

func PredGt(property string, value any) Predicate

func PredGte

func PredGte(property string, value any) Predicate

func PredHasKey

func PredHasKey(property string) Predicate

func PredIsIn

func PredIsIn(property string, value any) Predicate

func PredIsInExpr

func PredIsInExpr(property string, expr Expr) Predicate

func PredIsNotNull

func PredIsNotNull(property string) Predicate

func PredIsNull

func PredIsNull(property string) Predicate

func PredLt

func PredLt(property string, value any) Predicate

func PredLte

func PredLte(property string, value any) Predicate

func PredNeq

func PredNeq(property string, value any) Predicate

func PredNot

func PredNot(pred Predicate) Predicate

func PredOr

func PredOr(preds ...Predicate) Predicate

func PredStartsWith

func PredStartsWith(property, prefix string) Predicate

func (Predicate) MarshalJSON

func (p Predicate) MarshalJSON() ([]byte, error)

type Projection

type Projection struct {
	Source string `json:"source,omitempty"`
	Alias  string `json:"alias"`
	Expr   *Expr  `json:"expr,omitempty"`
}

func ProjectExpr

func ProjectExpr(alias string, expr Expr) Projection

func ProjectFromEndpoint added in v0.1.2

func ProjectFromEndpoint(source, alias string) Projection

func ProjectProp

func ProjectProp(source string) Projection

func ProjectPropAs

func ProjectPropAs(source, alias string) Projection

func ProjectToEndpoint added in v0.1.2

func ProjectToEndpoint(source, alias string) Projection

func (Projection) MarshalJSON

func (p Projection) MarshalJSON() ([]byte, error)

type PropPair

type PropPair struct {
	Name  string
	Value PropertyInput
}

func Prop

func Prop(name string, value any) PropPair

func PropInput

func PropInput(name string, value PropertyInput) PropPair

func (PropPair) MarshalJSON

func (p PropPair) MarshalJSON() ([]byte, error)

type PropertyInput

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

func ExprInput

func ExprInput(expr Expr) PropertyInput

func ParamInput

func ParamInput(name string) PropertyInput

func ValueInput

func ValueInput(value any) PropertyInput

func (PropertyInput) MarshalJSON

func (p PropertyInput) MarshalJSON() ([]byte, error)

type PropertyValue

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

func Array

func Array(v ...PropertyValue) PropertyValue

func Bool

func Bool(v bool) PropertyValue

func Bytes

func Bytes(v []byte) PropertyValue

func DateTimeMillis

func DateTimeMillis(v int64) PropertyValue

func F32

func F32(v float32) PropertyValue

func F32Array

func F32Array(v ...float32) PropertyValue

func F64

func F64(v float64) PropertyValue

func F64Array

func F64Array(v ...float64) PropertyValue

func I64

func I64(v int64) PropertyValue

func I64Array

func I64Array(v ...int64) PropertyValue

func MustPropertyValue

func MustPropertyValue(value any) PropertyValue

func Null

func Null() PropertyValue

func Object

func Object(v map[string]PropertyValue) PropertyValue

func ObjectFromEntries

func ObjectFromEntries(entries ...ObjectEntry) PropertyValue

func PropertyValueOf

func PropertyValueOf(value any) (PropertyValue, error)

func String

func String(v string) PropertyValue

func StringArray

func StringArray(v ...string) PropertyValue

func (PropertyValue) MarshalJSON

func (p PropertyValue) MarshalJSON() ([]byte, error)

type Props

type Props []PropPair

type QueryErrorCode added in v0.3.0

type QueryErrorCode string

type QueryParamType

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

func ParamTypeArray

func ParamTypeArray(inner QueryParamType) QueryParamType

func ParamTypeBool

func ParamTypeBool() QueryParamType

func ParamTypeBytes

func ParamTypeBytes() QueryParamType

func ParamTypeDateTime

func ParamTypeDateTime() QueryParamType

func ParamTypeF32

func ParamTypeF32() QueryParamType

func ParamTypeF64

func ParamTypeF64() QueryParamType

func ParamTypeI64

func ParamTypeI64() QueryParamType

func ParamTypeObject

func ParamTypeObject() QueryParamType

func ParamTypeString

func ParamTypeString() QueryParamType

func ParamTypeValue

func ParamTypeValue() QueryParamType

func (QueryParamType) MarshalJSON

func (q QueryParamType) MarshalJSON() ([]byte, error)

func (*QueryParamType) UnmarshalJSON added in v0.3.0

func (q *QueryParamType) UnmarshalJSON(data []byte) error

func (QueryParamType) Validate added in v0.3.0

func (q QueryParamType) Validate() error

type QueryRequest added in v0.3.0

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

func NewQueryRequest added in v0.3.0

func NewQueryRequest(query BatchQuery) *QueryRequest

func NewReadQueryRequest added in v0.3.0

func NewReadQueryRequest(query *ReadBatch) *QueryRequest

func NewWriteQueryRequest added in v0.3.0

func NewWriteQueryRequest(query *WriteBatch) *QueryRequest

func (*QueryRequest) ClearQueryName added in v0.3.0

func (q *QueryRequest) ClearQueryName()

func (*QueryRequest) InsertTypedParameter added in v0.3.0

func (q *QueryRequest) InsertTypedParameter(name string, ty QueryParamType, value QueryValue) error

func (*QueryRequest) InsertUntypedParameter added in v0.3.0

func (q *QueryRequest) InsertUntypedParameter(name string, value QueryValue) error

func (*QueryRequest) MarshalJSON added in v0.3.0

func (q *QueryRequest) MarshalJSON() ([]byte, error)

func (*QueryRequest) ParamArray added in v0.3.0

func (q *QueryRequest) ParamArray(name string, value any, inner QueryParamType) ParamRef

func (*QueryRequest) ParamBool added in v0.3.0

func (q *QueryRequest) ParamBool(name string, value bool) ParamRef

func (*QueryRequest) ParamDateTime added in v0.3.0

func (q *QueryRequest) ParamDateTime(name string, value any) ParamRef

func (*QueryRequest) ParamF32 added in v0.3.0

func (q *QueryRequest) ParamF32(name string, value any) ParamRef

func (*QueryRequest) ParamF64 added in v0.3.0

func (q *QueryRequest) ParamF64(name string, value any) ParamRef

func (*QueryRequest) ParamI64 added in v0.3.0

func (q *QueryRequest) ParamI64(name string, value any) ParamRef

func (*QueryRequest) ParamObject added in v0.3.0

func (q *QueryRequest) ParamObject(name string, value any, inner ...QueryParamType) ParamRef

func (*QueryRequest) ParamString added in v0.3.0

func (q *QueryRequest) ParamString(name string, value string) ParamRef

func (*QueryRequest) ParamValue added in v0.3.0

func (q *QueryRequest) ParamValue(name string, value any) ParamRef

func (*QueryRequest) RequestType added in v0.3.0

func (q *QueryRequest) RequestType() QueryRequestType

func (*QueryRequest) SetQueryName added in v0.3.0

func (q *QueryRequest) SetQueryName(name string)

func (*QueryRequest) Validate added in v0.3.0

func (q *QueryRequest) Validate() error

func (*QueryRequest) WithQueryName added in v0.3.0

func (q *QueryRequest) WithQueryName(name string) *QueryRequest

func (*QueryRequest) WithTypedParameter added in v0.3.0

func (q *QueryRequest) WithTypedParameter(name string, ty QueryParamType, value QueryValue) *QueryRequest

func (*QueryRequest) WithUntypedParameter added in v0.3.0

func (q *QueryRequest) WithUntypedParameter(name string, value QueryValue) *QueryRequest

type QueryRequestType added in v0.3.0

type QueryRequestType string
const (
	RequestTypeRead  QueryRequestType = "read"
	RequestTypeWrite QueryRequestType = "write"
)

type QueryValue added in v0.3.0

type QueryValue any

func QueryArray added in v0.3.0

func QueryArray(values ...QueryValue) QueryValue

func QueryBool added in v0.3.0

func QueryBool(value bool) QueryValue

func QueryF32 added in v0.3.0

func QueryF32(value float32) QueryValue

func QueryF64 added in v0.3.0

func QueryF64(value float64) QueryValue

func QueryI64 added in v0.3.0

func QueryI64(value int64) QueryValue

func QueryNull added in v0.3.0

func QueryNull() QueryValue

func QueryObject added in v0.3.0

func QueryObject(values map[string]QueryValue) QueryValue

func QueryString added in v0.3.0

func QueryString(value string) QueryValue

type RangeIndexDirection added in v0.1.2

type RangeIndexDirection string
const (
	RangeIndexAsc  RangeIndexDirection = "asc"
	RangeIndexDesc RangeIndexDirection = "desc"
)

type ReadBatch

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

func Read

func Read() *ReadBatch

func (*ReadBatch) Err

func (b *ReadBatch) Err() error

func (*ReadBatch) ForEachParam

func (b *ReadBatch) ForEachParam(param string, body *ReadBatch) *ReadBatch

func (*ReadBatch) MarshalJSON

func (b *ReadBatch) MarshalJSON() ([]byte, error)

func (*ReadBatch) Returning

func (b *ReadBatch) Returning(vars ...string) *ReadBatch

func (*ReadBatch) UnmarshalJSON added in v0.3.0

func (b *ReadBatch) UnmarshalJSON(data []byte) error

func (*ReadBatch) Validate

func (b *ReadBatch) Validate() error

func (*ReadBatch) VarAs

func (b *ReadBatch) VarAs(name string, traversal *Traversal) *ReadBatch

func (*ReadBatch) VarAsIf

func (b *ReadBatch) VarAsIf(name string, condition BatchCondition, traversal *Traversal) *ReadBatch

type ReadQueryBuilder

type ReadQueryBuilder struct{ QueryRequest }

func ReadQuery

func ReadQuery(name string) *ReadQueryBuilder

func (*ReadQueryBuilder) ForEachParam

func (q *ReadQueryBuilder) ForEachParam(param string, body *ReadBatch) *ReadQueryBuilder

func (*ReadQueryBuilder) ParamArray

func (q *ReadQueryBuilder) ParamArray(name string, value any, inner QueryParamType) ParamRef

func (*ReadQueryBuilder) ParamBool

func (q *ReadQueryBuilder) ParamBool(name string, value bool) ParamRef

func (*ReadQueryBuilder) ParamDateTime

func (q *ReadQueryBuilder) ParamDateTime(name string, value any) ParamRef

func (*ReadQueryBuilder) ParamF32

func (q *ReadQueryBuilder) ParamF32(name string, value any) ParamRef

func (*ReadQueryBuilder) ParamF64

func (q *ReadQueryBuilder) ParamF64(name string, value any) ParamRef

func (*ReadQueryBuilder) ParamI64

func (q *ReadQueryBuilder) ParamI64(name string, value any) ParamRef

func (*ReadQueryBuilder) ParamObject

func (q *ReadQueryBuilder) ParamObject(name string, value any, inner ...QueryParamType) ParamRef

func (*ReadQueryBuilder) ParamString

func (q *ReadQueryBuilder) ParamString(name string, value string) ParamRef

func (*ReadQueryBuilder) ParamValue

func (q *ReadQueryBuilder) ParamValue(name string, value any) ParamRef

func (*ReadQueryBuilder) Returning

func (q *ReadQueryBuilder) Returning(vars ...string) Request

func (*ReadQueryBuilder) VarAs

func (q *ReadQueryBuilder) VarAs(name string, traversal *Traversal) *ReadQueryBuilder

func (*ReadQueryBuilder) VarAsIf

func (q *ReadQueryBuilder) VarAsIf(name string, condition BatchCondition, traversal *Traversal) *ReadQueryBuilder

func (*ReadQueryBuilder) WithTypedParameter added in v0.3.0

func (q *ReadQueryBuilder) WithTypedParameter(name string, ty QueryParamType, value QueryValue) *ReadQueryBuilder

func (*ReadQueryBuilder) WithUntypedParameter added in v0.3.0

func (q *ReadQueryBuilder) WithUntypedParameter(name string, value QueryValue) *ReadQueryBuilder

type RepeatConfig

type RepeatConfig struct {
	Traversal     SubTraversal `json:"traversal"`
	Times         *int         `json:"times"`
	Until         *Predicate   `json:"until"`
	Emit          EmitBehavior `json:"emit"`
	EmitPredicate *Predicate   `json:"emit_predicate"`
	MaxDepth      int          `json:"max_depth"`
}

func Repeat

func Repeat(traversal SubTraversal) RepeatConfig

func (RepeatConfig) EmitAfter

func (r RepeatConfig) EmitAfter() RepeatConfig

func (RepeatConfig) EmitAll

func (r RepeatConfig) EmitAll() RepeatConfig

func (RepeatConfig) EmitBefore

func (r RepeatConfig) EmitBefore() RepeatConfig

func (RepeatConfig) EmitIf

func (r RepeatConfig) EmitIf(pred Predicate) RepeatConfig

func (RepeatConfig) MarshalJSON added in v0.3.0

func (r RepeatConfig) MarshalJSON() ([]byte, error)

func (RepeatConfig) UntilPred

func (r RepeatConfig) UntilPred(pred Predicate) RepeatConfig

func (RepeatConfig) WithMaxDepth

func (r RepeatConfig) WithMaxDepth(max int) RepeatConfig

func (RepeatConfig) WithTimes

func (r RepeatConfig) WithTimes(times int) RepeatConfig

type Request

type Request interface {
	json.Marshaler
	Validate() error
	// contains filtered or unexported methods
}

type ShortestPathDirection added in v0.3.0

type ShortestPathDirection string
const (
	ShortestPathOut  ShortestPathDirection = "out"
	ShortestPathIn   ShortestPathDirection = "in"
	ShortestPathBoth ShortestPathDirection = "both"
)

type ShortestPathOptions added in v0.3.0

type ShortestPathOptions struct {
	Label     string
	Direction ShortestPathDirection
}

type SourcePredicate

type SourcePredicate = Predicate

func SourceAnd

func SourceAnd(preds ...SourcePredicate) SourcePredicate

func SourceBetween

func SourceBetween(property string, min any, max any) SourcePredicate

func SourceCompare added in v0.3.0

func SourceCompare(left Expr, op CompareOp, right Expr) SourcePredicate

func SourceContains added in v0.3.0

func SourceContains(property, needle string) SourcePredicate

func SourceContainsExpr added in v0.3.0

func SourceContainsExpr(property string, expr Expr) SourcePredicate

func SourceEndsWith added in v0.3.0

func SourceEndsWith(property, suffix string) SourcePredicate

func SourceEq

func SourceEq(property string, value any) SourcePredicate

func SourceGt

func SourceGt(property string, value any) SourcePredicate

func SourceGte

func SourceGte(property string, value any) SourcePredicate

func SourceHasKey

func SourceHasKey(property string) SourcePredicate

func SourceIsIn added in v0.3.0

func SourceIsIn(property string, value any) SourcePredicate

func SourceIsInExpr added in v0.3.0

func SourceIsInExpr(property string, expr Expr) SourcePredicate

func SourceIsNotNull added in v0.3.0

func SourceIsNotNull(property string) SourcePredicate

func SourceIsNull added in v0.3.0

func SourceIsNull(property string) SourcePredicate

func SourceLt

func SourceLt(property string, value any) SourcePredicate

func SourceLte

func SourceLte(property string, value any) SourcePredicate

func SourceNeq

func SourceNeq(property string, value any) SourcePredicate

func SourceNot added in v0.3.0

func SourceNot(pred SourcePredicate) SourcePredicate

func SourceOr

func SourceOr(preds ...SourcePredicate) SourcePredicate

func SourceStartsWith

func SourceStartsWith(property, prefix string) SourcePredicate

type Step

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

func CreateTextIndexEdgesStep

func CreateTextIndexEdgesStep(label, property string, tenantProperty ...string) Step

func CreateTextIndexNodesStep

func CreateTextIndexNodesStep(label, property string, tenantProperty ...string) Step

func CreateVectorIndexEdgesStep

func CreateVectorIndexEdgesStep(
	label, property string,
	dimension uint,
	metric VectorDistanceMetric,
	tenantProperty ...string,
) Step

func CreateVectorIndexNodesStep

func CreateVectorIndexNodesStep(
	label, property string,
	dimension uint,
	metric VectorDistanceMetric,
	tenantProperty ...string,
) Step

func (Step) MarshalJSON

func (s Step) MarshalJSON() ([]byte, error)

func (Step) ToAST added in v0.3.0

func (s Step) ToAST(input any) (any, error)

type StreamBound

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

func BoundExpr

func BoundExpr(expr Expr) StreamBound

func BoundLiteral

func BoundLiteral(value int) StreamBound

func (StreamBound) MarshalJSON

func (s StreamBound) MarshalJSON() ([]byte, error)

type SubTraversal

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

func Sub

func Sub() SubTraversal

func SubTraversalFromSteps

func SubTraversalFromSteps(steps []Step) SubTraversal

func (SubTraversal) Bind added in v0.1.3

func (s SubTraversal) Bind(name string) SubTraversal

func (SubTraversal) Both

func (s SubTraversal) Both(label ...string) SubTraversal

func (SubTraversal) Count

func (s SubTraversal) Count() SubTraversal

func (SubTraversal) In

func (s SubTraversal) In(label ...string) SubTraversal

func (SubTraversal) Limit

func (s SubTraversal) Limit(bound any) SubTraversal

func (SubTraversal) MarshalJSON

func (s SubTraversal) MarshalJSON() ([]byte, error)

func (SubTraversal) Out

func (s SubTraversal) Out(label ...string) SubTraversal

func (SubTraversal) Where

func (s SubTraversal) Where(pred Predicate) SubTraversal

type Traversal

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

func G

func G() *Traversal

func TraversalFromSteps

func TraversalFromSteps(steps []Step) *Traversal

func (*Traversal) AbortIndexOperation added in v0.3.0

func (t *Traversal) AbortIndexOperation(operationID string) *Traversal

AbortIndexOperation converts one constructing build into abort cleanup.

func (*Traversal) AddE

func (t *Traversal) AddE(label string, to NodeRef, props Props) *Traversal

func (*Traversal) AddN

func (t *Traversal) AddN(label string, props Props) *Traversal

func (*Traversal) AggregateBy

func (t *Traversal) AggregateBy(fn AggregateFunction, property string) *Traversal

func (*Traversal) As

func (t *Traversal) As(name string) *Traversal

func (*Traversal) Bind added in v0.1.3

func (t *Traversal) Bind(name string) *Traversal

func (*Traversal) Both

func (t *Traversal) Both(label ...string) *Traversal

func (*Traversal) BothE

func (t *Traversal) BothE(label ...string) *Traversal

func (*Traversal) Choose

func (t *Traversal) Choose(condition Predicate, thenTraversal SubTraversal, elseTraversal ...SubTraversal) *Traversal

func (*Traversal) Coalesce

func (t *Traversal) Coalesce(traversals ...SubTraversal) *Traversal

func (*Traversal) Count

func (t *Traversal) Count() *Traversal

func (*Traversal) CreateIndexIfNotExists

func (t *Traversal) CreateIndexIfNotExists(spec IndexSpec) *Traversal

func (*Traversal) CreateTextIndexEdges

func (t *Traversal) CreateTextIndexEdges(label, property string, tenantProperty ...string) *Traversal

func (*Traversal) CreateTextIndexNodes

func (t *Traversal) CreateTextIndexNodes(label, property string, tenantProperty ...string) *Traversal

func (*Traversal) CreateVectorIndexEdges

func (t *Traversal) CreateVectorIndexEdges(
	label, property string,
	dimension uint,
	metric VectorDistanceMetric,
	tenantProperty ...string,
) *Traversal

func (*Traversal) CreateVectorIndexNodes

func (t *Traversal) CreateVectorIndexNodes(
	label, property string,
	dimension uint,
	metric VectorDistanceMetric,
	tenantProperty ...string,
) *Traversal

func (*Traversal) Dedup

func (t *Traversal) Dedup() *Traversal

func (*Traversal) Drop

func (t *Traversal) Drop() *Traversal

func (*Traversal) DropEdge

func (t *Traversal) DropEdge(to NodeRef) *Traversal

func (*Traversal) DropEdgeByID

func (t *Traversal) DropEdgeByID(ref EdgeRef) *Traversal

func (*Traversal) DropEdgeLabeled

func (t *Traversal) DropEdgeLabeled(to NodeRef, label string) *Traversal

func (*Traversal) DropIndex

func (t *Traversal) DropIndex(spec IndexSpec) *Traversal

func (*Traversal) E

func (t *Traversal) E(ref EdgeRef) *Traversal

func (*Traversal) EWhere

func (t *Traversal) EWhere(pred SourcePredicate) *Traversal

func (*Traversal) EWithLabel

func (t *Traversal) EWithLabel(label string) *Traversal

func (*Traversal) EWithLabelWhere

func (t *Traversal) EWithLabelWhere(label string, pred SourcePredicate) *Traversal

func (*Traversal) EdgeHas

func (t *Traversal) EdgeHas(property string, value any) *Traversal

func (*Traversal) EdgeHasLabel

func (t *Traversal) EdgeHasLabel(label string) *Traversal

func (*Traversal) EdgeProperties

func (t *Traversal) EdgeProperties() *Traversal

func (*Traversal) Err

func (t *Traversal) Err() error

func (*Traversal) Exists

func (t *Traversal) Exists() *Traversal

func (*Traversal) Fold

func (t *Traversal) Fold() *Traversal

func (*Traversal) GetIndexOperation added in v0.3.0

func (t *Traversal) GetIndexOperation(operationID string) *Traversal

GetIndexOperation reads one retained operation in the request storage scope.

func (*Traversal) Group

func (t *Traversal) Group(property string) *Traversal

func (*Traversal) GroupCount

func (t *Traversal) GroupCount(property string) *Traversal

func (*Traversal) Has

func (t *Traversal) Has(property string, value any) *Traversal

func (*Traversal) HasKey

func (t *Traversal) HasKey(property string) *Traversal

func (*Traversal) HasLabel

func (t *Traversal) HasLabel(label string) *Traversal

func (*Traversal) ID

func (t *Traversal) ID() *Traversal

func (*Traversal) In

func (t *Traversal) In(label ...string) *Traversal

func (*Traversal) InE

func (t *Traversal) InE(label ...string) *Traversal

func (*Traversal) InN

func (t *Traversal) InN() *Traversal

func (*Traversal) Inject

func (t *Traversal) Inject(name string) *Traversal

func (*Traversal) Label

func (t *Traversal) Label() *Traversal

func (*Traversal) Limit

func (t *Traversal) Limit(bound any) *Traversal

func (*Traversal) MarshalJSON

func (t *Traversal) MarshalJSON() ([]byte, error)

func (*Traversal) N

func (t *Traversal) N(ref NodeRef) *Traversal

func (*Traversal) NWhere

func (t *Traversal) NWhere(pred SourcePredicate) *Traversal

func (*Traversal) NWithLabel

func (t *Traversal) NWithLabel(label string) *Traversal

func (*Traversal) NWithLabelWhere

func (t *Traversal) NWithLabelWhere(label string, pred SourcePredicate) *Traversal

func (*Traversal) Optional

func (t *Traversal) Optional(traversal SubTraversal) *Traversal

func (*Traversal) OrderBy

func (t *Traversal) OrderBy(property string, order Order) *Traversal

func (*Traversal) OrderByMultiple

func (t *Traversal) OrderByMultiple(orderings ...Ordering) *Traversal

func (*Traversal) OtherN

func (t *Traversal) OtherN() *Traversal

func (*Traversal) Out

func (t *Traversal) Out(label ...string) *Traversal

func (*Traversal) OutE

func (t *Traversal) OutE(label ...string) *Traversal

func (*Traversal) OutN

func (t *Traversal) OutN() *Traversal

func (*Traversal) Path

func (t *Traversal) Path() *Traversal

func (*Traversal) Project

func (t *Traversal) Project(projections ...Projection) *Traversal

func (*Traversal) ProjectBindings added in v0.1.3

func (t *Traversal) ProjectBindings(projections ...BindingProjection) *Traversal

func (*Traversal) ProjectDistinctBindings added in v0.1.3

func (t *Traversal) ProjectDistinctBindings(projections ...BindingProjection) *Traversal

func (*Traversal) Range

func (t *Traversal) Range(start any, end any) *Traversal

func (*Traversal) RemoveProperty

func (t *Traversal) RemoveProperty(name string) *Traversal

func (*Traversal) Repeat

func (t *Traversal) Repeat(config RepeatConfig) *Traversal

func (*Traversal) RetryIndexOperation added in v0.3.0

func (t *Traversal) RetryIndexOperation(operationID string) *Traversal

RetryIndexOperation convergently requeues one blocked operation.

func (*Traversal) Root added in v0.3.0

func (t *Traversal) Root() (any, error)

func (*Traversal) SackAdd

func (t *Traversal) SackAdd(property string) *Traversal

func (*Traversal) SackGet

func (t *Traversal) SackGet() *Traversal

func (*Traversal) SackSet

func (t *Traversal) SackSet(property string) *Traversal

func (*Traversal) Select

func (t *Traversal) Select(name string) *Traversal

func (*Traversal) SetProperty

func (t *Traversal) SetProperty(name string, value any) *Traversal

func (*Traversal) ShortestPath added in v0.3.0

func (t *Traversal) ShortestPath(source, target NodeRef, maxDepth int, options ...ShortestPathOptions) *Traversal

func (*Traversal) SimplePath

func (t *Traversal) SimplePath() *Traversal

func (*Traversal) Skip

func (t *Traversal) Skip(bound any) *Traversal

func (*Traversal) Steps

func (t *Traversal) Steps() []Step

func (*Traversal) Store

func (t *Traversal) Store(name string) *Traversal

func (*Traversal) TextSearchEdges

func (t *Traversal) TextSearchEdges(label, property string, queryText any, k any, tenantValue ...any) *Traversal

func (*Traversal) TextSearchEdgesWith

func (t *Traversal) TextSearchEdgesWith(label, property string, queryText PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) TextSearchEdgesWithin added in v0.3.0

func (t *Traversal) TextSearchEdgesWithin(label, property string, queryText any, k any, tenantValue ...any) *Traversal

TextSearchEdgesWithin ranks only the current edge stream.

func (*Traversal) TextSearchEdgesWithinWith added in v0.3.0

func (t *Traversal) TextSearchEdgesWithinWith(label, property string, queryText PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) TextSearchNodes

func (t *Traversal) TextSearchNodes(label, property string, queryText any, k any, tenantValue ...any) *Traversal

func (*Traversal) TextSearchNodesWith

func (t *Traversal) TextSearchNodesWith(label, property string, queryText PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) TextSearchNodesWithin added in v0.3.0

func (t *Traversal) TextSearchNodesWithin(label, property string, queryText any, k any, tenantValue ...any) *Traversal

TextSearchNodesWithin ranks only the current node stream.

func (*Traversal) TextSearchNodesWithinWith added in v0.3.0

func (t *Traversal) TextSearchNodesWithinWith(label, property string, queryText PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) Unfold

func (t *Traversal) Unfold() *Traversal

func (*Traversal) Union

func (t *Traversal) Union(traversals ...SubTraversal) *Traversal

func (*Traversal) Validate

func (t *Traversal) Validate() error

func (*Traversal) ValueMap

func (t *Traversal) ValueMap(properties ...string) *Traversal

func (*Traversal) ValueMapAll

func (t *Traversal) ValueMapAll() *Traversal

func (*Traversal) Values

func (t *Traversal) Values(properties ...string) *Traversal

func (*Traversal) VectorSearchEdges

func (t *Traversal) VectorSearchEdges(label, property string, queryVector any, k any, tenantValue ...any) *Traversal

func (*Traversal) VectorSearchEdgesWith

func (t *Traversal) VectorSearchEdgesWith(label, property string, queryVector PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) VectorSearchEdgesWithin added in v0.3.0

func (t *Traversal) VectorSearchEdgesWithin(label, property string, queryVector any, k any, tenantValue ...any) *Traversal

VectorSearchEdgesWithin ranks only the current edge stream.

func (*Traversal) VectorSearchEdgesWithinWith added in v0.3.0

func (t *Traversal) VectorSearchEdgesWithinWith(label, property string, queryVector PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) VectorSearchNodes

func (t *Traversal) VectorSearchNodes(label, property string, queryVector any, k any, tenantValue ...any) *Traversal

func (*Traversal) VectorSearchNodesWith

func (t *Traversal) VectorSearchNodesWith(label, property string, queryVector PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) VectorSearchNodesWithin added in v0.3.0

func (t *Traversal) VectorSearchNodesWithin(label, property string, queryVector any, k any, tenantValue ...any) *Traversal

VectorSearchNodesWithin ranks only the current node stream.

func (*Traversal) VectorSearchNodesWithinWith added in v0.3.0

func (t *Traversal) VectorSearchNodesWithinWith(label, property string, queryVector PropertyInput, k StreamBound, tenantValue *PropertyInput) *Traversal

func (*Traversal) Where

func (t *Traversal) Where(pred Predicate) *Traversal

func (*Traversal) WithSack

func (t *Traversal) WithSack(value any) *Traversal

func (*Traversal) Within

func (t *Traversal) Within(name string) *Traversal

func (*Traversal) Without

func (t *Traversal) Without(name string) *Traversal

type TraversalDirection added in v0.3.0

type TraversalDirection uint8
const (
	TraversalOut TraversalDirection = iota + 1
	TraversalIn
	TraversalBoth
)

type TraversalOptions added in v0.3.0

type TraversalOptions struct {
	Strategy                   TraversalStrategy
	Seeds                      []string
	MaxDepth                   uint64
	Direction                  TraversalDirection
	AllowedLabels              []string
	StopNonSeedAtOrAboveDegree *uint64
}

type TraversalResult added in v0.3.0

type TraversalResult struct {
	Visits         []Visit
	DiscoveryEdges []TraversedEdge
}

type TraversalStrategy added in v0.3.0

type TraversalStrategy uint8
const (
	TraversalBreadthFirst TraversalStrategy = iota + 1
	TraversalDepthFirst
)

type TraversedEdge added in v0.3.0

type TraversedEdge struct {
	EdgeID             string
	GraphifyKey        *string
	Source             string
	Target             string
	TraversalDirection EdgeTraversalDirection
	Label              *string
}

type VectorDistanceMetric added in v0.3.0

type VectorDistanceMetric string
const (
	VectorDistanceCosine    VectorDistanceMetric = "cosine"
	VectorDistanceEuclidean VectorDistanceMetric = "euclidean"
	VectorDistanceManhattan VectorDistanceMetric = "manhattan"
)

type VectorMemoryOnlyCache added in v0.3.0

type VectorMemoryOnlyCache struct{}

type Visit added in v0.3.0

type Visit struct {
	NodeID         string
	Depth          uint64
	DiscoveryOrder uint64
}

type WhenThen added in v0.3.0

type WhenThen struct {
	When Predicate
	Then Expr
}

type WriteBatch

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

func Write

func Write() *WriteBatch

func (*WriteBatch) Err

func (b *WriteBatch) Err() error

func (*WriteBatch) ForEachParam

func (b *WriteBatch) ForEachParam(param string, body *WriteBatch) *WriteBatch

func (*WriteBatch) MarshalJSON

func (b *WriteBatch) MarshalJSON() ([]byte, error)

func (*WriteBatch) Returning

func (b *WriteBatch) Returning(vars ...string) *WriteBatch

func (*WriteBatch) UnmarshalJSON added in v0.3.0

func (b *WriteBatch) UnmarshalJSON(data []byte) error

func (*WriteBatch) Validate

func (b *WriteBatch) Validate() error

func (*WriteBatch) VarAs

func (b *WriteBatch) VarAs(name string, traversal *Traversal) *WriteBatch

func (*WriteBatch) VarAsIf

func (b *WriteBatch) VarAsIf(name string, condition BatchCondition, traversal *Traversal) *WriteBatch

type WriteQueryBuilder

type WriteQueryBuilder struct{ QueryRequest }

func WriteQuery

func WriteQuery(name string) *WriteQueryBuilder

func (*WriteQueryBuilder) ForEachParam

func (q *WriteQueryBuilder) ForEachParam(param string, body *WriteBatch) *WriteQueryBuilder

func (*WriteQueryBuilder) ParamArray

func (q *WriteQueryBuilder) ParamArray(name string, value any, inner QueryParamType) ParamRef

func (*WriteQueryBuilder) ParamBool

func (q *WriteQueryBuilder) ParamBool(name string, value bool) ParamRef

func (*WriteQueryBuilder) ParamDateTime

func (q *WriteQueryBuilder) ParamDateTime(name string, value any) ParamRef

func (*WriteQueryBuilder) ParamF32

func (q *WriteQueryBuilder) ParamF32(name string, value any) ParamRef

func (*WriteQueryBuilder) ParamF64

func (q *WriteQueryBuilder) ParamF64(name string, value any) ParamRef

func (*WriteQueryBuilder) ParamI64

func (q *WriteQueryBuilder) ParamI64(name string, value any) ParamRef

func (*WriteQueryBuilder) ParamObject

func (q *WriteQueryBuilder) ParamObject(name string, value any, inner ...QueryParamType) ParamRef

func (*WriteQueryBuilder) ParamString

func (q *WriteQueryBuilder) ParamString(name string, value string) ParamRef

func (*WriteQueryBuilder) ParamValue

func (q *WriteQueryBuilder) ParamValue(name string, value any) ParamRef

func (*WriteQueryBuilder) Returning

func (q *WriteQueryBuilder) Returning(vars ...string) Request

func (*WriteQueryBuilder) VarAs

func (q *WriteQueryBuilder) VarAs(name string, traversal *Traversal) *WriteQueryBuilder

func (*WriteQueryBuilder) VarAsIf

func (q *WriteQueryBuilder) VarAsIf(name string, condition BatchCondition, traversal *Traversal) *WriteQueryBuilder

func (*WriteQueryBuilder) WithTypedParameter added in v0.3.0

func (q *WriteQueryBuilder) WithTypedParameter(name string, ty QueryParamType, value QueryValue) *WriteQueryBuilder

func (*WriteQueryBuilder) WithUntypedParameter added in v0.3.0

func (q *WriteQueryBuilder) WithUntypedParameter(name string, value QueryValue) *WriteQueryBuilder

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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