Files
hspguard/sqlc.yaml
2025-06-04 12:32:47 +02:00

108 lines
3.3 KiB
YAML

version: "2"
sql:
- engine: "postgresql"
schema: "./migrations"
queries: "./queries"
gen:
go:
package: "repository"
sql_package: "pgx/v5"
emit_json_tags: true
out: "internal/repository"
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
# ───── bool ──────────────────────────────────────────
- db_type: "pg_catalog.bool" # or just "bool"
go_type: { type: "bool" }
- db_type: "bool" # or just "bool"
go_type: { type: "bool" }
- db_type: "pg_catalog.bool"
nullable: true
go_type:
type: "bool"
pointer: true # ⇒ *bool for NULLable columns
- db_type: "bool"
nullable: true
go_type:
type: "bool"
pointer: true # ⇒ *bool for NULLable columns
# ───── text ──────────────────────────────────────────
- db_type: "pg_catalog.text"
go_type: { type: "string" }
- db_type: "text" # or just "bool"
go_type: { type: "string" }
- db_type: "pg_catalog.text"
nullable: true
go_type:
type: "string"
pointer: true # ⇒ *bool for NULLable columns
- db_type: "text"
nullable: true
go_type:
type: "string"
pointer: true # ⇒ *bool for NULLable columns
# ───── timestamp (WITHOUT TZ) ────────────────────────
- db_type: "pg_catalog.timestamp" # or "timestamp"
go_type:
import: "time"
type: "Time"
- db_type: "timestamp" # or "timestamp"
go_type:
import: "time"
type: "Time"
- db_type: "pg_catalog.timestamp"
nullable: true
go_type:
import: "time"
type: "Time"
pointer: true
- db_type: "timestamp"
nullable: true
go_type:
import: "time"
type: "Time"
pointer: true
# ───── timestamptz (WITH TZ) ─────────────────────────
- db_type: "pg_catalog.timestamptz" # or "timestamptz"
go_type:
import: "time"
type: "Time"
- db_type: "timestamptz" # or "timestamptz"
go_type:
import: "time"
type: "Time"
- db_type: "pg_catalog.timestamptz"
nullable: true
go_type:
import: "time"
type: "Time"
pointer: true
- db_type: "timestamptz"
nullable: true
go_type:
import: "time"
type: "Time"
pointer: true