Sybren A. Stüvel
c046094880
GORM has certain downsides: - Code-first approach, where queries have to be translated to the Go code required to execute them. - GORM comes with its own SQLite implementation, which doesn't provide an on-connect callback. This means that new connections cannot correctly enable foreign key constraints, causing database consistency issues. [SQLC](https://sqlc.dev/) solves these issues for us. This commit doesn't fully replace GORM with SQLC, but introduces it for a few queries. Once all queries have been converted, GORM can be removed completely.
14 lines
365 B
YAML
14 lines
365 B
YAML
version: "2"
|
|
sql:
|
|
- engine: "sqlite"
|
|
schema: "internal/manager/persistence/sqlc/schema.sql"
|
|
queries: "internal/manager/persistence/sqlc/query.sql"
|
|
gen:
|
|
go:
|
|
out: "internal/manager/persistence/sqlc"
|
|
overrides:
|
|
- db_type: "jsonb"
|
|
go_type:
|
|
import: "encoding/json"
|
|
type: "RawMessage"
|