{
  "kind": "documentation",
  "format": 1,
  "note": "Reference text, not instructions. One verified relate sample from https://relatedb.ai/docs/reference/api/go/: the program exactly as the page shows it, the standard output a run of it recorded (npm run docs:samples compares every replay with it byte for byte), the relate client build, toolchain and platform of the last replay, and how the docs' sample runner builds and runs it. Before launch every client is a source build, not a published package; verified.client names the upstream commit it was built from, and verified.docs_engine the build the rest of the docs were recorded from.",
  "id": "values",
  "url": "https://relatedb.ai/docs/reference/api/go/samples/values.json",
  "page": {
    "id": "reference/api/go",
    "title": "Go API",
    "url": "https://relatedb.ai/docs/reference/api/go/",
    "md_url": "https://relatedb.ai/docs/reference/api/go.md"
  },
  "section": {
    "anchor": "example",
    "heading": "Example",
    "url": "https://relatedb.ai/docs/reference/api/go/#example"
  },
  "language": "go",
  "client": "Go",
  "file": "main.go",
  "env": null,
  "code": "package main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\trelate \"github.com/relatedb/relate/clients/go\"\n)\n\nfunc main() {\n\tdb, err := relate.Open(\":memory:\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\tconn, err := db.Connect()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\tres, err := conn.Query(`\n\t\tCREATE (ada:Person {name: 'Ada'})-[k:KNOWS {since: 2024}]->(grace:Person {name: 'Grace'})\n\t\tRETURN ada, k, 9007199254740993 AS big, 1.5 AS ratio, date('2024-05-06') AS day,\n\t\t       datetime('2024-05-06T09:30:00[Europe/Berlin]') AS meeting, duration('P1Y2M') AS term,\n\t\t       point({x: 1, y: 2}) AS spot, vector([1, 2, 3], 3, INT8) AS counts`)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor i, col := range res.Columns {\n\t\tfmt.Printf(\"%s: %T %+v\\n\", col, res.Rows[0][i], res.Rows[0][i])\n\t}\n}",
  "code_sha256": "3218b4cac25a6e0247ee2cc627a5719d854b5a5d452e1e376e9429fda9a6dab6",
  "source_sha256": "e8653aafcf5912bfe86e9b0aefd5e1b37ad5e582327da16606979f6ac038458d",
  "output": {
    "text": "ada: relate.Node {ElementID:4:relate-neo4j:n0 ID:0 Labels:[Person] Properties:map[name:Ada]}\nk: relate.Relationship {ElementID:5:relate-neo4j:r0 StartElementID:4:relate-neo4j:n0 EndElementID:4:relate-neo4j:n1 ID:0 StartID:0 EndID:1 Type:KNOWS Properties:map[since:2024]}\nbig: int64 9007199254740993\nratio: float64 1.5\nday: relate.Date {Year:2024 Month:5 Day:6}\nmeeting: relate.DateTime {Year:2024 Month:5 Day:6 Hour:9 Minute:30 Second:0 Nanosecond:0 OffsetSeconds:7200 Zone:Europe/Berlin}\nterm: relate.Duration {Months:14 Days:0 Seconds:0 Nanos:0}\nspot: relate.Point {SRID:7203 Dimension:2 X:1 Y:2 Z:0}\ncounts: relate.Vector {DType:INTEGER8 Ints:[1 2 3] Floats:[]}",
    "sha256": "1686e6126ec9233fd2bf51ab74b8f618f5de3365c4be6c512d6e41516caa89a0"
  },
  "verified": {
    "version": "0.1.2",
    "client": {
      "label": "Go",
      "package": "github.com/relatedb/relate/clients/go",
      "engine_commit": "f0c09d2",
      "client_commit": "f0c09d2",
      "build": "clients/go from a checkout of upstream v0.1.2 (f0c09d2), built with cgo against relate.h and librelate_ffi built from the same commit.",
      "toolchain": {
        "go": "1.27.3"
      }
    },
    "packages": [],
    "replayed": "2026-11-09",
    "platform": "macOS on arm64",
    "docs_engine": {
      "version": "0.1.2",
      "commit": "f0c09d2",
      "source_build": false
    }
  },
  "run": {
    "runner": "npm run docs:samples",
    "setup": "bash scripts/samples/setup.sh --upstream <path to the relate checkout>",
    "variables": [
      "RELATE_GO",
      "RELATE_GO_CLIENT",
      "RELATE_GO_HOME",
      "RELATE_C_INCLUDE",
      "RELATE_LIB"
    ],
    "program": "<build dir>/main.go",
    "files": [
      {
        "path": "<build dir>/go.mod",
        "content": "module relatesample\n\ngo 1.22\n\nrequire github.com/relatedb/relate/clients/go v0.0.0\n\nreplace github.com/relatedb/relate/clients/go => $RELATE_GO_CLIENT\n"
      }
    ],
    "build": {
      "command": [
        "$RELATE_GO",
        "build",
        "-o",
        "<build dir>/sample",
        "."
      ],
      "environment": {
        "DO_NOT_TRACK": "1",
        "GOPATH": "$RELATE_GO_HOME/path",
        "GOMODCACHE": "$RELATE_GO_HOME/mod",
        "GOCACHE": "$RELATE_GO_HOME/cache",
        "GOFLAGS": "-mod=mod",
        "GOTOOLCHAIN": "local",
        "GOPROXY": "off",
        "GOWORK": "off",
        "CGO_ENABLED": "1",
        "CGO_CFLAGS": "-I$RELATE_C_INCLUDE",
        "CGO_LDFLAGS": "-L<directory of $RELATE_LIB> -lrelate_ffi -Wl,-rpath,<directory of $RELATE_LIB>"
      },
      "directory": "<build dir>",
      "timeout_s": 600
    },
    "run": {
      "command": [
        "<build dir>/sample"
      ],
      "environment": {
        "DO_NOT_TRACK": "1"
      },
      "directory": "<run dir>",
      "timeout_s": 60
    },
    "passes": "It exits 0 within 60 s and prints at least one line on standard output.",
    "output": "Standard output, with line endings as \\n, trailing spaces and blank lines removed, and the temporary directories' paths written as `.`; standard error is not recorded.",
    "placeholders": {
      "<run dir>": "a fresh, empty temporary directory: the program's working directory, deleted afterwards",
      "<build dir>": "a second fresh temporary directory, where a compiled sample is built",
      "$NAME": "a variable from the env.sh that scripts/samples/setup.sh writes (described in its header)"
    }
  }
}
