For the following query, sqlc will generate a function signature with a string for parameter $1. ```sql CREATE TABLE users ( name TEXT NOT NULL ); -- name: ListUsers :many SELECT * FROM users WHERE name = $1; ``` ```go func (q *Queries) ListUsers(ctx context.Context, name string) ([]string, error) { // ... } ``` How should we indicate that parameter $1 should be nullable? ### Option 1: Add a parameter to the `sqlc.arg` function ```sql CREATE TABLE users ( name TEXT NOT NULL ); -- name: ListUsers :many SELECT * FROM users WHERE name = sqlc.arg('name', nullable => true); ``` Originally reported in #200
Activity
imraan-go commentedon Aug 28, 2021
Option 1 seems to be the best way to implement this feature.
mrsufgi commentedon Aug 29, 2021
how would you go about the shorthand for
@param? new syntax? no shorthand?kyleconroy commentedon Aug 29, 2021
@mrsufgi the shorthand syntax is problematic (see #605), so for now this would only work when using
sqlc.arg.kyleconroy commentedon Jun 12, 2022
Fixed by #1536