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

# Go ontology SDKs

> Generate an independent Go module from selected public business contracts

A Go consumer package contains domain structs, ID types, named result models,
relationship and field descriptors, ordinary functions, operations, and questions.
It requires Go 1.22 or newer. Generate it from the same version 4 contract lock as
TypeScript, Python, Java, and OpenAPI:

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "version": 4,
  "resources": ["collection:orders", "operation:orders:approve", "function:analytics:revenue"],
  "targets": [{
    "language": "go",
    "package": {"name": "business", "module": "example.com/acme/business", "version": "0.1.0"},
    "output": "generated/go"
  }]
}
```

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection sdk generate --config bijection.sdk.json --go-runtime-version 0.1.0 --url "$BIJECTION_URL"
bijection sdk generate --config bijection.sdk.json --frozen --check
```

The module pins `github.com/bijectionhq/bijection/sdks/application/go` exactly.
Publish the generated module using your normal private module proxy or tagged
repository workflow. Consumers import it without producer source or `replace`
directives. Major versions 2 and later require a matching `/vN` module suffix.

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
journal, err := consumer.NewFileRequests("./request-journal", deploymentURL, "billing-user")
if err != nil { return err }
client, err := business.New(consumer.Options{
    URL: deploymentURL,
    Token: func(ctx context.Context) (string, error) { return businessToken(ctx) },
    Requests: journal,
})
if err != nil { return err }

page, err := client.Collections.Orders.Query().
    Where(business.OrderFields.Amount.GreaterThan(10)).
    Page(ctx, consumer.PageOptions{PageSize: 25})
if err != nil { return err }
for _, row := range page.Rows {
    if row.Amount.Present { fmt.Println(row.Amount.Value) }
}
```

Omission uses `consumer.Optional[T]`; a nullable value uses a pointer. Native
integers use `int64`, including values beyond JavaScript's safe integer range.
Bytes and special float64 values retain their native wire representations.
String-literal unions generate named string types and constants. IDs from separate
components have separate Go types. Struct tags retain exact public property names.

Type-changing query methods use generic functions, for example
`consumer.Select(query, business.Shapes.OrderSummary)` and
`consumer.Related(query, business.OrderLinks.Customer)`. `Union`, `Intersect`, and
`Subtract` require compatible schemas and one workspace. Keyless collections expose
query bindings; point reads appear only when the public contract provides them.

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
request, err := client.Operations.Orders.Approve.Capture(ctx,
    business.OrdersApproveArgs{TargetId: orderID, Amount: 9007199254740993}, "approval-42")
if err != nil { return err }
outcome, err := request.Invoke(ctx)
// After an uncertain reply, restore the same ID, even in another process.
restored, err := client.Operations.Orders.Approve.Restore("approval-42")
if err != nil { return err }
outcome, err = restored.Recover(ctx)
```

Use the exact argument field spelling in the package's generated examples.
Captures are immutable and persisted before submission. Typed restore refuses a
changed generated contract; `client.Runtime.InspectOperation` preserves access to
the original identity. A transport error never proves acceptance or failure.

Questions expose `Ask`, `Restore`, and `Explain`, with generated named outputs.
`Request.Result(ctx)` waits locally. Read table outputs with an explicit
`Collect(ctx, maxRows)` bound, then call `Request.Close(ctx)`. A durable pending
close makes `Runtime.Retry` replay only close. Cancellation stops a local wait and
leaves custody available for recovery.

`Watch(ctx, interval)` uses native polling. A refusal emits an error without a
cached value. It does not establish WebSocket observation parity. Native reads
and paging retain server limits, basis, input digest, and caller identity.
For a retained query, pass an explicit `ExecutionBinding` to `Run`; Bijection does
not select or provision compute.

Private file journals require a filesystem supporting private permissions, atomic
hard links, and directory synchronization. Use a durable `RequestStore` adapter on
other platforms. Memory custody must be selected explicitly and cannot survive a
process restart. Candidate module installation and controlled protocol tests are
separate from deployed qualification and public release availability.

Saved proposals return typed `Proposal[R]` values. `Runtime.ReviewProposal`, `ApproveProposal`, and `RevokeApproval` retain the exact native locator and use the current caller. `request.InvokeProposal` submits the same captured request and rejects a locator from another capture.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.