Closed
Description
Version
1.16.0
What happened?
I want to allow my application to limit how many records get updated but SQLC does not expose it in the code. I don't have the option to use a subquery with a limit (the code generation works) due to my MySQL version.
Relevant log output
const test = `-- name: Test :exec
UPDATE authors
SET bio="test"
WHERE name IS NULL
LIMIT ?
`
func (q *Queries) Test(ctx context.Context) error {
_, err := q.db.ExecContext(ctx, test)
return err
}
Database schema
CREATE TABLE authors (
id INT PRIMARY KEY,
name text NOT NULL,
bio text
);
SQL queries
-- name: Test :exec
UPDATE authors
SET bio="hello"
WHERE name IS NULL
LIMIT ?;
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "mysql",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/732de1ddc031aba2c5bfce20367a16435eedd43745324af4249b2b6803862430
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go