···11# CHANGELOG
2233+## Unreleased
44+55+- Squirrel now uses a better name for the generated function connection
66+ parameter.
77+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
88+39## 4.7.0 - 2026-06-03
410511- Squirrel can now pick some better argument names based on the structure of the
+7-4
src/squirrel/internal/query.gleam
···524524525525 let #(state, decoder) = decoder_doc(state, constructor_name, returns)
526526 let #(state, _, args, encoders) = {
527527- // "decoder" and "db" are two arguments that are always defined in the
527527+ // "decoder" and "connection" are two arguments that are always defined in the
528528 // generated function, so we always have them as already used!
529529- let used_names = set.from_list(["decoder", "db"])
529529+ let used_names = set.from_list(["decoder", "connection"])
530530 use acc, param, i <- list.index_fold(params, #(state, used_names, [], []))
531531 let #(state, used_names, args, encoders) = acc
532532···541541 }
542542543543 let encoders = list.reverse(encoders)
544544- let args = [doc.from_string("db: pog.Connection"), ..list.reverse(args)]
544544+ let args = [
545545+ doc.from_string("connection: pog.Connection"),
546546+ ..list.reverse(args)
547547+ ]
545548546549 let returned = case returns {
547550 [] -> doc.from_string("pog.Returned(Nil)")
···560563 |> pipe_call_doc("pog.query", _, [])
561564 |> pipe_all_encoders(encoders)
562565 |> pipe_call_doc("pog.returning", _, [doc.from_string("decoder")])
563563- |> pipe_call_doc("pog.execute", _, [doc.from_string("db")]),
566566+ |> pipe_call_doc("pog.execute", _, [doc.from_string("connection")]),
564567 ]),
565568 ])
566569
···11---
22-version: 1.4.0
22+version: 2.0.0
33title: generated type has the same name as the function but in pascal case
44file: ./test/squirrel_test.gleam
55test_name: generated_type_has_the_same_name_as_the_function_but_in_pascal_case_test
···1313}
14141515pub fn query(
1616- db: pog.Connection,
1616+ connection: pog.Connection,
1717) -> Result(pog.Returned(QueryRow), pog.QueryError) {
1818 let decoder = {
1919 use res <- decode.field(0, decode.bool)
···2525"
2626 |> pog.query
2727 |> pog.returning(decoder)
2828- |> pog.execute(db)
2828+ |> pog.execute(connection)
2929}
3030