Skip to main content

Go Runtime Guide

For AI-assisted development, use the generated Assist contracts with the TeaQL Agent Kit Harness Engineering workflow.

The Go target generates entity packages, typed Request builders, Q and E facades, relation metadata, loaded-state expressions and graph persistence code. Generated public names use Go casing while preserving Java Request semantics.

Start here

Use this sequence for a new Go service:

  1. Go Quick Start — model, generation layout, context assembly, first query and audited save.
  2. Go First Verification — prove a real SQLite round trip, governance gates, SQL semantics and regeneration.
  3. Go Customization — add trusted policy, behavior, validation, audit sinks and providers without editing generated files.
  4. Go Business Scenarios — move into relations, aggregates, pagination and optimistic mutations.

The Go runtime is published directly from GitHub as github.com/teaql/teaql-golang v0.1.4. The Quick Start shows both direct go get and generated-module verification; no local runtime checkout is required.

Runtime shape

Queries execute with one *runtime.UserContext. Providers and trusted request metadata are installed in that context; callers do not pass a second service or connection argument.

orders, err := lib.Q.CustomerOrders().
Comment("Find orders awaiting review").
Purpose("Prepare the authorized review queue").
ExecuteForList(context)

The generated Purpose transition exposes execution only after a non-empty comment has already been supplied. Filters, selections, ordering and pagination may appear between comment and purpose.

Mutations require explicit audit intent:

saved, err := order.AuditAs("Approve reviewed order").Save(context)
_ = saved

Verified providers

Runtime version documented here: v0.1.4 at commit 769358b.

DatabaseDriver observed in acceptanceFeature status
PostgreSQLgithub.com/lib/pq 1.10.9PASS
MySQLgithub.com/go-sql-driver/mysql 1.7.1PASS
SQLitegithub.com/mattn/go-sqlite3 1.14.16PASS

The Feature tests include root/parent/child filters, inclusive ranges, stable pagination, native COUNT/SUM/GROUP BY, relation hydration, exact per-parent Top-N, optimistic locking and both runtime audit paths.

Generation review checklist

After changing a model, inspect the generated q.go, entity request.go, entity.go and e.go. Never construct a plural method name yourself. Confirm the actual generated method before writing application code, then run go test ./... against the selected provider.