# Queries are generated from the migrations: the schema sqlc checks against is # the same SQL the server applies at boot, so there is no second description of # the database to keep in sync. # # Run it with ./scripts/sqlc.sh — the tool lives in a container, like the Go # toolchain does. version: "2" sql: - engine: postgresql schema: internal/store/migrations queries: internal/store/queries gen: go: package: dbgen out: internal/store/dbgen sql_package: pgx/v5 # Without these sqlc hands back pgtype.Timestamptz and int32, and every # mapping into a wire struct would have to unwrap them. These are the # types the hand-written scans already used. overrides: # Enums as plain strings. pgx has no encode plan for a named Go type # against an enum array, so a generated CampaignStatus type would # fail at run time on `= ANY($1::campaign_status[])` — which is how # every visibility filter in here is written. Strings are what the # hand-written queries passed, and the cast in the SQL is what turns # them into enum values. - db_type: "campaign_status" go_type: "string" - db_type: "pledge_status" go_type: "string" - db_type: "tier_type" go_type: "string" - db_type: "physical_tier_policy" go_type: "string" - db_type: "timestamptz" go_type: "time.Time" - db_type: "timestamptz" nullable: true go_type: type: "time.Time" pointer: true - db_type: "text" nullable: true go_type: type: "string" pointer: true - db_type: "pg_catalog.int4" go_type: "int" - db_type: "pg_catalog.int4" nullable: true go_type: type: "int" pointer: true