Skip to main content
For the complete documentation index optimized for AI agents, see llms.txt.
Queries for HelixDB can be authored directly in Go with the github.com/helixdb/helix-db/sdks/go module. The Go SDK is dynamic-first: write ordinary Go functions that return helix.Request, declare parameters inline, and execute with client.Exec(ctx, request, &out). There is no bundle-generation step in the primary Go workflow. For the traversal model and query patterns themselves, see Querying and the Querying Guide.

Prerequisites

  • Go 1.22 or later.
  • Optional: the Helix CLI for local development and ad-hoc query testing.

Create a project

Add the dependency

Import the SDK as helix:

Write query functions

Go queries are normal functions. Use helix.ReadQuery("name") or helix.WriteQuery("name") to set the dynamic request’s query_name, then declare runtime parameters inline with methods such as q.ParamString, q.ParamI64, and q.ParamDateTime.
Parameter refs can be passed directly into predicates, stream bounds, and mutation property inputs. The SDK inserts both parameters and parameter_types into the dynamic envelope.

Parameterize request-specific values

Direct Go values are serialized as literals in the query AST. This is useful for true constants, but it is not a runtime parameter:
For values that change per request, declare a q.Param* value and pass the returned ParamRef. That keeps the query shape stable and lets the server reuse cached work across requests:
The same rule applies to traversal predicates such as helix.PredEq, bounds such as Limit, mutation properties, and search inputs: pass a ParamRef for request-specific values, not a direct literal.

Return explicit variables

The names passed to Returning(...) define the top-level response object keys and should match your response struct tags:
Use zero-argument Returning() only when the response is intentionally empty, such as an idempotent index-creation request. The SDK serializes it as "returns":[].

Execute queries

Create the client once and reuse it:
For local development, pass "" or "http://localhost:6969" to NewClient.

Write queries

Use execution options when a write must hit the writer node or wait for durability:

Handle conflicts in application code

Client.Exec does not retry HTTP 409 Conflict responses automatically. Retry only when your operation is safe to replay. Remote errors are returned as *helix.HelixError with StatusCode set, and conflicts wrap helix.ErrConflict. Use helix.IsConflict(err) or errors.Is(err, helix.ErrConflict) instead of parsing the error text.

Next Steps

Querying

Dynamic query envelopes, client execution, and transactions.

Parameters & bundles

Parameter serialization across TypeScript, Rust, Go, and Python.

Local Development

Run HelixDB locally while developing queries.

Go SDK source

Go module source and README.