Version
1.25.0
What happened?
Trying to use the @ operator as a shortcut to sqlc.arg, but it does not work when engine is mysql. The parameter is incorrectly being parsed as a static value.
relevant feature documentation: https://docs.sqlc.dev/en/stable/howto/named_parameters.html#naming-parameters
Relevant log output
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: query.sql
package db
import (
"context"
"database/sql"
)
const getMyTableValue = `-- name: GetMyTableValue :one
SELECT id FROM my_table
WHERE id = @value_id LIMIT 1
`
func (q *Queries) GetMyTableValue(ctx context.Context) (sql.NullString, error) {
row := q.db.QueryRowContext(ctx, getMyTableValue)
var id sql.NullString
err := row.Scan(&id)
return id, err
}
Database schema
CREATE TABLE my_table (
id varchar(255)
);
SQL queries
-- name: GetMyTableValue :one
SELECT * FROM my_table
WHERE id = @value_id LIMIT 1;
Configuration
{
"version": "2",
"sql": [{
"schema": "schema.sql",
"queries": "query.sql",
"engine": "mysql",
"gen": {
"go": {
"out": "db"
}
}
}]
}
Playground URL
https://play.sqlc.dev/p/9c89fc27cef434eb92e45c7215a562aa26c184cd68649be2716b7ac4016b7133
What operating system are you using?
No response
What database engines are you using?
MySQL
What type of code are you generating?
Go
Version
1.25.0
What happened?
Trying to use the @ operator as a shortcut to sqlc.arg, but it does not work when engine is mysql. The parameter is incorrectly being parsed as a static value.
relevant feature documentation: https://docs.sqlc.dev/en/stable/howto/named_parameters.html#naming-parameters
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/9c89fc27cef434eb92e45c7215a562aa26c184cd68649be2716b7ac4016b7133
What operating system are you using?
No response
What database engines are you using?
MySQL
What type of code are you generating?
Go