OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add encoredev/skills --skill encore-go-database
Work with PostgreSQL in Encore Go using `sqldb.NewDatabase` from `encore.dev/storage/sqldb` — schema migrations and SQL queries.
npx skills add encoredev/skills --skill encore-go-database
Encore's database API mirrors Go's standard database/sql package. Use .Scan() to read query results into variables.
Query - Multiple RowsQueryRow - Single RowExec - No Return ValueFor INSERT, UPDATE, DELETE operations:
.up.sqlThe Scan method reads columns from query results into variables. Columns are mapped by position, not by name - the order of arguments to Scan must match the order of columns in your SELECT statement.
Always use parameterized queries:
$1, $2, etc.)Scan to read query results - columns are mapped by positionsqldb.ErrNoRows when expecting a single row