skyrama_tui/sqlc.yaml

43 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2026-06-04 20:51:20 +03:00
version: "2"
sql:
- engine: "mysql"
schema: "sql/schema.sql"
queries: "sql/queries.sql"
gen:
go:
package: "db"
out: "internal/db"
sql_package: "database/sql"
# Emit a Querier interface so you can mock the DB layer in tests
emit_interface: true
# Emit empty slices instead of nil for :many queries
emit_empty_slices: true
# Add JSON tags to generated structs (useful for debugging / logging)
emit_json_tags: true
# Keep struct names singular (airport not airports)
emit_exact_table_names: false
# Expose the raw SQL strings (handy for logging slow queries)
emit_exported_queries: true
# Override specific MySQL → Go type mappings
overrides:
# BIGINT UNSIGNED → uint64 (cash, experience_points)
- db_type: "bigint unsigned"
go_type: "uint64"
# INT UNSIGNED → uint32 (most IDs and resource fields)
- db_type: "int unsigned"
go_type: "uint32"
# SMALLINT UNSIGNED → uint16 (country / product IDs)
- db_type: "smallint unsigned"
go_type: "uint16"
# TINYINT UNSIGNED → uint8 (upgrade_tier)
- db_type: "tinyint unsigned"
go_type: "uint8"