Steps to reproduce:
Table:
create table books (id uuid primary key, name varchar(100));
Query:
insert into books values ($1, $2);
This is how the generated code looks like:
pub fn create_book(db, arg_1, arg_2) {
let decoder = decode.map(decode.dynamic, fn(_) { Nil })
"insert into books values ($1, $2);
"
|> pog.query
|> pog.parameter(pog.text(uuid.to_string(arg_1)))
|> pog.parameter(pog.text(arg_2))
|> pog.returning(decoder)
|> pog.execute(db)
}
With the name column being nullable i would expect the parameter for arg_2 to look like this:
|> pog.parameter(pog.nullable(pog.text, arg_2))
From looking through the code, it seems that the check if column is nullable happens only if the query returns something, which doesn't happen for insert queries. So when they are parsed we get only the types of columns.
Steps to reproduce:
Table:
Query:
This is how the generated code looks like:
With the
namecolumn being nullable i would expect the parameter forarg_2to look like this:From looking through the code, it seems that the check if column is nullable happens only if the query returns something, which doesn't happen for insert queries. So when they are parsed we get only the types of columns.