127 lines
3.7 KiB
YAML
127 lines
3.7 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"
|
|
go_type: { type: "string" }
|
|
|
|
- db_type: "pg_catalog.text"
|
|
nullable: true
|
|
go_type:
|
|
type: "string"
|
|
pointer: true
|
|
|
|
- db_type: "text"
|
|
nullable: true
|
|
go_type:
|
|
type: "string"
|
|
pointer: true
|
|
|
|
- db_type: "pg_catalog.varchar"
|
|
go_type: { type: "string" }
|
|
|
|
- db_type: "varchar"
|
|
go_type: { type: "string" }
|
|
|
|
- db_type: "pg_catalog.varchar"
|
|
nullable: true
|
|
go_type:
|
|
type: "string"
|
|
pointer: true
|
|
|
|
- db_type: "varchar"
|
|
nullable: true
|
|
go_type:
|
|
type: "string"
|
|
pointer: true
|
|
|
|
# ───── 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
|