phase 2 (part 2): sqlc queries, audit/event helpers, event NOTIFY trigger
- sqlc.yaml + internal/db/queries/*.sql: typed queries for entities, relationships, ontology, operations (signals, events, audit, idempotency, entity_status) - internal/db/sqlcgen/: generated Go from sqlc (pgx/v5) - internal/observability/record.go: Audit() and Event() helpers that write in the caller's transaction (SG10). actorLabel is interim text identity in detail JSON until OIDC resolution lands; actor_id column exists but is not yet populated - migrations/008: post-commit pg_notify trigger on events table for SSE fan-out (SG8/SG10)
This commit is contained in:
39
sqlc.yaml
Normal file
39
sqlc.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
# sqlc — type-safe Go from SQL (plan SG17). `make generate` regenerates.
|
||||
#
|
||||
# Scope: API read/mutation paths use sqlc-generated queries
|
||||
# (internal/db/sqlcgen). The seed ingest and YAML export intentionally stay
|
||||
# hand-written pgx: they are generic bulk upserts driven by parsed YAML
|
||||
# shapes, where sqlc's static typing adds nothing.
|
||||
version: "2"
|
||||
sql:
|
||||
- engine: "postgresql"
|
||||
schema: "migrations"
|
||||
queries: "internal/db/queries"
|
||||
strict_order_by: false
|
||||
gen:
|
||||
go:
|
||||
package: "sqlcgen"
|
||||
out: "internal/db/sqlcgen"
|
||||
sql_package: "pgx/v5"
|
||||
emit_pointers_for_null_types: true
|
||||
overrides:
|
||||
- db_type: "uuid"
|
||||
go_type:
|
||||
import: "github.com/google/uuid"
|
||||
type: "UUID"
|
||||
- db_type: "uuid"
|
||||
nullable: true
|
||||
go_type:
|
||||
import: "github.com/google/uuid"
|
||||
type: "UUID"
|
||||
pointer: true
|
||||
- db_type: "timestamptz"
|
||||
go_type:
|
||||
import: "time"
|
||||
type: "Time"
|
||||
- db_type: "timestamptz"
|
||||
nullable: true
|
||||
go_type:
|
||||
import: "time"
|
||||
type: "Time"
|
||||
pointer: true
|
||||
Reference in New Issue
Block a user