> ## Documentation Index
> Fetch the complete documentation index at: https://docs.helix-db.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Go SDK

> Build and execute HelixDB requests with ordinary Go functions

<div className="flex flex-wrap gap-2"><Badge color="blue" size="sm">Guide</Badge></div>

The forthcoming v3 Go SDK builds the shared operation-tree AST and executes it through
a typed client.

<Note>
  The v3 SDK packages have not been published yet. The Go SDK keeps the module path
  `github.com/helixdb/helix-db/sdks/go`; it does not add a `/v3` suffix.
</Note>

## Install

```bash theme={"languages":{"custom":["languages/helixql.json"]}}
go get github.com/helixdb/helix-db/sdks/go
```

```go theme={"languages":{"custom":["languages/helixql.json"]}}
import helix "github.com/helixdb/helix-db/sdks/go"
```

## Define a query

```go theme={"languages":{"custom":["languages/helixql.json"]}}
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

```go theme={"languages":{"custom":["languages/helixql.json"]}}
client, err := helix.NewClient("http://localhost:6969")
if err != nil {
	return err
}

var response struct {
	Users []map[string]any `json:"users"`
}
if err := client.Exec(ctx, FindUsers("acme", 25), &response); err != nil {
	return err
}
```

Write requests can pass `helix.WriterOnly()` and `helix.AwaitDurability(true)` execution
options. The client does not retry conflicts automatically.

## Embedded runtime

Install the SDK with `go get github.com/helixdb/helix-db/sdks/go`. See
[Embedded database](/database/helix-db/start-here/local-development/embedded-database)
for storage, cache, and handle configuration.

## Verify

```bash theme={"languages":{"custom":["languages/helixql.json"]}}
cd sdks/go
go test ./...
```

## Next steps

<CardGroup cols={2}>
  <Card title="Parameters" icon="sliders" href="/database/helix-db/query-guides/parameters">
    Bind typed values and bounds.
  </Card>

  <Card title="Error handling" icon="triangle-exclamation" href="/database/helix-cloud/operate/troubleshooting">
    Diagnose validation, conflict, and runtime failures.
  </Card>
</CardGroup>
