From e1d5b997b8db15f181399f407dac2e6c705719ae Mon Sep 17 00:00:00 2001 From: Robson Roberto Souza Peixoto Date: Tue, 24 Nov 2026 19:38:59 -0300 Subject: [PATCH 1/2] feat(codegen): suffix generated query constants with SQL Name the constant holding each query's text SQL (or SQL with emit_exported_queries), so it reads as SQL at the call site and no longer collides with an enum or struct of the query's name. The suffix also keeps the name clear of Go keywords, so it no longer needs escaping. The duplicate_go_names/query_constant case expected that collision as an error; it now generates, and pins down that the names stay apart. --- examples/authors/clickhouse/query.sql.go | 16 +- examples/authors/duckdb/query.sql.go | 16 +- examples/authors/googlesql/query.sql.go | 16 +- examples/authors/mssql/query.sql.go | 16 +- examples/authors/mysql/query.sql.go | 16 +- examples/authors/postgresql/query.sql.go | 16 +- examples/authors/sqlite/query.sql.go | 16 +- examples/batch/postgresql/batch.go | 28 +-- examples/batch/postgresql/query.sql.go | 12 +- examples/booktest/mysql/query.sql.go | 40 ++-- examples/booktest/postgresql/query.sql.go | 40 ++-- examples/booktest/sqlite/query.sql.go | 40 ++-- .../jets/postgresql/query-building.sql.go | 12 +- examples/ondeck/mysql/city.sql.go | 16 +- examples/ondeck/mysql/db.go | 20 +- examples/ondeck/mysql/venue.sql.go | 24 +- examples/ondeck/postgresql/city.sql.go | 16 +- examples/ondeck/postgresql/db.go | 20 +- examples/ondeck/postgresql/venue.sql.go | 24 +- examples/ondeck/sqlite/city.sql.go | 16 +- examples/ondeck/sqlite/db.go | 20 +- examples/ondeck/sqlite/venue.sql.go | 24 +- internal/codegen/golang/result.go | 5 +- .../testdata/alias/mysql/go/query.sql.go | 4 +- .../alias/postgresql/pgx/v4/go/query.sql.go | 4 +- .../alias/postgresql/pgx/v5/go/query.sql.go | 4 +- .../alias/postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/alias/sqlite/go/query.sql.go | 4 +- .../testdata/any/pgx/v4/go/query.sql.go | 4 +- .../testdata/any/pgx/v5/go/query.sql.go | 4 +- .../testdata/any/stdlib/go/query.sql.go | 4 +- .../testdata/array_in/pgx/v4/go/query.sql.go | 4 +- .../testdata/array_in/pgx/v5/go/query.sql.go | 4 +- .../testdata/array_in/stdlib/go/query.sql.go | 4 +- .../array_text/pgx/v4/go/query.sql.go | 4 +- .../array_text/pgx/v5/go/query.sql.go | 4 +- .../array_text/stdlib/go/query.sql.go | 4 +- .../array_text_join/pgx/v4/go/query.sql.go | 4 +- .../array_text_join/pgx/v5/go/query.sql.go | 4 +- .../array_text_join/stdlib/go/query.sql.go | 4 +- .../array_unnest/googlesql/go/query.sql.go | 20 +- .../batch/postgresql/pgx/v4/go/batch.go | 12 +- .../batch/postgresql/pgx/v5/go/batch.go | 12 +- .../postgresql/pgx/v4/go/batch.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/batch.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/pgx/go/batch.go | 4 +- .../postgresql/pgx/go/batch.go | 4 +- .../between_args/mysql/go/query.sql.go | 16 +- .../between_args/sqlite/go/query.sql.go | 12 +- .../bit_string/pgx/v4/go/query.sql.go | 4 +- .../bit_string/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../builtins/postgresql/go/query.sql.go | 96 ++++---- .../builtins/sqlite/go/aggfunc.sql.go | 56 ++--- .../builtins/sqlite/go/mathfunc.sql.go | 116 +++++----- .../builtins/sqlite/go/scalarfunc.sql.go | 200 ++++++++--------- .../case_named_params/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../case_named_params/sqlite/go/query.sql.go | 4 +- .../case_sensitive/sqlite/go/query.sql.go | 4 +- .../case_stmt_bool/pgx/v4/go/query.sql.go | 4 +- .../case_stmt_bool/pgx/v5/go/query.sql.go | 4 +- .../case_stmt_bool/stdlib/go/query.sql.go | 4 +- .../testdata/case_text/pgx/v4/go/query.sql.go | 4 +- .../testdata/case_text/pgx/v5/go/query.sql.go | 4 +- .../testdata/case_text/stdlib/go/query.sql.go | 4 +- .../case_value_param/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../cast_coalesce/pgx/v4/go/query.sql.go | 4 +- .../cast_coalesce/pgx/v5/go/query.sql.go | 4 +- .../cast_coalesce/stdlib/go/query.sql.go | 4 +- .../testdata/cast_null/pgx/v4/go/query.sql.go | 4 +- .../testdata/cast_null/pgx/v5/go/query.sql.go | 4 +- .../testdata/cast_null/stdlib/go/query.sql.go | 4 +- .../cast_param/sqlite/go/query.sql.go | 4 +- .../cid_oid_tid_xid/pgx/v4/go/query.sql.go | 4 +- .../cid_oid_tid_xid/pgx/v5/go/query.sql.go | 4 +- .../testdata/citext/pgx/go/query.sql.go | 4 +- .../testdata/citext/stdlib/go/query.sql.go | 4 +- .../clickhouse/go/query.sql.go | 12 +- .../testdata/coalesce/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 24 +- .../postgresql/pgx/v5/go/query.sql.go | 24 +- .../postgresql/stdlib/go/query.sql.go | 24 +- .../testdata/coalesce/sqlite/go/query.sql.go | 8 +- .../coalesce_as/mysql/go/query.sql.go | 4 +- .../postgresql/pganalyze/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../coalesce_as/sqlite/go/query.sql.go | 4 +- .../coalesce_join/postgresql/go/query.sql.go | 4 +- .../coalesce_params/mysql/go/query.sql.go | 8 +- .../stdlib/go/query.sql.go | 4 +- .../column_alias/stdlib/go/query.sql.go | 4 +- .../testdata/column_as/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../testdata/column_as/sqlite/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 20 +- .../postgresql/pgx/v5/go/query.sql.go | 20 +- .../postgresql/pgx/v4/go/query.sql.go | 20 +- .../postgresql/pgx/v5/go/query.sql.go | 20 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../comment_syntax/mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../comment_syntax/sqlite/go/query.sql.go | 8 +- .../comparisons/mysql/go/query.sql.go | 36 +-- .../postgresql/pgx/v4/go/query.sql.go | 28 +-- .../postgresql/pgx/v5/go/query.sql.go | 28 +-- .../postgresql/stdlib/go/query.sql.go | 28 +-- .../comparisons/sqlite/go/query.sql.go | 28 +-- .../composite_type/pgx/v4/go/query.sql.go | 4 +- .../composite_type/pgx/v5/go/query.sql.go | 4 +- .../composite_type/stdlib/go/query.sql.go | 4 +- .../postgresql/db/query.sql.go | 8 +- .../testdata/copyfrom/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../mysql/go/query.sql.go | 2 +- .../mysql/go/query.sql.go | 2 +- .../core_types/clickhouse/go/query.sql.go | 16 +- .../core_types/duckdb/go/query.sql.go | 12 +- .../core_types/googlesql/go/query.sql.go | 12 +- .../testdata/core_types/mssql/go/query.sql.go | 12 +- .../testdata/count_star/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../count_star/sqlite/go/query.sql.go | 8 +- .../postgresql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../create_table_like/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../create_view/googlesql/go/query.sql.go | 4 +- .../create_view/mysql/go/query.sql.go | 8 +- .../create_view/postgresql/go/query.sql.go | 8 +- .../create_view/sqlite/go/query.sql.go | 8 +- .../testdata/cte_count/mysql/go/query.sql.go | 4 +- .../testdata/cte_count/pgx/v4/go/query.sql.go | 4 +- .../testdata/cte_count/pgx/v5/go/query.sql.go | 4 +- .../testdata/cte_count/stdlib/go/query.sql.go | 4 +- .../testdata/cte_filter/mysql/go/query.sql.go | 4 +- .../cte_filter/pgx/v4/go/query.sql.go | 4 +- .../cte_filter/pgx/v5/go/query.sql.go | 4 +- .../cte_filter/stdlib/go/query.sql.go | 4 +- .../cte_in_delete/mysql/go/query.sql.go | 4 +- .../cte_in_delete/pgx/v4/go/query.sql.go | 4 +- .../cte_in_delete/pgx/v5/go/query.sql.go | 4 +- .../cte_in_delete/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../cte_recursive/mysql/go/query.sql.go | 4 +- .../cte_recursive/pgx/v4/go/query.sql.go | 4 +- .../cte_recursive/pgx/v5/go/query.sql.go | 4 +- .../cte_recursive/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 8 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../cte_update/postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pganalyze/go/query.sql.go | 20 +- .../data_type_boolean/mysql/db/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../data_type_boolean/sqlite/db/query.sql.go | 8 +- .../testdata/datatype/mysql/go/query.sql.go | 4 +- .../testdata/datatype/pgx/v4/go/query.sql.go | 4 +- .../testdata/datatype/pgx/v5/go/query.sql.go | 4 +- .../testdata/datatype/sqlite/go/query.sql.go | 4 +- .../testdata/datatype/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../googlesql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../googlesql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 8 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../googlesql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../googlesql/go/query.sql.go | 8 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_comment/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_create_enum/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 16 +- .../postgresql/pgx/v5/go/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../ddl_create_table/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_create_table/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 12 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../postgresql/stdlib/go/query.sql.go | 12 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_create_trigger/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_drop_schema/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../ddl_drop_table/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../ddl_spanner/googlesql/go/query.sql.go | 12 +- .../delete_from/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../delete_from/sqlite/go/query.sql.go | 4 +- .../delete_inner_join/mysql/go/query.sql.go | 4 +- .../delete_join/mysql/db/query.sql.go | 16 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../testdata/diff_no_output/go/query.sql.go | 16 +- .../testdata/diff_output/go/query.sql.go | 16 +- .../endtoend/testdata/diff_output/stderr.txt | 12 +- .../do/postgresql/pgx/db/query.sql.go | 4 +- .../testdata/do/postgresql/pq/db/query.sql.go | 4 +- .../duckdb_json/duckdb/go/query.sql.go | 20 +- .../query_constant/db/db.go | 31 +++ .../query_constant/db/models.go | 49 +++++ .../query_constant/db/query.sql.go | 21 ++ .../query_constant/stderr.txt | 2 - .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../emit_db_tags/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../emit_db_tags/sqlite/go/query.sql.go | 4 +- .../emit_empty_slices/pgx/v4/go/query.sql.go | 4 +- .../emit_empty_slices/pgx/v5/go/query.sql.go | 4 +- .../emit_empty_slices/stdlib/go/query.sql.go | 4 +- .../go/query.sql.go | 8 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../optin/pgx/v5/go/query.sql.go | 4 +- .../optout/pgx/v5/go/query.sql.go | 4 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 8 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/batch.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 12 +- .../postgresql/pgx/v5/go/batch.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../stdlib/go/query.sql.go | 8 +- .../testdata/enum/mysql/go/query.sql.go | 16 +- .../enum/postgresql/pgx/v4/go/query.sql.go | 16 +- .../enum/postgresql/pgx/v5/go/query.sql.go | 16 +- .../enum/postgresql/stdlib/go/query.sql.go | 16 +- .../enum_column/mysql/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/db/mysql.query.sql.go | 4 +- .../postgresql/db/postgresql.query.sql.go | 4 +- .../sqlite/db/sqlite.query.sql.go | 4 +- .../exec_imports/pgx/v4/go/query.sql.go | 8 +- .../exec_imports/pgx/v5/go/query.sql.go | 8 +- .../exec_imports/stdlib/go/query.sql.go | 8 +- .../go_postgresql_stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../go_postgresql_pgx/v4/go/query.sql.go | 4 +- .../go_postgresql_pgx/v5/go/query.sql.go | 4 +- .../go_postgresql_stdlib/go/query.sql.go | 4 +- .../go_postgresql_pgx/v4/go/query.sql.go | 4 +- .../go_postgresql_pgx/v5/go/query.sql.go | 4 +- .../go_postgresql_stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../sqlite/go/query.sql.go | 16 +- .../full_outer_join/sqlite/go/query.sql.go | 4 +- .../func_aggregate/pganalyze/go/query.sql.go | 4 +- .../func_aggregate/postgresql/go/query.sql.go | 4 +- .../testdata/func_args/pgx/v4/go/query.sql.go | 20 +- .../testdata/func_args/pgx/v5/go/query.sql.go | 20 +- .../testdata/func_args/stdlib/go/query.sql.go | 20 +- .../func_args_typecast/pgx/v4/go/query.sql.go | 4 +- .../func_args_typecast/pgx/v5/go/query.sql.go | 4 +- .../func_args_typecast/stdlib/go/query.sql.go | 4 +- .../func_call_cast/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../func_call_cast/sqlite/go/query.sql.go | 4 +- .../func_match_types/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../func_match_types/sqlite/go/query.sql.go | 4 +- .../googlesql/go/query.sql.go | 20 +- .../func_out_param/pgx/go/query.sql.go | 4 +- .../postgresql/pganalyze/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 12 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/geometric/pgx/v4/go/query.sql.go | 4 +- .../testdata/geometric/pgx/v5/go/query.sql.go | 4 +- .../golang_initialisms_empty/db/query.sql.go | 4 +- .../golang_initialisms_url/db/query.sql.go | 4 +- .../golang_invalid_sql_driver/db/query.sql.go | 4 +- .../db/query.sql.go | 4 +- .../testdata/having/mysql/go/query.sql.go | 4 +- .../having/postgresql/go/query.sql.go | 4 +- .../testdata/hstore/pgx/v4/go/hstore.sql.go | 8 +- .../testdata/hstore/pgx/v5/go/hstore.sql.go | 8 +- .../testdata/hstore/stdlib/go/hstore.sql.go | 8 +- .../identical_tables/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../identical_tables/sqlite/go/query.sql.go | 4 +- .../db/query.sql.go | 16 +- .../identifier_dollar_sign/db/query.sql.go | 4 +- .../testdata/in_union/mysql/go/query.sql.go | 4 +- .../testdata/inflection/mysql/go/query.sql.go | 20 +- .../postgresql/pgx/v4/go/query.sql.go | 20 +- .../postgresql/pgx/v5/go/query.sql.go | 20 +- .../postgresql/stdlib/go/query.sql.go | 20 +- .../inflection/sqlite/go/query.sql.go | 20 +- .../postgresql/pgx/v4/go/query.sql.go | 12 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../insert_cte/pgx/v4/go/query.sql.go | 4 +- .../insert_cte/pgx/v5/go/query.sql.go | 4 +- .../insert_cte/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../insert_select/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../insert_select/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../insert_values/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../insert_values/sqlite/go/query.sql.go | 8 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/interval/pgx/v4/go/query.sql.go | 4 +- .../testdata/interval/pgx/v5/go/query.sql.go | 4 +- .../testdata/interval/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/db/query.sql.go | 4 +- .../testdata/join_alias/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../join_alias/sqlite/go/query.sql.go | 8 +- .../postgresql/go/query.sql.go | 16 +- .../testdata/join_from/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/join_from/sqlite/go/query.sql.go | 4 +- .../join_full/postgresql/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../join_inner/postgresql/go/query.sql.go | 8 +- .../testdata/join_left/mysql/go/query.sql.go | 36 +-- .../join_left/postgresql/go/query.sql.go | 36 +-- .../testdata/join_left/sqlite/go/query.sql.go | 40 ++-- .../mysql/go/query.sql.go | 4 +- .../postgres/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 8 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/join_right/mysql/go/query.sql.go | 4 +- .../join_right/postgresql/go/query.sql.go | 4 +- .../join_table_name/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../join_table_name/sqlite/go/query.sql.go | 4 +- .../join_two_tables/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../join_two_tables/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../join_using/postgresql/pgx/go/query.sql.go | 4 +- .../join_where_clause/mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 12 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../postgresql/stdlib/go/query.sql.go | 12 +- .../join_where_clause/sqlite/go/query.sql.go | 12 +- .../testdata/json/mysql/go/query.sql.go | 6 +- .../json/postgresql/pgx/v4/go/query.sql.go | 4 +- .../json/postgresql/pgx/v5/go/query.sql.go | 4 +- .../json/postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 16 +- .../postgresql/pgx/v5/go/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../json_param_type/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../none/postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/jsonb/pgx/go/query.sql.go | 8 +- .../testdata/jsonb/sqlite/go/query.sql.go | 8 +- .../testdata/limit/mysql/go/query.sql.go | 8 +- .../testdata/limit/pgx/v4/go/query.sql.go | 4 +- .../testdata/limit/pgx/v5/go/query.sql.go | 4 +- .../testdata/limit/sqlite/go/query.sql.go | 4 +- .../testdata/limit/stdlib/go/query.sql.go | 4 +- .../testdata/lower/pgx/v4/go/query.sql.go | 4 +- .../testdata/lower/pgx/v5/go/query.sql.go | 4 +- .../testdata/lower/stdlib/go/query.sql.go | 4 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../missing_semicolon/mysql/go/query.sql.go | 4 +- .../mix_param_types/mysql/go/test.sql.go | 12 +- .../mix_param_types/postgresql/go/test.sql.go | 12 +- .../mssql/go/query.sql.go | 4 +- .../multibyte_comment/sqlite/go/query.sql.go | 16 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../multischema/pgx/v4/go/query.sql.go | 8 +- .../multischema/pgx/v5/go/query.sql.go | 8 +- .../multischema/stdlib/go/query.sql.go | 8 +- .../mysql_ddl_routines/mysql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../mysql_default_value/mysql/go/query.sql.go | 4 +- .../mysql_json_table/mysql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 8 +- .../go/group_concat.sql.go | 8 +- .../go/date_add.sql.go | 24 +- .../go/date_sub.sql.go | 12 +- .../mysql_vector/mysql/go/query.sql.go | 8 +- .../named_param/pgx/v4/go/query.sql.go | 20 +- .../named_param/pgx/v5/go/query.sql.go | 20 +- .../named_param/sqlite/go/query.sql.go | 16 +- .../named_param/stdlib/go/query.sql.go | 20 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../nextval/postgresql/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../postgresql/pganalyzer/db/query.sql.go | 4 +- .../postgresql/stdlib/db/query.sql.go | 4 +- .../omit_sqlc_version/db/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 28 +-- .../mysql/db/query.sql.go | 8 +- .../postgresql/db/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../order_by_binds/mysql/go/query.sql.go | 12 +- .../order_by_binds/pganalyze/go/query.sql.go | 8 +- .../order_by_binds/postgresql/go/query.sql.go | 12 +- .../order_by_union/mysql/go/query.sql.go | 4 +- .../order_by_union/postgresql/go/query.sql.go | 4 +- .../output_file_names/pgx/v4/go/batch_gen.go | 4 +- .../output_file_names/pgx/v4/go/query.sql.go | 4 +- .../output_file_names/pgx/v5/go/batch_gen.go | 4 +- .../output_file_names/pgx/v5/go/query.sql.go | 4 +- .../output_file_names/stdlib/go/query.sql.go | 4 +- .../pgx/v4/go/query.sql_gen.go | 4 +- .../pgx/v5/go/query.sql_gen.go | 4 +- .../stdlib/go/query.sql_gen.go | 4 +- .../postgresql/db/query.sql.go | 20 +- .../postgresql/primary/query.sql.go | 8 +- .../postgresql/replica/query.sql.go | 8 +- .../testdata/overrides/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../testdata/overrides/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/query/query.sql.go | 4 +- .../postgresql/pgx/v5/query/query.sql.go | 4 +- .../postgresql/stdlib/query/query.sql.go | 4 +- .../v2/yaml/global/db/query.sql.go | 4 +- .../yaml/global_and_queryset/db/query.sql.go | 4 +- .../v2/yaml/queryset/db/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../mysql/query.sql.go | 4 +- .../overrides_global_engine/pg/query.sql.go | 4 +- .../sqlite/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../overrides_go_types/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../overrides_go_types/sqlite/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../overrides_pointers/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../overrides_unsigned/mysql/go/query.sql.go | 16 +- .../params_duplicate/mysql/go/query.sql.go | 16 +- .../postgresql/go/query.sql.go | 12 +- .../postgresql/go/query.sql.go | 208 +++++++++--------- .../mysql/db/query.sql.go | 4 +- .../postgresql/db/query.sql.go | 4 +- .../params_location/mysql/go/query.sql.go | 32 +-- .../postgresql/pgx/v4/go/query.sql.go | 32 +-- .../postgresql/pgx/v5/go/query.sql.go | 32 +-- .../postgresql/stdlib/go/query.sql.go | 32 +-- .../mysql/go/query.sql.go | 8 +- .../postgresql/go/query.sql.go | 8 +- .../testdata/params_two/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../pattern_in_expr/mysql/go/query.sql.go | 16 +- .../pattern_matching/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/exec.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 12 +- .../postgresql/pgx/v5/go/exec.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 12 +- .../postgresql/stdlib/go/exec.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 12 +- .../endtoend/testdata/pg_dump/db/query.sql.go | 16 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/pg_trgm.sql.go | 4 +- .../postgresql/pgx/v4/go/pgcrypto.sql.go | 4 +- .../postgresql/pgx/v4/go/uuid_ossp.sql.go | 4 +- .../postgresql/pgx/v5/go/pg_trgm.sql.go | 4 +- .../postgresql/pgx/v5/go/pgcrypto.sql.go | 4 +- .../postgresql/pgx/v5/go/uuid_ossp.sql.go | 4 +- .../postgresql/stdlib/go/pg_trgm.sql.go | 4 +- .../postgresql/stdlib/go/pgcrypto.sql.go | 4 +- .../postgresql/stdlib/go/uuid_ossp.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../pg_timezone_names/go_pgx/v4/query.sql.go | 12 +- .../pg_timezone_names/go_pgx/v5/query.sql.go | 12 +- .../pg_timezone_names/go_stdlib/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../pg_vector/postgresql/pgx/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../testdata/prepared_queries/mysql/go/db.go | 10 +- .../prepared_queries/mysql/go/query.sql.go | 20 +- .../postgresql/stdlib/go/db.go | 10 +- .../postgresql/stdlib/go/query.sql.go | 20 +- .../postgresql/pgx/v4/go/queries.sql.go | 4 +- .../postgresql/pgx/v5/go/queries.sql.go | 4 +- .../postgresql/stdlib/go/queries.sql.go | 4 +- .../postgresql/go/query.sql.go | 8 +- .../postgresql/go/query.sql.go | 28 +-- .../postgresql/go/query.sql.go | 16 +- .../quoted_colname/sqlite/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../quoted_tablename/sqlite/go/query.sql.go | 4 +- .../testdata/ranges/pgx/v5/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../testdata/rename/v1/pgx/v4/go/query.sql.go | 8 +- .../testdata/rename/v1/pgx/v5/go/query.sql.go | 8 +- .../testdata/rename/v1/stdlib/go/query.sql.go | 8 +- .../testdata/rename/v2/pgx/v4/go/query.sql.go | 8 +- .../testdata/rename/v2/pgx/v5/go/query.sql.go | 8 +- .../testdata/rename/v2/stdlib/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 24 +- .../postgresql/pgx/v5/go/query.sql.go | 24 +- .../postgresql/stdlib/go/query.sql.go | 24 +- .../testdata/returning/sqlite/go/query.sql.go | 24 +- .../postgresql/pgx/v5/go/query.sql.go | 24 +- .../postgresql/stdlib/go/query.sql.go | 24 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../schema_scoped_enum/pgx/v4/go/query.sql.go | 4 +- .../schema_scoped_enum/pgx/v5/go/query.sql.go | 4 +- .../schema_scoped_enum/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../schema_scoped_list/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 12 +- .../select_column_cast/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../select_column_cast/sqlite/go/query.sql.go | 4 +- .../select_cte/sqlite/go/query.sql.go | 4 +- .../select_distinct/pgx/v4/go/query.sql.go | 4 +- .../select_distinct/pgx/v5/go/query.sql.go | 4 +- .../select_distinct/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../select_exists/pgx/v4/go/query.sql.go | 4 +- .../select_exists/pgx/v5/go/query.sql.go | 4 +- .../select_exists/sqlite/go/query.sql.go | 4 +- .../select_exists/stdlib/go/query.sql.go | 4 +- .../select_in_and/sqlite/go/query.sql.go | 4 +- .../select_limit/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../select_limit/sqlite/go/query.sql.go | 8 +- .../select_nested_count/mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../select_not_exists/pgx/v4/go/query.sql.go | 4 +- .../select_not_exists/pgx/v5/go/query.sql.go | 4 +- .../select_not_exists/sqlite/go/query.sql.go | 4 +- .../select_not_exists/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../select_star/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../select_star/sqlite/go/query.sql.go | 8 +- .../select_star_quoted/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgres/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../select_system/pgx/go/query.sql.go | 4 +- .../select_text_array/pgx/v4/go/query.sql.go | 4 +- .../select_text_array/pgx/v5/go/query.sql.go | 4 +- .../select_text_array/stdlib/go/query.sql.go | 4 +- .../select_union/mysql/go/query.sql.go | 24 +- .../postgres/pgx/v4/go/query.sql.go | 24 +- .../postgres/pgx/v5/go/query.sql.go | 24 +- .../postgres/stdlib/go/query.sql.go | 24 +- .../select_union/sqlite/go/query.sql.go | 20 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/go/query.sql.go | 4 +- .../selectstatic/mysql/go/query.sql.go | 4 +- .../show_warnings/mysql/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 16 +- .../postgresql/pgx/v5/go/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../sqlite/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 24 +- .../postgresql/pgx/v5/go/query.sql.go | 24 +- .../postgresql/stdlib/go/query.sql.go | 24 +- .../testdata/sqlc_arg/mysql/go/query.sql.go | 12 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../testdata/sqlc_arg/sqlite/go/query.sql.go | 8 +- .../testdata/sqlc_embed/mysql/go/query.sql.go | 32 +-- .../sqlc_embed/postgresql/pgx/go/query.sql.go | 32 +-- .../postgresql/stdlib/go/query.sql.go | 32 +-- .../sqlc_embed/sqlite/go/query.sql.go | 32 +-- .../testdata/sqlc_narg/mysql/go/query.sql.go | 16 +- .../postgresql/pgx/v4/go/query.sql.go | 16 +- .../postgresql/pgx/v5/go/query.sql.go | 16 +- .../postgresql/stdlib/go/query.sql.go | 16 +- .../postgresql/stdlib/go_strict/query.sql.go | 16 +- .../testdata/sqlc_narg/sqlite/go/query.sql.go | 16 +- .../testdata/sqlc_slice/mysql/go/query.sql.go | 28 +-- .../sqlc_slice/postgresql/pgx/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../sqlc_slice/sqlite/go/query.sql.go | 24 +- .../sqlc_slice_prepared/sqlite/go/db.go | 2 +- .../sqlite/go/query.sql.go | 4 +- .../testdata/sqlite_skip_todo/db/query.sql.go | 8 +- .../sqlite/go/query.sql.go | 4 +- .../star_expansion/mysql/go/query.sql.go | 8 +- .../postgresql/pgx/v4/go/query.sql.go | 8 +- .../postgresql/pgx/v5/go/query.sql.go | 8 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../star_expansion/sqlite/go/query.sql.go | 8 +- .../star_expansion_core/mysql/go/query.sql.go | 24 +- .../postgresql/go/query.sql.go | 28 +-- .../sqlite/go/query.sql.go | 36 +-- .../star_expansion_cte/pgx/v4/go/query.sql.go | 8 +- .../star_expansion_cte/pgx/v5/go/query.sql.go | 8 +- .../star_expansion_cte/stdlib/go/query.sql.go | 8 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../pgx/v4/go/query.sql.go | 4 +- .../pgx/v5/go/query.sql.go | 4 +- .../stdlib/go/query.sql.go | 4 +- .../star_expansion_join/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../sum_type/postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../table_function/sqlite/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 64 +++--- .../testdata/truncate/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 8 +- .../unknown_func/pgx/v4/go/query.sql.go | 4 +- .../unknown_func/pgx/v5/go/query.sql.go | 4 +- .../unknown_func/stdlib/go/query.sql.go | 4 +- .../unnest/postgresql/pgx/v4/go/query.sql.go | 8 +- .../unnest/postgresql/pgx/v5/go/query.sql.go | 8 +- .../unnest/postgresql/stdlib/go/query.sql.go | 8 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../unsigned_params/mysql/go/query.sql.go | 4 +- .../sqlite/stdlib/db/query.sql.go | 4 +- .../postgresql/pgx/go/query.sql.go | 4 +- .../update_cte/pgx/v4/go/query.sql.go | 4 +- .../update_cte/pgx/v5/go/query.sql.go | 4 +- .../update_cte/stdlib/go/query.sql.go | 4 +- .../update_inner_join/db/query.sql.go | 4 +- .../update_join/mysql/db/query.sql.go | 12 +- .../update_join/postgresql/db/query.sql.go | 4 +- .../testdata/update_set/myql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../update_set/sqlite/go/query.sql.go | 4 +- .../update_set_multiple/mysql/go/query.sql.go | 4 +- .../postgresql/pgx/v4/go/query.sql.go | 4 +- .../postgresql/pgx/v5/go/query.sql.go | 4 +- .../postgresql/stdlib/go/query.sql.go | 4 +- .../sqlite/go/query.sql.go | 4 +- .../update_two_table/mysql/go/query.sql.go | 4 +- .../testdata/upsert/sqlite/go/query.sql.go | 4 +- .../mysql/go/query.sql.go | 12 +- .../pganalyzer/go/query.sql.go | 12 +- .../postgresql/go/query.sql.go | 12 +- .../vet_explain/mysql/db/query.sql.go | 144 ++++++------ .../virtual_table/sqlite/go/query.sql.go | 40 ++-- .../sqlite/go/query.sql.go | 8 +- .../where_collate/sqlite/go/query.sql.go | 4 +- .../wrap_errors/mysql/db/query.sql.go | 28 +-- .../postgresql/pgx/db/query.sql.go | 26 +-- .../postgresql/stdlib/db/query.sql.go | 28 +-- .../wrap_errors/sqlite/db/query.sql.go | 28 +-- .../testdata/yaml_overrides/go/query.sql.go | 4 +- 964 files changed, 4039 insertions(+), 3939 deletions(-) create mode 100644 internal/endtoend/testdata/duplicate_go_names/query_constant/db/db.go create mode 100644 internal/endtoend/testdata/duplicate_go_names/query_constant/db/models.go create mode 100644 internal/endtoend/testdata/duplicate_go_names/query_constant/db/query.sql.go delete mode 100644 internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt diff --git a/examples/authors/clickhouse/query.sql.go b/examples/authors/clickhouse/query.sql.go index 0dc7338b7e..06c199e75d 100644 --- a/examples/authors/clickhouse/query.sql.go +++ b/examples/authors/clickhouse/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const createAuthor = `-- name: CreateAuthor :exec +const createAuthorSQL = `-- name: CreateAuthor :exec INSERT INTO authors ( id, name, bio ) VALUES ( @@ -24,39 +24,39 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) error { - _, err := q.db.ExecContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + _, err := q.db.ExecContext(ctx, createAuthorSQL, arg.ID, arg.Name, arg.Bio) return err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ?; ` func (q *Queries) DeleteAuthor(ctx context.Context, id uint64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ? LIMIT 1; ` func (q *Queries) GetAuthor(ctx context.Context, id uint64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name; ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/duckdb/query.sql.go b/examples/authors/duckdb/query.sql.go index 56776cfb04..b3e269f3eb 100644 --- a/examples/authors/duckdb/query.sql.go +++ b/examples/authors/duckdb/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -25,41 +25,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1; ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1; ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name; ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/googlesql/query.sql.go b/examples/authors/googlesql/query.sql.go index 146182516b..9df5327742 100644 --- a/examples/authors/googlesql/query.sql.go +++ b/examples/authors/googlesql/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( id, name, bio ) VALUES ( @@ -25,41 +25,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, sql.Named("id", arg.ID), sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) + row := q.db.QueryRowContext(ctx, createAuthorSQL, sql.Named("id", arg.ID), sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = @id ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, sql.Named("id", id)) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, sql.Named("id", id)) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = @id ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, sql.Named("id", id)) + row := q.db.QueryRowContext(ctx, getAuthorSQL, sql.Named("id", id)) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/mssql/query.sql.go b/examples/authors/mssql/query.sql.go index beed275eba..76c7d9f5b0 100644 --- a/examples/authors/mssql/query.sql.go +++ b/examples/authors/mssql/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) OUTPUT INSERTED.id, INSERTED.name, INSERTED.bio @@ -25,41 +25,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) + row := q.db.QueryRowContext(ctx, createAuthorSQL, sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = @id; ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, sql.Named("id", id)) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, sql.Named("id", id)) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = @id; ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, sql.Named("id", id)) + row := q.db.QueryRowContext(ctx, getAuthorSQL, sql.Named("id", id)) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name; ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/mysql/query.sql.go b/examples/authors/mysql/query.sql.go index 0d66af757f..0164968576 100644 --- a/examples/authors/mysql/query.sql.go +++ b/examples/authors/mysql/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :execresult +const createAuthorSQL = `-- name: CreateAuthor :execresult INSERT INTO authors ( name, bio ) VALUES ( @@ -24,38 +24,38 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { - return q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + return q.db.ExecContext(ctx, createAuthorSQL, arg.Name, arg.Bio) } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ? LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/postgresql/query.sql.go b/examples/authors/postgresql/query.sql.go index 2910a809f3..80910db3c6 100644 --- a/examples/authors/postgresql/query.sql.go +++ b/examples/authors/postgresql/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -26,41 +26,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.Exec(ctx, deleteAuthor, id) + _, err := q.db.Exec(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/authors/sqlite/query.sql.go b/examples/authors/sqlite/query.sql.go index 0d66af757f..0164968576 100644 --- a/examples/authors/sqlite/query.sql.go +++ b/examples/authors/sqlite/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :execresult +const createAuthorSQL = `-- name: CreateAuthor :execresult INSERT INTO authors ( name, bio ) VALUES ( @@ -24,38 +24,38 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { - return q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + return q.db.ExecContext(ctx, createAuthorSQL, arg.Name, arg.Bio) } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ? LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/examples/batch/postgresql/batch.go b/examples/batch/postgresql/batch.go index b6ba467b65..ad27f6711f 100644 --- a/examples/batch/postgresql/batch.go +++ b/examples/batch/postgresql/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const booksByYear = `-- name: BooksByYear :batchmany +const booksByYearSQL = `-- name: BooksByYear :batchmany SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books WHERE year = $1 ` @@ -34,7 +34,7 @@ func (q *Queries) BooksByYear(ctx context.Context, year []int32) *BooksByYearBat vals := []any{ a, } - batch.Queue(booksByYear, vals...) + batch.Queue(booksByYearSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &BooksByYearBatchResults{br, len(year), false} @@ -85,7 +85,7 @@ func (b *BooksByYearBatchResults) Close() error { return b.br.Close() } -const createBook = `-- name: CreateBook :batchone +const createBookSQL = `-- name: CreateBook :batchone INSERT INTO books ( author_id, isbn, @@ -134,7 +134,7 @@ func (q *Queries) CreateBook(ctx context.Context, arg []CreateBookParams) *Creat a.Available, a.Tags, } - batch.Queue(createBook, vals...) + batch.Queue(createBookSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &CreateBookBatchResults{br, len(arg), false} @@ -172,7 +172,7 @@ func (b *CreateBookBatchResults) Close() error { return b.br.Close() } -const deleteBook = `-- name: DeleteBook :batchexec +const deleteBookSQL = `-- name: DeleteBook :batchexec DELETE FROM books WHERE book_id = $1 ` @@ -189,7 +189,7 @@ func (q *Queries) DeleteBook(ctx context.Context, bookID []int32) *DeleteBookBat vals := []any{ a, } - batch.Queue(deleteBook, vals...) + batch.Queue(deleteBookSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &DeleteBookBatchResults{br, len(bookID), false} @@ -216,7 +216,7 @@ func (b *DeleteBookBatchResults) Close() error { return b.br.Close() } -const deleteBookNamedFunc = `-- name: DeleteBookNamedFunc :batchexec +const deleteBookNamedFuncSQL = `-- name: DeleteBookNamedFunc :batchexec DELETE FROM books WHERE book_id = $1 ` @@ -233,7 +233,7 @@ func (q *Queries) DeleteBookNamedFunc(ctx context.Context, bookID []int32) *Dele vals := []any{ a, } - batch.Queue(deleteBookNamedFunc, vals...) + batch.Queue(deleteBookNamedFuncSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &DeleteBookNamedFuncBatchResults{br, len(bookID), false} @@ -260,7 +260,7 @@ func (b *DeleteBookNamedFuncBatchResults) Close() error { return b.br.Close() } -const deleteBookNamedSign = `-- name: DeleteBookNamedSign :batchexec +const deleteBookNamedSignSQL = `-- name: DeleteBookNamedSign :batchexec DELETE FROM books WHERE book_id = $1 ` @@ -277,7 +277,7 @@ func (q *Queries) DeleteBookNamedSign(ctx context.Context, bookID []int32) *Dele vals := []any{ a, } - batch.Queue(deleteBookNamedSign, vals...) + batch.Queue(deleteBookNamedSignSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &DeleteBookNamedSignBatchResults{br, len(bookID), false} @@ -304,7 +304,7 @@ func (b *DeleteBookNamedSignBatchResults) Close() error { return b.br.Close() } -const getBiography = `-- name: GetBiography :batchone +const getBiographySQL = `-- name: GetBiography :batchone SELECT biography FROM authors WHERE author_id = $1 ` @@ -321,7 +321,7 @@ func (q *Queries) GetBiography(ctx context.Context, authorID []int32) *GetBiogra vals := []any{ a, } - batch.Queue(getBiography, vals...) + batch.Queue(getBiographySQL, vals...) } br := q.db.SendBatch(ctx, batch) return &GetBiographyBatchResults{br, len(authorID), false} @@ -350,7 +350,7 @@ func (b *GetBiographyBatchResults) Close() error { return b.br.Close() } -const updateBook = `-- name: UpdateBook :batchexec +const updateBookSQL = `-- name: UpdateBook :batchexec UPDATE books SET title = $1, tags = $2 WHERE book_id = $3 @@ -376,7 +376,7 @@ func (q *Queries) UpdateBook(ctx context.Context, arg []UpdateBookParams) *Updat a.Tags, a.BookID, } - batch.Queue(updateBook, vals...) + batch.Queue(updateBookSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &UpdateBookBatchResults{br, len(arg), false} diff --git a/examples/batch/postgresql/query.sql.go b/examples/batch/postgresql/query.sql.go index ffab325ff8..cc3cb5da61 100644 --- a/examples/batch/postgresql/query.sql.go +++ b/examples/batch/postgresql/query.sql.go @@ -11,34 +11,34 @@ import ( "github.com/jackc/pgx/v5/pgconn" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (name) VALUES ($1) RETURNING author_id, name, biography ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { - row := q.db.QueryRow(ctx, createAuthor, name) + row := q.db.QueryRow(ctx, createAuthorSQL, name) var i Author err := row.Scan(&i.AuthorID, &i.Name, &i.Biography) return i, err } -const deleteBookExecResult = `-- name: DeleteBookExecResult :execresult +const deleteBookExecResultSQL = `-- name: DeleteBookExecResult :execresult DELETE FROM books WHERE book_id = $1 ` func (q *Queries) DeleteBookExecResult(ctx context.Context, bookID int32) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, deleteBookExecResult, bookID) + return q.db.Exec(ctx, deleteBookExecResultSQL, bookID) } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT author_id, name, biography FROM authors WHERE author_id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, authorID) + row := q.db.QueryRow(ctx, getAuthorSQL, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name, &i.Biography) return i, err diff --git a/examples/booktest/mysql/query.sql.go b/examples/booktest/mysql/query.sql.go index 39578207fb..c6f0ac8931 100644 --- a/examples/booktest/mysql/query.sql.go +++ b/examples/booktest/mysql/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const booksByTags = `-- name: BooksByTags :many +const booksByTagsSQL = `-- name: BooksByTags :many SELECT book_id, title, @@ -32,7 +32,7 @@ type BooksByTagsRow struct { } func (q *Queries) BooksByTags(ctx context.Context, tags string) ([]BooksByTagsRow, error) { - rows, err := q.db.QueryContext(ctx, booksByTags, tags) + rows, err := q.db.QueryContext(ctx, booksByTagsSQL, tags) if err != nil { return nil, err } @@ -60,7 +60,7 @@ func (q *Queries) BooksByTags(ctx context.Context, tags string) ([]BooksByTagsRo return items, nil } -const booksByTitleYear = `-- name: BooksByTitleYear :many +const booksByTitleYearSQL = `-- name: BooksByTitleYear :many SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books WHERE title = ? AND yr = ? ` @@ -71,7 +71,7 @@ type BooksByTitleYearParams struct { } func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { - rows, err := q.db.QueryContext(ctx, booksByTitleYear, arg.Title, arg.Yr) + rows, err := q.db.QueryContext(ctx, booksByTitleYearSQL, arg.Title, arg.Yr) if err != nil { return nil, err } @@ -102,15 +102,15 @@ func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearPara return items, nil } -const createAuthor = `-- name: CreateAuthor :execresult +const createAuthorSQL = `-- name: CreateAuthor :execresult INSERT INTO authors (name) VALUES (?) ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (sql.Result, error) { - return q.db.ExecContext(ctx, createAuthor, name) + return q.db.ExecContext(ctx, createAuthorSQL, name) } -const createBook = `-- name: CreateBook :execresult +const createBookSQL = `-- name: CreateBook :execresult INSERT INTO books ( author_id, isbn, @@ -141,7 +141,7 @@ type CreateBookParams struct { } func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (sql.Result, error) { - return q.db.ExecContext(ctx, createBook, + return q.db.ExecContext(ctx, createBookSQL, arg.AuthorID, arg.Isbn, arg.BookType, @@ -152,7 +152,7 @@ func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (sql.Res ) } -const deleteAuthorBeforeYear = `-- name: DeleteAuthorBeforeYear :exec +const deleteAuthorBeforeYearSQL = `-- name: DeleteAuthorBeforeYear :exec DELETE FROM books WHERE yr < ? AND author_id = ? ` @@ -163,39 +163,39 @@ type DeleteAuthorBeforeYearParams struct { } func (q *Queries) DeleteAuthorBeforeYear(ctx context.Context, arg DeleteAuthorBeforeYearParams) error { - _, err := q.db.ExecContext(ctx, deleteAuthorBeforeYear, arg.Yr, arg.AuthorID) + _, err := q.db.ExecContext(ctx, deleteAuthorBeforeYearSQL, arg.Yr, arg.AuthorID) return err } -const deleteBook = `-- name: DeleteBook :exec +const deleteBookSQL = `-- name: DeleteBook :exec DELETE FROM books WHERE book_id = ? ` func (q *Queries) DeleteBook(ctx context.Context, bookID int32) error { - _, err := q.db.ExecContext(ctx, deleteBook, bookID) + _, err := q.db.ExecContext(ctx, deleteBookSQL, bookID) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT author_id, name FROM authors WHERE author_id = ? ` func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, authorID) + row := q.db.QueryRowContext(ctx, getAuthorSQL, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err } -const getBook = `-- name: GetBook :one +const getBookSQL = `-- name: GetBook :one SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books WHERE book_id = ? ` func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { - row := q.db.QueryRowContext(ctx, getBook, bookID) + row := q.db.QueryRowContext(ctx, getBookSQL, bookID) var i Book err := row.Scan( &i.BookID, @@ -210,7 +210,7 @@ func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { return i, err } -const updateBook = `-- name: UpdateBook :exec +const updateBookSQL = `-- name: UpdateBook :exec UPDATE books SET title = ?, tags = ? WHERE book_id = ? @@ -223,11 +223,11 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.Tags, arg.BookID) + _, err := q.db.ExecContext(ctx, updateBookSQL, arg.Title, arg.Tags, arg.BookID) return err } -const updateBookISBN = `-- name: UpdateBookISBN :exec +const updateBookISBNSQL = `-- name: UpdateBookISBN :exec UPDATE books SET title = ?, tags = ?, isbn = ? WHERE book_id = ? @@ -241,7 +241,7 @@ type UpdateBookISBNParams struct { } func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { - _, err := q.db.ExecContext(ctx, updateBookISBN, + _, err := q.db.ExecContext(ctx, updateBookISBNSQL, arg.Title, arg.Tags, arg.Isbn, diff --git a/examples/booktest/postgresql/query.sql.go b/examples/booktest/postgresql/query.sql.go index 1de3113263..78517a5d8f 100644 --- a/examples/booktest/postgresql/query.sql.go +++ b/examples/booktest/postgresql/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const booksByTags = `-- name: BooksByTags :many +const booksByTagsSQL = `-- name: BooksByTags :many SELECT book_id, title, @@ -32,7 +32,7 @@ type BooksByTagsRow struct { } func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksByTagsRow, error) { - rows, err := q.db.Query(ctx, booksByTags, dollar_1) + rows, err := q.db.Query(ctx, booksByTagsSQL, dollar_1) if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksBy return items, nil } -const booksByTitleYear = `-- name: BooksByTitleYear :many +const booksByTitleYearSQL = `-- name: BooksByTitleYear :many SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books WHERE title = $1 AND year = $2 ` @@ -68,7 +68,7 @@ type BooksByTitleYearParams struct { } func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { - rows, err := q.db.Query(ctx, booksByTitleYear, arg.Title, arg.Year) + rows, err := q.db.Query(ctx, booksByTitleYearSQL, arg.Title, arg.Year) if err != nil { return nil, err } @@ -96,19 +96,19 @@ func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearPara return items, nil } -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (name) VALUES ($1) RETURNING author_id, name ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { - row := q.db.QueryRow(ctx, createAuthor, name) + row := q.db.QueryRow(ctx, createAuthorSQL, name) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err } -const createBook = `-- name: CreateBook :one +const createBookSQL = `-- name: CreateBook :one INSERT INTO books ( author_id, isbn, @@ -140,7 +140,7 @@ type CreateBookParams struct { } func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) { - row := q.db.QueryRow(ctx, createBook, + row := q.db.QueryRow(ctx, createBookSQL, arg.AuthorID, arg.Isbn, arg.BookType, @@ -163,35 +163,35 @@ func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, e return i, err } -const deleteBook = `-- name: DeleteBook :exec +const deleteBookSQL = `-- name: DeleteBook :exec DELETE FROM books WHERE book_id = $1 ` func (q *Queries) DeleteBook(ctx context.Context, bookID int32) error { - _, err := q.db.Exec(ctx, deleteBook, bookID) + _, err := q.db.Exec(ctx, deleteBookSQL, bookID) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT author_id, name FROM authors WHERE author_id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, authorID) + row := q.db.QueryRow(ctx, getAuthorSQL, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err } -const getBook = `-- name: GetBook :one +const getBookSQL = `-- name: GetBook :one SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books WHERE book_id = $1 ` func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { - row := q.db.QueryRow(ctx, getBook, bookID) + row := q.db.QueryRow(ctx, getBookSQL, bookID) var i Book err := row.Scan( &i.BookID, @@ -206,18 +206,18 @@ func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { return i, err } -const sayHello = `-- name: SayHello :one +const sayHelloSQL = `-- name: SayHello :one select say_hello from say_hello($1) ` func (q *Queries) SayHello(ctx context.Context, s string) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, sayHello, s) + row := q.db.QueryRow(ctx, sayHelloSQL, s) var say_hello pgtype.Text err := row.Scan(&say_hello) return say_hello, err } -const updateBook = `-- name: UpdateBook :exec +const updateBookSQL = `-- name: UpdateBook :exec UPDATE books SET title = $1, tags = $2 WHERE book_id = $3 @@ -230,11 +230,11 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.Exec(ctx, updateBook, arg.Title, arg.Tags, arg.BookID) + _, err := q.db.Exec(ctx, updateBookSQL, arg.Title, arg.Tags, arg.BookID) return err } -const updateBookISBN = `-- name: UpdateBookISBN :exec +const updateBookISBNSQL = `-- name: UpdateBookISBN :exec UPDATE books SET title = $1, tags = $2, isbn = $4 WHERE book_id = $3 @@ -248,7 +248,7 @@ type UpdateBookISBNParams struct { } func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { - _, err := q.db.Exec(ctx, updateBookISBN, + _, err := q.db.Exec(ctx, updateBookISBNSQL, arg.Title, arg.Tags, arg.BookID, diff --git a/examples/booktest/sqlite/query.sql.go b/examples/booktest/sqlite/query.sql.go index c8347b1e7f..e069966803 100644 --- a/examples/booktest/sqlite/query.sql.go +++ b/examples/booktest/sqlite/query.sql.go @@ -12,7 +12,7 @@ import ( "time" ) -const booksByTags = `-- name: BooksByTags :many +const booksByTagsSQL = `-- name: BooksByTags :many SELECT book_id, title, @@ -33,7 +33,7 @@ type BooksByTagsRow struct { } func (q *Queries) BooksByTags(ctx context.Context, tags []string) ([]BooksByTagsRow, error) { - query := booksByTags + query := booksByTagsSQL var queryParams []any if len(tags) > 0 { for _, v := range tags { @@ -71,7 +71,7 @@ func (q *Queries) BooksByTags(ctx context.Context, tags []string) ([]BooksByTags return items, nil } -const booksByTitleYear = `-- name: BooksByTitleYear :many +const booksByTitleYearSQL = `-- name: BooksByTitleYear :many SELECT book_id, author_id, isbn, book_type, title, yr, available, tag FROM books WHERE title = ? AND yr = ? ` @@ -82,7 +82,7 @@ type BooksByTitleYearParams struct { } func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { - rows, err := q.db.QueryContext(ctx, booksByTitleYear, arg.Title, arg.Yr) + rows, err := q.db.QueryContext(ctx, booksByTitleYearSQL, arg.Title, arg.Yr) if err != nil { return nil, err } @@ -113,19 +113,19 @@ func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearPara return items, nil } -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (name) VALUES (?) RETURNING author_id, name ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, name) + row := q.db.QueryRowContext(ctx, createAuthorSQL, name) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err } -const createBook = `-- name: CreateBook :one +const createBookSQL = `-- name: CreateBook :one INSERT INTO books ( author_id, isbn, @@ -157,7 +157,7 @@ type CreateBookParams struct { } func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) { - row := q.db.QueryRowContext(ctx, createBook, + row := q.db.QueryRowContext(ctx, createBookSQL, arg.AuthorID, arg.Isbn, arg.BookType, @@ -180,7 +180,7 @@ func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, e return i, err } -const deleteAuthorBeforeYear = `-- name: DeleteAuthorBeforeYear :exec +const deleteAuthorBeforeYearSQL = `-- name: DeleteAuthorBeforeYear :exec DELETE FROM books WHERE yr < ? AND author_id = ? ` @@ -191,39 +191,39 @@ type DeleteAuthorBeforeYearParams struct { } func (q *Queries) DeleteAuthorBeforeYear(ctx context.Context, arg DeleteAuthorBeforeYearParams) error { - _, err := q.db.ExecContext(ctx, deleteAuthorBeforeYear, arg.Yr, arg.AuthorID) + _, err := q.db.ExecContext(ctx, deleteAuthorBeforeYearSQL, arg.Yr, arg.AuthorID) return err } -const deleteBook = `-- name: DeleteBook :exec +const deleteBookSQL = `-- name: DeleteBook :exec DELETE FROM books WHERE book_id = ? ` func (q *Queries) DeleteBook(ctx context.Context, bookID int64) error { - _, err := q.db.ExecContext(ctx, deleteBook, bookID) + _, err := q.db.ExecContext(ctx, deleteBookSQL, bookID) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT author_id, name FROM authors WHERE author_id = ? ` func (q *Queries) GetAuthor(ctx context.Context, authorID int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, authorID) + row := q.db.QueryRowContext(ctx, getAuthorSQL, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err } -const getBook = `-- name: GetBook :one +const getBookSQL = `-- name: GetBook :one SELECT book_id, author_id, isbn, book_type, title, yr, available, tag FROM books WHERE book_id = ? ` func (q *Queries) GetBook(ctx context.Context, bookID int64) (Book, error) { - row := q.db.QueryRowContext(ctx, getBook, bookID) + row := q.db.QueryRowContext(ctx, getBookSQL, bookID) var i Book err := row.Scan( &i.BookID, @@ -238,7 +238,7 @@ func (q *Queries) GetBook(ctx context.Context, bookID int64) (Book, error) { return i, err } -const updateBook = `-- name: UpdateBook :exec +const updateBookSQL = `-- name: UpdateBook :exec UPDATE books SET title = ?1, tag = ?2 WHERE book_id = ?3 @@ -251,11 +251,11 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.Tag, arg.BookID) + _, err := q.db.ExecContext(ctx, updateBookSQL, arg.Title, arg.Tag, arg.BookID) return err } -const updateBookISBN = `-- name: UpdateBookISBN :exec +const updateBookISBNSQL = `-- name: UpdateBookISBN :exec UPDATE books SET title = ?1, tag = ?2, isbn = ?4 WHERE book_id = ?3 @@ -269,7 +269,7 @@ type UpdateBookISBNParams struct { } func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { - _, err := q.db.ExecContext(ctx, updateBookISBN, + _, err := q.db.ExecContext(ctx, updateBookISBNSQL, arg.Title, arg.Tag, arg.BookID, diff --git a/examples/jets/postgresql/query-building.sql.go b/examples/jets/postgresql/query-building.sql.go index fd8086e0bb..cb51da4c89 100644 --- a/examples/jets/postgresql/query-building.sql.go +++ b/examples/jets/postgresql/query-building.sql.go @@ -9,32 +9,32 @@ import ( "context" ) -const countPilots = `-- name: CountPilots :one +const countPilotsSQL = `-- name: CountPilots :one SELECT COUNT(*) FROM pilots ` func (q *Queries) CountPilots(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, countPilots) + row := q.db.QueryRow(ctx, countPilotsSQL) var count int64 err := row.Scan(&count) return count, err } -const deletePilot = `-- name: DeletePilot :exec +const deletePilotSQL = `-- name: DeletePilot :exec DELETE FROM pilots WHERE id = $1 ` func (q *Queries) DeletePilot(ctx context.Context, id int32) error { - _, err := q.db.Exec(ctx, deletePilot, id) + _, err := q.db.Exec(ctx, deletePilotSQL, id) return err } -const listPilots = `-- name: ListPilots :many +const listPilotsSQL = `-- name: ListPilots :many SELECT id, name FROM pilots LIMIT 5 ` func (q *Queries) ListPilots(ctx context.Context) ([]Pilot, error) { - rows, err := q.db.Query(ctx, listPilots) + rows, err := q.db.Query(ctx, listPilotsSQL) if err != nil { return nil, err } diff --git a/examples/ondeck/mysql/city.sql.go b/examples/ondeck/mysql/city.sql.go index 89b321ea7f..95c0fc9ae8 100644 --- a/examples/ondeck/mysql/city.sql.go +++ b/examples/ondeck/mysql/city.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const createCity = `-- name: CreateCity :exec +const createCitySQL = `-- name: CreateCity :exec INSERT INTO city ( name, slug @@ -25,31 +25,31 @@ type CreateCityParams struct { } func (q *Queries) CreateCity(ctx context.Context, arg CreateCityParams) error { - _, err := q.exec(ctx, q.createCityStmt, createCity, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.createCityStmt, createCitySQL, arg.Name, arg.Slug) return err } -const getCity = `-- name: GetCity :one +const getCitySQL = `-- name: GetCity :one SELECT slug, name FROM city WHERE slug = ? ` func (q *Queries) GetCity(ctx context.Context, slug string) (City, error) { - row := q.queryRow(ctx, q.getCityStmt, getCity, slug) + row := q.queryRow(ctx, q.getCityStmt, getCitySQL, slug) var i City err := row.Scan(&i.Slug, &i.Name) return i, err } -const listCities = `-- name: ListCities :many +const listCitiesSQL = `-- name: ListCities :many SELECT slug, name FROM city ORDER BY name ` func (q *Queries) ListCities(ctx context.Context) ([]City, error) { - rows, err := q.query(ctx, q.listCitiesStmt, listCities) + rows, err := q.query(ctx, q.listCitiesStmt, listCitiesSQL) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func (q *Queries) ListCities(ctx context.Context) ([]City, error) { return items, nil } -const updateCityName = `-- name: UpdateCityName :exec +const updateCityNameSQL = `-- name: UpdateCityName :exec UPDATE city SET name = ? WHERE slug = ? @@ -83,6 +83,6 @@ type UpdateCityNameParams struct { } func (q *Queries) UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error { - _, err := q.exec(ctx, q.updateCityNameStmt, updateCityName, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.updateCityNameStmt, updateCityNameSQL, arg.Name, arg.Slug) return err } diff --git a/examples/ondeck/mysql/db.go b/examples/ondeck/mysql/db.go index 67cc093797..06d914f613 100644 --- a/examples/ondeck/mysql/db.go +++ b/examples/ondeck/mysql/db.go @@ -24,34 +24,34 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.createCityStmt, err = db.PrepareContext(ctx, createCity); err != nil { + if q.createCityStmt, err = db.PrepareContext(ctx, createCitySQL); err != nil { return nil, fmt.Errorf("error preparing query CreateCity: %w", err) } - if q.createVenueStmt, err = db.PrepareContext(ctx, createVenue); err != nil { + if q.createVenueStmt, err = db.PrepareContext(ctx, createVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query CreateVenue: %w", err) } - if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenue); err != nil { + if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query DeleteVenue: %w", err) } - if q.getCityStmt, err = db.PrepareContext(ctx, getCity); err != nil { + if q.getCityStmt, err = db.PrepareContext(ctx, getCitySQL); err != nil { return nil, fmt.Errorf("error preparing query GetCity: %w", err) } - if q.getVenueStmt, err = db.PrepareContext(ctx, getVenue); err != nil { + if q.getVenueStmt, err = db.PrepareContext(ctx, getVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query GetVenue: %w", err) } - if q.listCitiesStmt, err = db.PrepareContext(ctx, listCities); err != nil { + if q.listCitiesStmt, err = db.PrepareContext(ctx, listCitiesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListCities: %w", err) } - if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenues); err != nil { + if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenuesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListVenues: %w", err) } - if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityName); err != nil { + if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateCityName: %w", err) } - if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueName); err != nil { + if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateVenueName: %w", err) } - if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCity); err != nil { + if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCitySQL); err != nil { return nil, fmt.Errorf("error preparing query VenueCountByCity: %w", err) } return &q, nil diff --git a/examples/ondeck/mysql/venue.sql.go b/examples/ondeck/mysql/venue.sql.go index 21a7a6e1bb..f8ddead6ed 100644 --- a/examples/ondeck/mysql/venue.sql.go +++ b/examples/ondeck/mysql/venue.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createVenue = `-- name: CreateVenue :execresult +const createVenueSQL = `-- name: CreateVenue :execresult INSERT INTO venue ( slug, name, @@ -43,7 +43,7 @@ type CreateVenueParams struct { } func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.Result, error) { - return q.exec(ctx, q.createVenueStmt, createVenue, + return q.exec(ctx, q.createVenueStmt, createVenueSQL, arg.Slug, arg.Name, arg.City, @@ -54,7 +54,7 @@ func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.R ) } -const deleteVenue = `-- name: DeleteVenue :exec +const deleteVenueSQL = `-- name: DeleteVenue :exec DELETE FROM venue WHERE slug = ? AND slug = ? ` @@ -65,11 +65,11 @@ type DeleteVenueParams struct { } func (q *Queries) DeleteVenue(ctx context.Context, arg DeleteVenueParams) error { - _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenue, arg.Slug, arg.Slug_2) + _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenueSQL, arg.Slug, arg.Slug_2) return err } -const getVenue = `-- name: GetVenue :one +const getVenueSQL = `-- name: GetVenue :one SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE slug = ? AND city = ? @@ -81,7 +81,7 @@ type GetVenueParams struct { } func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error) { - row := q.queryRow(ctx, q.getVenueStmt, getVenue, arg.Slug, arg.City) + row := q.queryRow(ctx, q.getVenueStmt, getVenueSQL, arg.Slug, arg.City) var i Venue err := row.Scan( &i.ID, @@ -98,7 +98,7 @@ func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, erro return i, err } -const listVenues = `-- name: ListVenues :many +const listVenuesSQL = `-- name: ListVenues :many SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE city = ? @@ -106,7 +106,7 @@ ORDER BY name ` func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) { - rows, err := q.query(ctx, q.listVenuesStmt, listVenues, city) + rows, err := q.query(ctx, q.listVenuesStmt, listVenuesSQL, city) if err != nil { return nil, err } @@ -139,7 +139,7 @@ func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) return items, nil } -const updateVenueName = `-- name: UpdateVenueName :exec +const updateVenueNameSQL = `-- name: UpdateVenueName :exec UPDATE venue SET name = ? WHERE slug = ? @@ -151,11 +151,11 @@ type UpdateVenueNameParams struct { } func (q *Queries) UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) error { - _, err := q.exec(ctx, q.updateVenueNameStmt, updateVenueName, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.updateVenueNameStmt, updateVenueNameSQL, arg.Name, arg.Slug) return err } -const venueCountByCity = `-- name: VenueCountByCity :many +const venueCountByCitySQL = `-- name: VenueCountByCity :many SELECT city, count(*) @@ -170,7 +170,7 @@ type VenueCountByCityRow struct { } func (q *Queries) VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error) { - rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCity) + rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCitySQL) if err != nil { return nil, err } diff --git a/examples/ondeck/postgresql/city.sql.go b/examples/ondeck/postgresql/city.sql.go index 5559bf5126..c45cc97208 100644 --- a/examples/ondeck/postgresql/city.sql.go +++ b/examples/ondeck/postgresql/city.sql.go @@ -11,7 +11,7 @@ import ( "context" ) -const createCity = `-- name: CreateCity :one +const createCitySQL = `-- name: CreateCity :one INSERT INTO city ( name, slug @@ -30,33 +30,33 @@ type CreateCityParams struct { // This is the second line of the comment // This is the third line func (q *Queries) CreateCity(ctx context.Context, arg CreateCityParams) (City, error) { - row := q.queryRow(ctx, q.createCityStmt, createCity, arg.Name, arg.Slug) + row := q.queryRow(ctx, q.createCityStmt, createCitySQL, arg.Name, arg.Slug) var i City err := row.Scan(&i.Slug, &i.Name) return i, err } -const getCity = `-- name: GetCity :one +const getCitySQL = `-- name: GetCity :one SELECT slug, name FROM city WHERE slug = $1 ` func (q *Queries) GetCity(ctx context.Context, slug string) (City, error) { - row := q.queryRow(ctx, q.getCityStmt, getCity, slug) + row := q.queryRow(ctx, q.getCityStmt, getCitySQL, slug) var i City err := row.Scan(&i.Slug, &i.Name) return i, err } -const listCities = `-- name: ListCities :many +const listCitiesSQL = `-- name: ListCities :many SELECT slug, name FROM city ORDER BY name ` func (q *Queries) ListCities(ctx context.Context) ([]City, error) { - rows, err := q.query(ctx, q.listCitiesStmt, listCities) + rows, err := q.query(ctx, q.listCitiesStmt, listCitiesSQL) if err != nil { return nil, err } @@ -78,7 +78,7 @@ func (q *Queries) ListCities(ctx context.Context) ([]City, error) { return items, nil } -const updateCityName = `-- name: UpdateCityName :exec +const updateCityNameSQL = `-- name: UpdateCityName :exec UPDATE city SET name = $2 WHERE slug = $1 @@ -90,6 +90,6 @@ type UpdateCityNameParams struct { } func (q *Queries) UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error { - _, err := q.exec(ctx, q.updateCityNameStmt, updateCityName, arg.Slug, arg.Name) + _, err := q.exec(ctx, q.updateCityNameStmt, updateCityNameSQL, arg.Slug, arg.Name) return err } diff --git a/examples/ondeck/postgresql/db.go b/examples/ondeck/postgresql/db.go index 86609552c7..6fce98852e 100644 --- a/examples/ondeck/postgresql/db.go +++ b/examples/ondeck/postgresql/db.go @@ -26,34 +26,34 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.createCityStmt, err = db.PrepareContext(ctx, createCity); err != nil { + if q.createCityStmt, err = db.PrepareContext(ctx, createCitySQL); err != nil { return nil, fmt.Errorf("error preparing query CreateCity: %w", err) } - if q.createVenueStmt, err = db.PrepareContext(ctx, createVenue); err != nil { + if q.createVenueStmt, err = db.PrepareContext(ctx, createVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query CreateVenue: %w", err) } - if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenue); err != nil { + if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query DeleteVenue: %w", err) } - if q.getCityStmt, err = db.PrepareContext(ctx, getCity); err != nil { + if q.getCityStmt, err = db.PrepareContext(ctx, getCitySQL); err != nil { return nil, fmt.Errorf("error preparing query GetCity: %w", err) } - if q.getVenueStmt, err = db.PrepareContext(ctx, getVenue); err != nil { + if q.getVenueStmt, err = db.PrepareContext(ctx, getVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query GetVenue: %w", err) } - if q.listCitiesStmt, err = db.PrepareContext(ctx, listCities); err != nil { + if q.listCitiesStmt, err = db.PrepareContext(ctx, listCitiesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListCities: %w", err) } - if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenues); err != nil { + if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenuesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListVenues: %w", err) } - if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityName); err != nil { + if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateCityName: %w", err) } - if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueName); err != nil { + if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateVenueName: %w", err) } - if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCity); err != nil { + if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCitySQL); err != nil { return nil, fmt.Errorf("error preparing query VenueCountByCity: %w", err) } return &q, nil diff --git a/examples/ondeck/postgresql/venue.sql.go b/examples/ondeck/postgresql/venue.sql.go index 0bc6713692..763c7afa81 100644 --- a/examples/ondeck/postgresql/venue.sql.go +++ b/examples/ondeck/postgresql/venue.sql.go @@ -13,7 +13,7 @@ import ( "github.com/lib/pq" ) -const createVenue = `-- name: CreateVenue :one +const createVenueSQL = `-- name: CreateVenue :one INSERT INTO venue ( slug, name, @@ -46,7 +46,7 @@ type CreateVenueParams struct { } func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (int32, error) { - row := q.queryRow(ctx, q.createVenueStmt, createVenue, + row := q.queryRow(ctx, q.createVenueStmt, createVenueSQL, arg.Slug, arg.Name, arg.City, @@ -60,17 +60,17 @@ func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (int32 return id, err } -const deleteVenue = `-- name: DeleteVenue :exec +const deleteVenueSQL = `-- name: DeleteVenue :exec DELETE FROM venue WHERE slug = $1 AND slug = $1 ` func (q *Queries) DeleteVenue(ctx context.Context, slug string) error { - _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenue, slug) + _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenueSQL, slug) return err } -const getVenue = `-- name: GetVenue :one +const getVenueSQL = `-- name: GetVenue :one SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE slug = $1 AND city = $2 @@ -82,7 +82,7 @@ type GetVenueParams struct { } func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error) { - row := q.queryRow(ctx, q.getVenueStmt, getVenue, arg.Slug, arg.City) + row := q.queryRow(ctx, q.getVenueStmt, getVenueSQL, arg.Slug, arg.City) var i Venue err := row.Scan( &i.ID, @@ -99,7 +99,7 @@ func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, erro return i, err } -const listVenues = `-- name: ListVenues :many +const listVenuesSQL = `-- name: ListVenues :many SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE city = $1 @@ -107,7 +107,7 @@ ORDER BY name ` func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) { - rows, err := q.query(ctx, q.listVenuesStmt, listVenues, city) + rows, err := q.query(ctx, q.listVenuesStmt, listVenuesSQL, city) if err != nil { return nil, err } @@ -140,7 +140,7 @@ func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) return items, nil } -const updateVenueName = `-- name: UpdateVenueName :one +const updateVenueNameSQL = `-- name: UpdateVenueName :one UPDATE venue SET name = $2 WHERE slug = $1 @@ -153,13 +153,13 @@ type UpdateVenueNameParams struct { } func (q *Queries) UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) (int32, error) { - row := q.queryRow(ctx, q.updateVenueNameStmt, updateVenueName, arg.Slug, arg.Name) + row := q.queryRow(ctx, q.updateVenueNameStmt, updateVenueNameSQL, arg.Slug, arg.Name) var id int32 err := row.Scan(&id) return id, err } -const venueCountByCity = `-- name: VenueCountByCity :many +const venueCountByCitySQL = `-- name: VenueCountByCity :many SELECT city, count(*) @@ -174,7 +174,7 @@ type VenueCountByCityRow struct { } func (q *Queries) VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error) { - rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCity) + rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCitySQL) if err != nil { return nil, err } diff --git a/examples/ondeck/sqlite/city.sql.go b/examples/ondeck/sqlite/city.sql.go index 89b321ea7f..95c0fc9ae8 100644 --- a/examples/ondeck/sqlite/city.sql.go +++ b/examples/ondeck/sqlite/city.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const createCity = `-- name: CreateCity :exec +const createCitySQL = `-- name: CreateCity :exec INSERT INTO city ( name, slug @@ -25,31 +25,31 @@ type CreateCityParams struct { } func (q *Queries) CreateCity(ctx context.Context, arg CreateCityParams) error { - _, err := q.exec(ctx, q.createCityStmt, createCity, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.createCityStmt, createCitySQL, arg.Name, arg.Slug) return err } -const getCity = `-- name: GetCity :one +const getCitySQL = `-- name: GetCity :one SELECT slug, name FROM city WHERE slug = ? ` func (q *Queries) GetCity(ctx context.Context, slug string) (City, error) { - row := q.queryRow(ctx, q.getCityStmt, getCity, slug) + row := q.queryRow(ctx, q.getCityStmt, getCitySQL, slug) var i City err := row.Scan(&i.Slug, &i.Name) return i, err } -const listCities = `-- name: ListCities :many +const listCitiesSQL = `-- name: ListCities :many SELECT slug, name FROM city ORDER BY name ` func (q *Queries) ListCities(ctx context.Context) ([]City, error) { - rows, err := q.query(ctx, q.listCitiesStmt, listCities) + rows, err := q.query(ctx, q.listCitiesStmt, listCitiesSQL) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func (q *Queries) ListCities(ctx context.Context) ([]City, error) { return items, nil } -const updateCityName = `-- name: UpdateCityName :exec +const updateCityNameSQL = `-- name: UpdateCityName :exec UPDATE city SET name = ? WHERE slug = ? @@ -83,6 +83,6 @@ type UpdateCityNameParams struct { } func (q *Queries) UpdateCityName(ctx context.Context, arg UpdateCityNameParams) error { - _, err := q.exec(ctx, q.updateCityNameStmt, updateCityName, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.updateCityNameStmt, updateCityNameSQL, arg.Name, arg.Slug) return err } diff --git a/examples/ondeck/sqlite/db.go b/examples/ondeck/sqlite/db.go index 67cc093797..06d914f613 100644 --- a/examples/ondeck/sqlite/db.go +++ b/examples/ondeck/sqlite/db.go @@ -24,34 +24,34 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.createCityStmt, err = db.PrepareContext(ctx, createCity); err != nil { + if q.createCityStmt, err = db.PrepareContext(ctx, createCitySQL); err != nil { return nil, fmt.Errorf("error preparing query CreateCity: %w", err) } - if q.createVenueStmt, err = db.PrepareContext(ctx, createVenue); err != nil { + if q.createVenueStmt, err = db.PrepareContext(ctx, createVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query CreateVenue: %w", err) } - if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenue); err != nil { + if q.deleteVenueStmt, err = db.PrepareContext(ctx, deleteVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query DeleteVenue: %w", err) } - if q.getCityStmt, err = db.PrepareContext(ctx, getCity); err != nil { + if q.getCityStmt, err = db.PrepareContext(ctx, getCitySQL); err != nil { return nil, fmt.Errorf("error preparing query GetCity: %w", err) } - if q.getVenueStmt, err = db.PrepareContext(ctx, getVenue); err != nil { + if q.getVenueStmt, err = db.PrepareContext(ctx, getVenueSQL); err != nil { return nil, fmt.Errorf("error preparing query GetVenue: %w", err) } - if q.listCitiesStmt, err = db.PrepareContext(ctx, listCities); err != nil { + if q.listCitiesStmt, err = db.PrepareContext(ctx, listCitiesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListCities: %w", err) } - if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenues); err != nil { + if q.listVenuesStmt, err = db.PrepareContext(ctx, listVenuesSQL); err != nil { return nil, fmt.Errorf("error preparing query ListVenues: %w", err) } - if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityName); err != nil { + if q.updateCityNameStmt, err = db.PrepareContext(ctx, updateCityNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateCityName: %w", err) } - if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueName); err != nil { + if q.updateVenueNameStmt, err = db.PrepareContext(ctx, updateVenueNameSQL); err != nil { return nil, fmt.Errorf("error preparing query UpdateVenueName: %w", err) } - if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCity); err != nil { + if q.venueCountByCityStmt, err = db.PrepareContext(ctx, venueCountByCitySQL); err != nil { return nil, fmt.Errorf("error preparing query VenueCountByCity: %w", err) } return &q, nil diff --git a/examples/ondeck/sqlite/venue.sql.go b/examples/ondeck/sqlite/venue.sql.go index 6242a9ae2e..58cd493776 100644 --- a/examples/ondeck/sqlite/venue.sql.go +++ b/examples/ondeck/sqlite/venue.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createVenue = `-- name: CreateVenue :execresult +const createVenueSQL = `-- name: CreateVenue :execresult INSERT INTO venue ( slug, name, @@ -43,7 +43,7 @@ type CreateVenueParams struct { } func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.Result, error) { - return q.exec(ctx, q.createVenueStmt, createVenue, + return q.exec(ctx, q.createVenueStmt, createVenueSQL, arg.Slug, arg.Name, arg.City, @@ -54,7 +54,7 @@ func (q *Queries) CreateVenue(ctx context.Context, arg CreateVenueParams) (sql.R ) } -const deleteVenue = `-- name: DeleteVenue :exec +const deleteVenueSQL = `-- name: DeleteVenue :exec DELETE FROM venue WHERE slug = ? AND slug = ? ` @@ -65,11 +65,11 @@ type DeleteVenueParams struct { } func (q *Queries) DeleteVenue(ctx context.Context, arg DeleteVenueParams) error { - _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenue, arg.Slug, arg.Slug_2) + _, err := q.exec(ctx, q.deleteVenueStmt, deleteVenueSQL, arg.Slug, arg.Slug_2) return err } -const getVenue = `-- name: GetVenue :one +const getVenueSQL = `-- name: GetVenue :one SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE slug = ? AND city = ? @@ -81,7 +81,7 @@ type GetVenueParams struct { } func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, error) { - row := q.queryRow(ctx, q.getVenueStmt, getVenue, arg.Slug, arg.City) + row := q.queryRow(ctx, q.getVenueStmt, getVenueSQL, arg.Slug, arg.City) var i Venue err := row.Scan( &i.ID, @@ -98,7 +98,7 @@ func (q *Queries) GetVenue(ctx context.Context, arg GetVenueParams) (Venue, erro return i, err } -const listVenues = `-- name: ListVenues :many +const listVenuesSQL = `-- name: ListVenues :many SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at FROM venue WHERE city = ? @@ -106,7 +106,7 @@ ORDER BY name ` func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) { - rows, err := q.query(ctx, q.listVenuesStmt, listVenues, city) + rows, err := q.query(ctx, q.listVenuesStmt, listVenuesSQL, city) if err != nil { return nil, err } @@ -139,7 +139,7 @@ func (q *Queries) ListVenues(ctx context.Context, city string) ([]Venue, error) return items, nil } -const updateVenueName = `-- name: UpdateVenueName :exec +const updateVenueNameSQL = `-- name: UpdateVenueName :exec UPDATE venue SET name = ? WHERE slug = ? @@ -151,11 +151,11 @@ type UpdateVenueNameParams struct { } func (q *Queries) UpdateVenueName(ctx context.Context, arg UpdateVenueNameParams) error { - _, err := q.exec(ctx, q.updateVenueNameStmt, updateVenueName, arg.Name, arg.Slug) + _, err := q.exec(ctx, q.updateVenueNameStmt, updateVenueNameSQL, arg.Name, arg.Slug) return err } -const venueCountByCity = `-- name: VenueCountByCity :many +const venueCountByCitySQL = `-- name: VenueCountByCity :many SELECT city, count(*) @@ -170,7 +170,7 @@ type VenueCountByCityRow struct { } func (q *Queries) VenueCountByCity(ctx context.Context) ([]VenueCountByCityRow, error) { - rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCity) + rows, err := q.query(ctx, q.venueCountByCityStmt, venueCountByCitySQL) if err != nil { return nil, err } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 82059c54b7..734fed4626 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -199,9 +199,10 @@ func buildQueries(req *plugin.GenerateRequest, options *opts.Options, enums []En var constantName string if options.EmitExportedQueries { - constantName = sdk.Title(query.Name) + constantName = sdk.Title(query.Name) + "SQL" } else { - constantName = escape(sdk.LowerTitle(query.Name)) + // The suffix keeps the name clear of Go keywords, so no escape is needed. + constantName = sdk.LowerTitle(query.Name) + "SQL" } comments := query.Comments diff --git a/internal/endtoend/testdata/alias/mysql/go/query.sql.go b/internal/endtoend/testdata/alias/mysql/go/query.sql.go index 281c3f5fd7..fbf35ab6b7 100644 --- a/internal/endtoend/testdata/alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/alias/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const aliasBar = `-- name: AliasBar :exec +const aliasBarSQL = `-- name: AliasBar :exec DELETE FROM bar b WHERE b.id = ? ` func (q *Queries) AliasBar(ctx context.Context, id uint64) error { - _, err := q.db.ExecContext(ctx, aliasBar, id) + _, err := q.db.ExecContext(ctx, aliasBarSQL, id) return err } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go index 93fa0abd42..e00934f232 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const aliasBar = `-- name: AliasBar :exec +const aliasBarSQL = `-- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1 ` func (q *Queries) AliasBar(ctx context.Context, id int32) error { - _, err := q.db.Exec(ctx, aliasBar, id) + _, err := q.db.Exec(ctx, aliasBarSQL, id) return err } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go index 93fa0abd42..e00934f232 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const aliasBar = `-- name: AliasBar :exec +const aliasBarSQL = `-- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1 ` func (q *Queries) AliasBar(ctx context.Context, id int32) error { - _, err := q.db.Exec(ctx, aliasBar, id) + _, err := q.db.Exec(ctx, aliasBarSQL, id) return err } diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go index 2f81fed20f..7946b9b88c 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const aliasBar = `-- name: AliasBar :exec +const aliasBarSQL = `-- name: AliasBar :exec DELETE FROM bar b WHERE b.id = $1 ` func (q *Queries) AliasBar(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, aliasBar, id) + _, err := q.db.ExecContext(ctx, aliasBarSQL, id) return err } diff --git a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go index 5e00770088..315b981871 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const aliasBar = `-- name: AliasBar :exec +const aliasBarSQL = `-- name: AliasBar :exec DELETE FROM bar AS b WHERE b.id = ? ` func (q *Queries) AliasBar(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, aliasBar, id) + _, err := q.db.ExecContext(ctx, aliasBarSQL, id) return err } diff --git a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go index 1bb2829390..c2c13bead4 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const any_ = `-- name: Any :many +const anySQL = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.Query(ctx, any_, dollar_1) + rows, err := q.db.Query(ctx, anySQL, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go index 1bb2829390..c2c13bead4 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const any_ = `-- name: Any :many +const anySQL = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.Query(ctx, any_, dollar_1) + rows, err := q.db.Query(ctx, anySQL, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/any/stdlib/go/query.sql.go b/internal/endtoend/testdata/any/stdlib/go/query.sql.go index 240bb91f02..c47eb439ef 100644 --- a/internal/endtoend/testdata/any/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/any/stdlib/go/query.sql.go @@ -11,14 +11,14 @@ import ( "github.com/lib/pq" ) -const any_ = `-- name: Any :many +const anySQL = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, any_, pq.Array(dollar_1)) + rows, err := q.db.QueryContext(ctx, anySQL, pq.Array(dollar_1)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go index 0886f96148..2ecb9bf63a 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const in = `-- name: In :many +const inSQL = `-- name: In :many SELECT id FROM bar WHERE id IN ($1, $2) @@ -21,7 +21,7 @@ type InParams struct { } func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { - rows, err := q.db.Query(ctx, in, arg.ID, arg.ID_2) + rows, err := q.db.Query(ctx, inSQL, arg.ID, arg.ID_2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go index 0886f96148..2ecb9bf63a 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const in = `-- name: In :many +const inSQL = `-- name: In :many SELECT id FROM bar WHERE id IN ($1, $2) @@ -21,7 +21,7 @@ type InParams struct { } func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { - rows, err := q.db.Query(ctx, in, arg.ID, arg.ID_2) + rows, err := q.db.Query(ctx, inSQL, arg.ID, arg.ID_2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go index f2355cf6bd..d619f08864 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const in = `-- name: In :many +const inSQL = `-- name: In :many SELECT id FROM bar WHERE id IN ($1, $2) @@ -21,7 +21,7 @@ type InParams struct { } func (q *Queries) In(ctx context.Context, arg InParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, in, arg.ID, arg.ID_2) + rows, err := q.db.QueryContext(ctx, inSQL, arg.ID, arg.ID_2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go index 72b852365c..2bc4ed5511 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.Query(ctx, textArray) + rows, err := q.db.Query(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go index 72b852365c..2bc4ed5511 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.Query(ctx, textArray) + rows, err := q.db.Query(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go index ee4a2d19c0..e6f6e396d5 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/lib/pq" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, textArray) + rows, err := q.db.QueryContext(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go index 0bc457938f..8c8a07f966 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const joinTextArray = `-- name: JoinTextArray :many +const joinTextArraySQL = `-- name: JoinTextArray :many SELECT bar.info FROM foo JOIN bar ON foo.bar = bar.id ` func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.Query(ctx, joinTextArray) + rows, err := q.db.Query(ctx, joinTextArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go index 0bc457938f..8c8a07f966 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const joinTextArray = `-- name: JoinTextArray :many +const joinTextArraySQL = `-- name: JoinTextArray :many SELECT bar.info FROM foo JOIN bar ON foo.bar = bar.id ` func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.Query(ctx, joinTextArray) + rows, err := q.db.Query(ctx, joinTextArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go index ba11aa1834..1dc2e8e476 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go @@ -11,14 +11,14 @@ import ( "github.com/lib/pq" ) -const joinTextArray = `-- name: JoinTextArray :many +const joinTextArraySQL = `-- name: JoinTextArray :many SELECT bar.info FROM foo JOIN bar ON foo.bar = bar.id ` func (q *Queries) JoinTextArray(ctx context.Context) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, joinTextArray) + rows, err := q.db.QueryContext(ctx, joinTextArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go b/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go index 3443ac6d1a..4c45b72b2a 100644 --- a/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go @@ -12,7 +12,7 @@ import ( "cloud.google.com/go/spanner" ) -const albumTitles = `-- name: AlbumTitles :one +const albumTitlesSQL = `-- name: AlbumTitles :one SELECT singer_id, ARRAY(SELECT title FROM albums WHERE albums.singer_id = singers.singer_id) AS titles FROM singers WHERE singer_id = @singer_id ` @@ -23,13 +23,13 @@ type AlbumTitlesRow struct { } func (q *Queries) AlbumTitles(ctx context.Context, singerID int64) (AlbumTitlesRow, error) { - row := q.db.QueryRowContext(ctx, albumTitles, sql.Named("singer_id", singerID)) + row := q.db.QueryRowContext(ctx, albumTitlesSQL, sql.Named("singer_id", singerID)) var i AlbumTitlesRow err := row.Scan(&i.SingerID, &i.Titles) return i, err } -const firstTag = `-- name: FirstTag :one +const firstTagSQL = `-- name: FirstTag :one SELECT tags[OFFSET(0)] AS first_tag, tags[SAFE_ORDINAL(@n)] AS nth_tag, scores[SAFE_OFFSET(0)] AS first_score FROM singers WHERE singer_id = @singer_id ` @@ -46,13 +46,13 @@ type FirstTagRow struct { } func (q *Queries) FirstTag(ctx context.Context, arg FirstTagParams) (FirstTagRow, error) { - row := q.db.QueryRowContext(ctx, firstTag, sql.Named("n", arg.N), sql.Named("singer_id", arg.SingerID)) + row := q.db.QueryRowContext(ctx, firstTagSQL, sql.Named("n", arg.N), sql.Named("singer_id", arg.SingerID)) var i FirstTagRow err := row.Scan(&i.FirstTag, &i.NthTag, &i.FirstScore) return i, err } -const singerTags = `-- name: SingerTags :many +const singerTagsSQL = `-- name: SingerTags :many SELECT singer_id, tag FROM singers, UNNEST(tags) AS tag ` @@ -62,7 +62,7 @@ type SingerTagsRow struct { } func (q *Queries) SingerTags(ctx context.Context) ([]SingerTagsRow, error) { - rows, err := q.db.QueryContext(ctx, singerTags) + rows, err := q.db.QueryContext(ctx, singerTagsSQL) if err != nil { return nil, err } @@ -84,7 +84,7 @@ func (q *Queries) SingerTags(ctx context.Context) ([]SingerTagsRow, error) { return items, nil } -const singersByIDs = `-- name: SingersByIDs :many +const singersByIDsSQL = `-- name: SingersByIDs :many SELECT singer_id, name FROM singers WHERE singer_id IN UNNEST(@ids) ` @@ -94,7 +94,7 @@ type SingersByIDsRow struct { } func (q *Queries) SingersByIDs(ctx context.Context, ids []spanner.NullInt64) ([]SingersByIDsRow, error) { - rows, err := q.db.QueryContext(ctx, singersByIDs, sql.Named("ids", ids)) + rows, err := q.db.QueryContext(ctx, singersByIDsSQL, sql.Named("ids", ids)) if err != nil { return nil, err } @@ -116,12 +116,12 @@ func (q *Queries) SingersByIDs(ctx context.Context, ids []spanner.NullInt64) ([] return items, nil } -const singersNotIn = `-- name: SingersNotIn :many +const singersNotInSQL = `-- name: SingersNotIn :many SELECT singer_id FROM singers WHERE singer_id NOT IN UNNEST(@ids) ` func (q *Queries) SingersNotIn(ctx context.Context, ids []spanner.NullInt64) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, singersNotIn, sql.Named("ids", ids)) + rows, err := q.db.QueryContext(ctx, singersNotInSQL, sql.Named("ids", ids)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go index 9ff7203abf..300c5103bc 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const getValues = `-- name: GetValues :batchmany +const getValuesSQL = `-- name: GetValues :batchmany SELECT a, b FROM myschema.foo WHERE b = $1 @@ -35,7 +35,7 @@ func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBa vals := []any{ a, } - batch.Queue(getValues, vals...) + batch.Queue(getValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &GetValuesBatchResults{br, len(b), false} @@ -77,7 +77,7 @@ func (b *GetValuesBatchResults) Close() error { return b.br.Close() } -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) RETURNING a @@ -101,7 +101,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *I a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} @@ -130,7 +130,7 @@ func (b *InsertValuesBatchResults) Close() error { return b.br.Close() } -const updateValues = `-- name: UpdateValues :batchexec +const updateValuesSQL = `-- name: UpdateValues :batchexec UPDATE myschema.foo SET a = $1, b = $2 ` @@ -152,7 +152,7 @@ func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *U a.A, a.B, } - batch.Queue(updateValues, vals...) + batch.Queue(updateValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &UpdateValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go index 390c85c327..ef848a6e4f 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const getValues = `-- name: GetValues :batchmany +const getValuesSQL = `-- name: GetValues :batchmany SELECT a, b FROM myschema.foo WHERE b = $1 @@ -35,7 +35,7 @@ func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatc vals := []any{ a, } - batch.Queue(getValues, vals...) + batch.Queue(getValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &GetValuesBatchResults{br, len(b), false} @@ -77,7 +77,7 @@ func (b *GetValuesBatchResults) Close() error { return b.br.Close() } -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) RETURNING a @@ -101,7 +101,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *I a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} @@ -130,7 +130,7 @@ func (b *InsertValuesBatchResults) Close() error { return b.br.Close() } -const updateValues = `-- name: UpdateValues :batchexec +const updateValuesSQL = `-- name: UpdateValues :batchexec UPDATE myschema.foo SET a = $1, b = $2 ` @@ -152,7 +152,7 @@ func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *U a.A, a.B, } - batch.Queue(updateValues, vals...) + batch.Queue(updateValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &UpdateValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go index 224d28743f..91f9c4251e 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const getValues = `-- name: GetValues :batchmany +const getValuesSQL = `-- name: GetValues :batchmany SELECT a, b FROM myschema.foo WHERE b = $1 @@ -35,7 +35,7 @@ func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBa vals := []any{ a, } - batch.Queue(getValues, vals...) + batch.Queue(getValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &GetValuesBatchResults{br, len(b), false} @@ -77,7 +77,7 @@ func (b *GetValuesBatchResults) Close() error { return b.br.Close() } -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) RETURNING a @@ -101,7 +101,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *I a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go index 865697d866..fc52eff3f1 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const updateValues = `-- name: UpdateValues :exec +const updateValuesSQL = `-- name: UpdateValues :exec UPDATE myschema.foo SET a = $1, b = $2 ` @@ -20,6 +20,6 @@ type UpdateValuesParams struct { } func (q *Queries) UpdateValues(ctx context.Context, arg UpdateValuesParams) error { - _, err := q.db.Exec(ctx, updateValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, updateValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go index 65bb113d6f..7d7d8c4a23 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const getValues = `-- name: GetValues :batchmany +const getValuesSQL = `-- name: GetValues :batchmany SELECT a, b FROM myschema.foo WHERE b = $1 @@ -35,7 +35,7 @@ func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatc vals := []any{ a, } - batch.Queue(getValues, vals...) + batch.Queue(getValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &GetValuesBatchResults{br, len(b), false} @@ -77,7 +77,7 @@ func (b *GetValuesBatchResults) Close() error { return b.br.Close() } -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO myschema.foo (a, b) VALUES ($1, $2) RETURNING a @@ -101,7 +101,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *I a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go index 11c950cd9b..8a6ae5ddac 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const updateValues = `-- name: UpdateValues :exec +const updateValuesSQL = `-- name: UpdateValues :exec UPDATE myschema.foo SET a = $1, b = $2 ` @@ -21,6 +21,6 @@ type UpdateValuesParams struct { } func (q *Queries) UpdateValues(ctx context.Context, arg UpdateValuesParams) error { - _, err := q.db.Exec(ctx, updateValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, updateValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go index 6d66b1275c..3f431080cd 100644 --- a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const createAuthors = `-- name: CreateAuthors :batchexec +const createAuthorsSQL = `-- name: CreateAuthors :batchexec INSERT INTO authors ( name, bio ) VALUES ( @@ -43,7 +43,7 @@ func (q *Queries) CreateAuthors(ctx context.Context, arg []CreateAuthorsParams) a.Name, a.Bio, } - batch.Queue(createAuthors, vals...) + batch.Queue(createAuthorsSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &CreateAuthorsBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go index 706e0bfd20..30c9369a58 100644 --- a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const insertMappping = `-- name: InsertMappping :batchexec +const insertMapppingSQL = `-- name: InsertMappping :batchexec WITH table1 AS ( @@ -73,7 +73,7 @@ func (q *Queries) InsertMappping(ctx context.Context, arg []InsertMapppingParams a.Sn, a.UpdatedAt, } - batch.Queue(insertMappping, vals...) + batch.Queue(insertMapppingSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertMapppingBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go index 4b357c72a3..69c0652862 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBetweenPrices = `-- name: GetBetweenPrices :many +const getBetweenPricesSQL = `-- name: GetBetweenPrices :many SELECT id, name, price FROM products WHERE price BETWEEN ? AND ? @@ -21,7 +21,7 @@ type GetBetweenPricesParams struct { } func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPrices, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesPara return items, nil } -const getBetweenPricesNamed = `-- name: GetBetweenPricesNamed :many +const getBetweenPricesNamedSQL = `-- name: GetBetweenPricesNamed :many SELECT id, name, price FROM products WHERE price BETWEEN ? AND ? @@ -55,7 +55,7 @@ type GetBetweenPricesNamedParams struct { } func (q *Queries) GetBetweenPricesNamed(ctx context.Context, arg GetBetweenPricesNamedParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPricesNamed, arg.MinPrice, arg.MaxPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesNamedSQL, arg.MinPrice, arg.MaxPrice) if err != nil { return nil, err } @@ -77,7 +77,7 @@ func (q *Queries) GetBetweenPricesNamed(ctx context.Context, arg GetBetweenPrice return items, nil } -const getBetweenPricesTable = `-- name: GetBetweenPricesTable :many +const getBetweenPricesTableSQL = `-- name: GetBetweenPricesTable :many SELECT id, name, price FROM products WHERE products.price BETWEEN ? AND ? @@ -89,7 +89,7 @@ type GetBetweenPricesTableParams struct { } func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPricesTableParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPricesTable, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } @@ -111,7 +111,7 @@ func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPrice return items, nil } -const getBetweenPricesTableAlias = `-- name: GetBetweenPricesTableAlias :many +const getBetweenPricesTableAliasSQL = `-- name: GetBetweenPricesTableAlias :many SELECT id, name, price FROM products as p WHERE p.price BETWEEN ? AND ? @@ -123,7 +123,7 @@ type GetBetweenPricesTableAliasParams struct { } func (q *Queries) GetBetweenPricesTableAlias(ctx context.Context, arg GetBetweenPricesTableAliasParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAlias, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAliasSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go index 2083abf243..c9d5380dc9 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBetweenPrices = `-- name: GetBetweenPrices :many +const getBetweenPricesSQL = `-- name: GetBetweenPrices :many SELECT name, price FROM products WHERE price BETWEEN ? AND ? @@ -21,7 +21,7 @@ type GetBetweenPricesParams struct { } func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPrices, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesPara return items, nil } -const getBetweenPricesTable = `-- name: GetBetweenPricesTable :many +const getBetweenPricesTableSQL = `-- name: GetBetweenPricesTable :many SELECT name, price FROM products WHERE products.price BETWEEN ? AND ? @@ -55,7 +55,7 @@ type GetBetweenPricesTableParams struct { } func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPricesTableParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPricesTable, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } @@ -77,7 +77,7 @@ func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPrice return items, nil } -const getBetweenPricesTableAlias = `-- name: GetBetweenPricesTableAlias :many +const getBetweenPricesTableAliasSQL = `-- name: GetBetweenPricesTableAlias :many SELECT name, price FROM products AS p WHERE p.price BETWEEN ? AND ? @@ -89,7 +89,7 @@ type GetBetweenPricesTableAliasParams struct { } func (q *Queries) GetBetweenPricesTableAlias(ctx context.Context, arg GetBetweenPricesTableAliasParams) ([]Product, error) { - rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAlias, arg.FromPrice, arg.ToPrice) + rows, err := q.db.QueryContext(ctx, getBetweenPricesTableAliasSQL, arg.FromPrice, arg.ToPrice) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go index fe8f861ead..238b893e6c 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_bit_null, v_varbit_null, v_bit, v_varbit from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go index fe8f861ead..238b893e6c 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_bit_null, v_varbit_null, v_bit, v_varbit from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go index 0cb38ae2db..85b45822e2 100644 --- a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go @@ -12,7 +12,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -27,41 +27,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go index 5dd7c165fe..3a71de382e 100644 --- a/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go @@ -9,265 +9,265 @@ import ( "context" ) -const abs = `-- name: Abs :one +const absSQL = `-- name: Abs :one SELECT abs(-17.4) ` func (q *Queries) Abs(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, abs) + row := q.db.QueryRowContext(ctx, absSQL) var abs int64 err := row.Scan(&abs) return abs, err } -const cbrt = `-- name: Cbrt :one +const cbrtSQL = `-- name: Cbrt :one SELECT cbrt(27.0) ` func (q *Queries) Cbrt(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, cbrt) + row := q.db.QueryRowContext(ctx, cbrtSQL) var cbrt float64 err := row.Scan(&cbrt) return cbrt, err } -const ceil = `-- name: Ceil :one +const ceilSQL = `-- name: Ceil :one SELECT ceil(-42.8) ` func (q *Queries) Ceil(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, ceil) + row := q.db.QueryRowContext(ctx, ceilSQL) var ceil float64 err := row.Scan(&ceil) return ceil, err } -const ceiling = `-- name: Ceiling :one +const ceilingSQL = `-- name: Ceiling :one SELECT ceiling(-95.3) ` func (q *Queries) Ceiling(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, ceiling) + row := q.db.QueryRowContext(ctx, ceilingSQL) var ceiling float64 err := row.Scan(&ceiling) return ceiling, err } -const degrees = `-- name: Degrees :one +const degreesSQL = `-- name: Degrees :one SELECT degrees(0.5) ` func (q *Queries) Degrees(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, degrees) + row := q.db.QueryRowContext(ctx, degreesSQL) var degrees float64 err := row.Scan(°rees) return degrees, err } -const div = `-- name: Div :one +const divSQL = `-- name: Div :one SELECT div(9,4) ` func (q *Queries) Div(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, div) + row := q.db.QueryRowContext(ctx, divSQL) var div string err := row.Scan(&div) return div, err } -const exp = `-- name: Exp :one +const expSQL = `-- name: Exp :one SELECT exp(1.0) ` func (q *Queries) Exp(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, exp) + row := q.db.QueryRowContext(ctx, expSQL) var exp float64 err := row.Scan(&exp) return exp, err } -const floor = `-- name: Floor :one +const floorSQL = `-- name: Floor :one SELECT floor(-42.8) ` func (q *Queries) Floor(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, floor) + row := q.db.QueryRowContext(ctx, floorSQL) var floor float64 err := row.Scan(&floor) return floor, err } -const ln = `-- name: Ln :one +const lnSQL = `-- name: Ln :one SELECT ln(2.0) ` func (q *Queries) Ln(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, ln) + row := q.db.QueryRowContext(ctx, lnSQL) var ln float64 err := row.Scan(&ln) return ln, err } -const log = `-- name: Log :one +const logSQL = `-- name: Log :one SELECT log(100.0) ` func (q *Queries) Log(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, log) + row := q.db.QueryRowContext(ctx, logSQL) var log float64 err := row.Scan(&log) return log, err } -const logs = `-- name: Logs :one +const logsSQL = `-- name: Logs :one SELECT log(2.0, 64.0) ` func (q *Queries) Logs(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, logs) + row := q.db.QueryRowContext(ctx, logsSQL) var log string err := row.Scan(&log) return log, err } -const mod = `-- name: Mod :one +const modSQL = `-- name: Mod :one SELECT mod(9,4) ` func (q *Queries) Mod(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, mod) + row := q.db.QueryRowContext(ctx, modSQL) var mod int64 err := row.Scan(&mod) return mod, err } -const pi = `-- name: Pi :one +const piSQL = `-- name: Pi :one SELECT pi() ` func (q *Queries) Pi(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, pi) + row := q.db.QueryRowContext(ctx, piSQL) var pi float64 err := row.Scan(&pi) return pi, err } -const power = `-- name: Power :one +const powerSQL = `-- name: Power :one SELECT power(9.0, 3.0) ` func (q *Queries) Power(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, power) + row := q.db.QueryRowContext(ctx, powerSQL) var power float64 err := row.Scan(&power) return power, err } -const radians = `-- name: Radians :one +const radiansSQL = `-- name: Radians :one SELECT radians(45.0) ` func (q *Queries) Radians(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, radians) + row := q.db.QueryRowContext(ctx, radiansSQL) var radians float64 err := row.Scan(&radians) return radians, err } -const round = `-- name: Round :one +const roundSQL = `-- name: Round :one SELECT round(42.4) ` func (q *Queries) Round(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, round) + row := q.db.QueryRowContext(ctx, roundSQL) var round float64 err := row.Scan(&round) return round, err } -const rounds = `-- name: Rounds :one +const roundsSQL = `-- name: Rounds :one SELECT round(42.4382, 2) ` func (q *Queries) Rounds(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, rounds) + row := q.db.QueryRowContext(ctx, roundsSQL) var round string err := row.Scan(&round) return round, err } -const scale = `-- name: Scale :one +const scaleSQL = `-- name: Scale :one SELECT scale(8.41) ` func (q *Queries) Scale(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, scale) + row := q.db.QueryRowContext(ctx, scaleSQL) var scale int32 err := row.Scan(&scale) return scale, err } -const sign = `-- name: Sign :one +const signSQL = `-- name: Sign :one SELECT sign(-8.4) ` func (q *Queries) Sign(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, sign) + row := q.db.QueryRowContext(ctx, signSQL) var sign float64 err := row.Scan(&sign) return sign, err } -const sqrt = `-- name: Sqrt :one +const sqrtSQL = `-- name: Sqrt :one SELECT sqrt(2.0) ` func (q *Queries) Sqrt(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, sqrt) + row := q.db.QueryRowContext(ctx, sqrtSQL) var sqrt float64 err := row.Scan(&sqrt) return sqrt, err } -const trunc = `-- name: Trunc :one +const truncSQL = `-- name: Trunc :one SELECT trunc(42.8) ` func (q *Queries) Trunc(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, trunc) + row := q.db.QueryRowContext(ctx, truncSQL) var trunc float64 err := row.Scan(&trunc) return trunc, err } -const truncs = `-- name: Truncs :one +const truncsSQL = `-- name: Truncs :one SELECT trunc(42.4382, 2) ` func (q *Queries) Truncs(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, truncs) + row := q.db.QueryRowContext(ctx, truncsSQL) var trunc string err := row.Scan(&trunc) return trunc, err } -const widthBucketNumerics = `-- name: WidthBucketNumerics :one +const widthBucketNumericsSQL = `-- name: WidthBucketNumerics :one SELECT width_bucket(5.35, 0.024, 10.06, 5) ` func (q *Queries) WidthBucketNumerics(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, widthBucketNumerics) + row := q.db.QueryRowContext(ctx, widthBucketNumericsSQL) var width_bucket int32 err := row.Scan(&width_bucket) return width_bucket, err } -const widthBucketTimestamps = `-- name: WidthBucketTimestamps :one +const widthBucketTimestampsSQL = `-- name: WidthBucketTimestamps :one SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) ` func (q *Queries) WidthBucketTimestamps(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, widthBucketTimestamps) + row := q.db.QueryRowContext(ctx, widthBucketTimestampsSQL) var width_bucket int32 err := row.Scan(&width_bucket) return width_bucket, err diff --git a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go index de2a1fa89c..5b0f33001d 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go @@ -10,155 +10,155 @@ import ( "database/sql" ) -const getAvg = `-- name: GetAvg :one +const getAvgSQL = `-- name: GetAvg :one SELECT avg(int_val) FROM test ` func (q *Queries) GetAvg(ctx context.Context) (sql.NullFloat64, error) { - row := q.db.QueryRowContext(ctx, getAvg) + row := q.db.QueryRowContext(ctx, getAvgSQL) var avg sql.NullFloat64 err := row.Scan(&avg) return avg, err } -const getCount = `-- name: GetCount :one +const getCountSQL = `-- name: GetCount :one SELECT count(*) FROM test ` func (q *Queries) GetCount(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getCount) + row := q.db.QueryRowContext(ctx, getCountSQL) var count int64 err := row.Scan(&count) return count, err } -const getCountId = `-- name: GetCountId :one +const getCountIdSQL = `-- name: GetCountId :one SELECT count(id) FROM test ` func (q *Queries) GetCountId(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getCountId) + row := q.db.QueryRowContext(ctx, getCountIdSQL) var count int64 err := row.Scan(&count) return count, err } -const getGroupConcatInt = `-- name: GetGroupConcatInt :one +const getGroupConcatIntSQL = `-- name: GetGroupConcatInt :one SELECT group_concat(int_val) FROM test ` func (q *Queries) GetGroupConcatInt(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, getGroupConcatInt) + row := q.db.QueryRowContext(ctx, getGroupConcatIntSQL) var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } -const getGroupConcatInt2 = `-- name: GetGroupConcatInt2 :one +const getGroupConcatInt2SQL = `-- name: GetGroupConcatInt2 :one SELECT group_concat(1, ':') FROM test ` func (q *Queries) GetGroupConcatInt2(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, getGroupConcatInt2) + row := q.db.QueryRowContext(ctx, getGroupConcatInt2SQL) var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } -const getGroupConcatText = `-- name: GetGroupConcatText :one +const getGroupConcatTextSQL = `-- name: GetGroupConcatText :one SELECT group_concat(text_val) FROM test ` func (q *Queries) GetGroupConcatText(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, getGroupConcatText) + row := q.db.QueryRowContext(ctx, getGroupConcatTextSQL) var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } -const getGroupConcatText2 = `-- name: GetGroupConcatText2 :one +const getGroupConcatText2SQL = `-- name: GetGroupConcatText2 :one SELECT group_concat(text_val, ':') FROM test ` func (q *Queries) GetGroupConcatText2(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, getGroupConcatText2) + row := q.db.QueryRowContext(ctx, getGroupConcatText2SQL) var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } -const getMaxInt = `-- name: GetMaxInt :one +const getMaxIntSQL = `-- name: GetMaxInt :one SELECT max(int_val) FROM test ` func (q *Queries) GetMaxInt(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMaxInt) + row := q.db.QueryRowContext(ctx, getMaxIntSQL) var max any err := row.Scan(&max) return max, err } -const getMaxText = `-- name: GetMaxText :one +const getMaxTextSQL = `-- name: GetMaxText :one SELECT max(text_val) FROM test ` func (q *Queries) GetMaxText(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMaxText) + row := q.db.QueryRowContext(ctx, getMaxTextSQL) var max any err := row.Scan(&max) return max, err } -const getMinInt = `-- name: GetMinInt :one +const getMinIntSQL = `-- name: GetMinInt :one SELECT min(int_val) FROM test ` func (q *Queries) GetMinInt(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMinInt) + row := q.db.QueryRowContext(ctx, getMinIntSQL) var min any err := row.Scan(&min) return min, err } -const getMinText = `-- name: GetMinText :one +const getMinTextSQL = `-- name: GetMinText :one SELECT min(text_val) FROM test ` func (q *Queries) GetMinText(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMinText) + row := q.db.QueryRowContext(ctx, getMinTextSQL) var min any err := row.Scan(&min) return min, err } -const getSumInt = `-- name: GetSumInt :one +const getSumIntSQL = `-- name: GetSumInt :one SELECT sum(int_val) FROM test ` func (q *Queries) GetSumInt(ctx context.Context) (sql.NullFloat64, error) { - row := q.db.QueryRowContext(ctx, getSumInt) + row := q.db.QueryRowContext(ctx, getSumIntSQL) var sum sql.NullFloat64 err := row.Scan(&sum) return sum, err } -const getSumText = `-- name: GetSumText :one +const getSumTextSQL = `-- name: GetSumText :one SELECT sum(text_val) FROM test ` func (q *Queries) GetSumText(ctx context.Context) (sql.NullFloat64, error) { - row := q.db.QueryRowContext(ctx, getSumText) + row := q.db.QueryRowContext(ctx, getSumTextSQL) var sum sql.NullFloat64 err := row.Scan(&sum) return sum, err } -const getTotalInt = `-- name: GetTotalInt :one +const getTotalIntSQL = `-- name: GetTotalInt :one SELECT total(int_val) FROM test ` func (q *Queries) GetTotalInt(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getTotalInt) + row := q.db.QueryRowContext(ctx, getTotalIntSQL) var total float64 err := row.Scan(&total) return total, err diff --git a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go index 152d80ad46..fb8c0b260e 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go @@ -9,320 +9,320 @@ import ( "context" ) -const getAcos = `-- name: GetAcos :one +const getAcosSQL = `-- name: GetAcos :one SELECT acos(1.0) ` func (q *Queries) GetAcos(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAcos) + row := q.db.QueryRowContext(ctx, getAcosSQL) var acos float64 err := row.Scan(&acos) return acos, err } -const getAcosh = `-- name: GetAcosh :one +const getAcoshSQL = `-- name: GetAcosh :one SELECT acosh(1.0) ` func (q *Queries) GetAcosh(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAcosh) + row := q.db.QueryRowContext(ctx, getAcoshSQL) var acosh float64 err := row.Scan(&acosh) return acosh, err } -const getAsin = `-- name: GetAsin :one +const getAsinSQL = `-- name: GetAsin :one SELECT asin(1.0) ` func (q *Queries) GetAsin(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAsin) + row := q.db.QueryRowContext(ctx, getAsinSQL) var asin float64 err := row.Scan(&asin) return asin, err } -const getAsinh = `-- name: GetAsinh :one +const getAsinhSQL = `-- name: GetAsinh :one SELECT asinh(1.0) ` func (q *Queries) GetAsinh(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAsinh) + row := q.db.QueryRowContext(ctx, getAsinhSQL) var asinh float64 err := row.Scan(&asinh) return asinh, err } -const getAtan = `-- name: GetAtan :one +const getAtanSQL = `-- name: GetAtan :one SELECT atan(1.0) ` func (q *Queries) GetAtan(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAtan) + row := q.db.QueryRowContext(ctx, getAtanSQL) var atan float64 err := row.Scan(&atan) return atan, err } -const getAtan2 = `-- name: GetAtan2 :one +const getAtan2SQL = `-- name: GetAtan2 :one SELECT atan2(1.0, 0.5) ` func (q *Queries) GetAtan2(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAtan2) + row := q.db.QueryRowContext(ctx, getAtan2SQL) var atan2 float64 err := row.Scan(&atan2) return atan2, err } -const getAtanh = `-- name: GetAtanh :one +const getAtanhSQL = `-- name: GetAtanh :one SELECT atanh(1.0) ` func (q *Queries) GetAtanh(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAtanh) + row := q.db.QueryRowContext(ctx, getAtanhSQL) var atanh float64 err := row.Scan(&atanh) return atanh, err } -const getCeil = `-- name: GetCeil :one +const getCeilSQL = `-- name: GetCeil :one SELECT ceil(1.0) ` func (q *Queries) GetCeil(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getCeil) + row := q.db.QueryRowContext(ctx, getCeilSQL) var ceil float64 err := row.Scan(&ceil) return ceil, err } -const getCeilin = `-- name: GetCeilin :one +const getCeilinSQL = `-- name: GetCeilin :one SELECT ceiling(1.0) ` func (q *Queries) GetCeilin(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getCeilin) + row := q.db.QueryRowContext(ctx, getCeilinSQL) var ceiling float64 err := row.Scan(&ceiling) return ceiling, err } -const getCos = `-- name: GetCos :one +const getCosSQL = `-- name: GetCos :one SELECT cos(1.0) ` func (q *Queries) GetCos(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getCos) + row := q.db.QueryRowContext(ctx, getCosSQL) var cos float64 err := row.Scan(&cos) return cos, err } -const getCosh = `-- name: GetCosh :one +const getCoshSQL = `-- name: GetCosh :one SELECT cosh(1.0) ` func (q *Queries) GetCosh(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getCosh) + row := q.db.QueryRowContext(ctx, getCoshSQL) var cosh float64 err := row.Scan(&cosh) return cosh, err } -const getDegrees = `-- name: GetDegrees :one +const getDegreesSQL = `-- name: GetDegrees :one SELECT degrees(1.0) ` func (q *Queries) GetDegrees(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getDegrees) + row := q.db.QueryRowContext(ctx, getDegreesSQL) var degrees float64 err := row.Scan(°rees) return degrees, err } -const getExp = `-- name: GetExp :one +const getExpSQL = `-- name: GetExp :one SELECT exp(1.0) ` func (q *Queries) GetExp(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getExp) + row := q.db.QueryRowContext(ctx, getExpSQL) var exp float64 err := row.Scan(&exp) return exp, err } -const getFloor = `-- name: GetFloor :one +const getFloorSQL = `-- name: GetFloor :one SELECT floor(1.0) ` func (q *Queries) GetFloor(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getFloor) + row := q.db.QueryRowContext(ctx, getFloorSQL) var floor float64 err := row.Scan(&floor) return floor, err } -const getLn = `-- name: GetLn :one +const getLnSQL = `-- name: GetLn :one SELECT ln(1.0) ` func (q *Queries) GetLn(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getLn) + row := q.db.QueryRowContext(ctx, getLnSQL) var ln float64 err := row.Scan(&ln) return ln, err } -const getLog = `-- name: GetLog :one +const getLogSQL = `-- name: GetLog :one SELECT log(1.0) ` func (q *Queries) GetLog(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getLog) + row := q.db.QueryRowContext(ctx, getLogSQL) var log float64 err := row.Scan(&log) return log, err } -const getLog10 = `-- name: GetLog10 :one +const getLog10SQL = `-- name: GetLog10 :one SELECT log10(1.0) ` func (q *Queries) GetLog10(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getLog10) + row := q.db.QueryRowContext(ctx, getLog10SQL) var log10 float64 err := row.Scan(&log10) return log10, err } -const getLog2 = `-- name: GetLog2 :one +const getLog2SQL = `-- name: GetLog2 :one SELECT log2(1.0) ` func (q *Queries) GetLog2(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getLog2) + row := q.db.QueryRowContext(ctx, getLog2SQL) var log2 float64 err := row.Scan(&log2) return log2, err } -const getLogBase = `-- name: GetLogBase :one +const getLogBaseSQL = `-- name: GetLogBase :one SELECT log(1.0, 2.0) ` func (q *Queries) GetLogBase(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getLogBase) + row := q.db.QueryRowContext(ctx, getLogBaseSQL) var log float64 err := row.Scan(&log) return log, err } -const getMod = `-- name: GetMod :one +const getModSQL = `-- name: GetMod :one SELECT mod(1, 2) ` func (q *Queries) GetMod(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getMod) + row := q.db.QueryRowContext(ctx, getModSQL) var mod float64 err := row.Scan(&mod) return mod, err } -const getPi = `-- name: GetPi :one +const getPiSQL = `-- name: GetPi :one SELECT pi() ` func (q *Queries) GetPi(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getPi) + row := q.db.QueryRowContext(ctx, getPiSQL) var pi float64 err := row.Scan(&pi) return pi, err } -const getPow = `-- name: GetPow :one +const getPowSQL = `-- name: GetPow :one SELECT pow(1, 2) ` func (q *Queries) GetPow(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getPow) + row := q.db.QueryRowContext(ctx, getPowSQL) var pow float64 err := row.Scan(&pow) return pow, err } -const getPower = `-- name: GetPower :one +const getPowerSQL = `-- name: GetPower :one SELECT power(1, 2) ` func (q *Queries) GetPower(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getPower) + row := q.db.QueryRowContext(ctx, getPowerSQL) var power float64 err := row.Scan(&power) return power, err } -const getRadians = `-- name: GetRadians :one +const getRadiansSQL = `-- name: GetRadians :one SELECT radians(1) ` func (q *Queries) GetRadians(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getRadians) + row := q.db.QueryRowContext(ctx, getRadiansSQL) var radians float64 err := row.Scan(&radians) return radians, err } -const getSin = `-- name: GetSin :one +const getSinSQL = `-- name: GetSin :one SELECT sin(1.0) ` func (q *Queries) GetSin(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getSin) + row := q.db.QueryRowContext(ctx, getSinSQL) var sin float64 err := row.Scan(&sin) return sin, err } -const getSinh = `-- name: GetSinh :one +const getSinhSQL = `-- name: GetSinh :one SELECT sinh(1.0) ` func (q *Queries) GetSinh(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getSinh) + row := q.db.QueryRowContext(ctx, getSinhSQL) var sinh float64 err := row.Scan(&sinh) return sinh, err } -const getSqrt = `-- name: GetSqrt :one +const getSqrtSQL = `-- name: GetSqrt :one SELECT sqrt(1.0) ` func (q *Queries) GetSqrt(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getSqrt) + row := q.db.QueryRowContext(ctx, getSqrtSQL) var sqrt float64 err := row.Scan(&sqrt) return sqrt, err } -const getTan = `-- name: GetTan :one +const getTanSQL = `-- name: GetTan :one SELECT tan(1.0) ` func (q *Queries) GetTan(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getTan) + row := q.db.QueryRowContext(ctx, getTanSQL) var tan float64 err := row.Scan(&tan) return tan, err } -const getTrunc = `-- name: GetTrunc :one +const getTruncSQL = `-- name: GetTrunc :one SELECT trunc(1.0) ` func (q *Queries) GetTrunc(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getTrunc) + row := q.db.QueryRowContext(ctx, getTruncSQL) var trunc float64 err := row.Scan(&trunc) return trunc, err diff --git a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go index 06ec0436ce..ebfd84d243 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go @@ -10,551 +10,551 @@ import ( "database/sql" ) -const getAbs = `-- name: GetAbs :one +const getAbsSQL = `-- name: GetAbs :one SELECT abs(int_val) FROM test ` func (q *Queries) GetAbs(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getAbs) + row := q.db.QueryRowContext(ctx, getAbsSQL) var abs float64 err := row.Scan(&abs) return abs, err } -const getChanges = `-- name: GetChanges :one +const getChangesSQL = `-- name: GetChanges :one SELECT changes() ` func (q *Queries) GetChanges(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getChanges) + row := q.db.QueryRowContext(ctx, getChangesSQL) var changes int64 err := row.Scan(&changes) return changes, err } -const getChar1 = `-- name: GetChar1 :one +const getChar1SQL = `-- name: GetChar1 :one SELECT char(65) ` func (q *Queries) GetChar1(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getChar1) + row := q.db.QueryRowContext(ctx, getChar1SQL) var char string err := row.Scan(&char) return char, err } -const getChar3 = `-- name: GetChar3 :one +const getChar3SQL = `-- name: GetChar3 :one SELECT char(65, 66, 67) ` func (q *Queries) GetChar3(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getChar3) + row := q.db.QueryRowContext(ctx, getChar3SQL) var char string err := row.Scan(&char) return char, err } -const getCoalesce = `-- name: GetCoalesce :one +const getCoalesceSQL = `-- name: GetCoalesce :one SELECT coalesce(NULL, 1, 'test') ` func (q *Queries) GetCoalesce(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getCoalesce) + row := q.db.QueryRowContext(ctx, getCoalesceSQL) var coalesce any err := row.Scan(&coalesce) return coalesce, err } -const getFormat = `-- name: GetFormat :one +const getFormatSQL = `-- name: GetFormat :one SELECT format('Hello %s', 'world') ` func (q *Queries) GetFormat(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getFormat) + row := q.db.QueryRowContext(ctx, getFormatSQL) var format string err := row.Scan(&format) return format, err } -const getGlob = `-- name: GetGlob :one +const getGlobSQL = `-- name: GetGlob :one SELECT glob('a*c', 'abc') ` func (q *Queries) GetGlob(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getGlob) + row := q.db.QueryRowContext(ctx, getGlobSQL) var glob int64 err := row.Scan(&glob) return glob, err } -const getHex = `-- name: GetHex :one +const getHexSQL = `-- name: GetHex :one SELECT hex(123456) ` func (q *Queries) GetHex(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getHex) + row := q.db.QueryRowContext(ctx, getHexSQL) var hex string err := row.Scan(&hex) return hex, err } -const getIfnull = `-- name: GetIfnull :one +const getIfnullSQL = `-- name: GetIfnull :one SELECT ifnull(1, 2) ` func (q *Queries) GetIfnull(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getIfnull) + row := q.db.QueryRowContext(ctx, getIfnullSQL) var ifnull any err := row.Scan(&ifnull) return ifnull, err } -const getIif = `-- name: GetIif :one +const getIifSQL = `-- name: GetIif :one SELECT iif(1, 2, 3) ` func (q *Queries) GetIif(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getIif) + row := q.db.QueryRowContext(ctx, getIifSQL) var iif any err := row.Scan(&iif) return iif, err } -const getInstr = `-- name: GetInstr :one +const getInstrSQL = `-- name: GetInstr :one SELECT instr('hello', 'l') ` func (q *Queries) GetInstr(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getInstr) + row := q.db.QueryRowContext(ctx, getInstrSQL) var instr int64 err := row.Scan(&instr) return instr, err } -const getLastInsertRowID = `-- name: GetLastInsertRowID :one +const getLastInsertRowIDSQL = `-- name: GetLastInsertRowID :one SELECT last_insert_rowid() ` func (q *Queries) GetLastInsertRowID(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getLastInsertRowID) + row := q.db.QueryRowContext(ctx, getLastInsertRowIDSQL) var last_insert_rowid int64 err := row.Scan(&last_insert_rowid) return last_insert_rowid, err } -const getLength = `-- name: GetLength :one +const getLengthSQL = `-- name: GetLength :one SELECT length('12345') ` func (q *Queries) GetLength(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getLength) + row := q.db.QueryRowContext(ctx, getLengthSQL) var length int64 err := row.Scan(&length) return length, err } -const getLike2 = `-- name: GetLike2 :one +const getLike2SQL = `-- name: GetLike2 :one SELECT like('%bc%', 'abcd') ` func (q *Queries) GetLike2(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getLike2) + row := q.db.QueryRowContext(ctx, getLike2SQL) var like int64 err := row.Scan(&like) return like, err } -const getLike3 = `-- name: GetLike3 :one +const getLike3SQL = `-- name: GetLike3 :one SELECT like('$%1%', '%100', '$') ` func (q *Queries) GetLike3(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getLike3) + row := q.db.QueryRowContext(ctx, getLike3SQL) var like int64 err := row.Scan(&like) return like, err } -const getLikelihood = `-- name: GetLikelihood :one +const getLikelihoodSQL = `-- name: GetLikelihood :one SELECT likelihood('12345', 0.5) ` func (q *Queries) GetLikelihood(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getLikelihood) + row := q.db.QueryRowContext(ctx, getLikelihoodSQL) var likelihood any err := row.Scan(&likelihood) return likelihood, err } -const getLikely = `-- name: GetLikely :one +const getLikelySQL = `-- name: GetLikely :one SELECT likely('12345') ` func (q *Queries) GetLikely(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getLikely) + row := q.db.QueryRowContext(ctx, getLikelySQL) var likely any err := row.Scan(&likely) return likely, err } -const getLower = `-- name: GetLower :one +const getLowerSQL = `-- name: GetLower :one SELECT lower('ABCDE') ` func (q *Queries) GetLower(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getLower) + row := q.db.QueryRowContext(ctx, getLowerSQL) var lower string err := row.Scan(&lower) return lower, err } -const getLtrim = `-- name: GetLtrim :one +const getLtrimSQL = `-- name: GetLtrim :one SELECT ltrim(' ABCDE') ` func (q *Queries) GetLtrim(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getLtrim) + row := q.db.QueryRowContext(ctx, getLtrimSQL) var ltrim string err := row.Scan(<rim) return ltrim, err } -const getLtrim2 = `-- name: GetLtrim2 :one +const getLtrim2SQL = `-- name: GetLtrim2 :one SELECT ltrim(':ABCDE', ':') ` func (q *Queries) GetLtrim2(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getLtrim2) + row := q.db.QueryRowContext(ctx, getLtrim2SQL) var ltrim string err := row.Scan(<rim) return ltrim, err } -const getMax3 = `-- name: GetMax3 :one +const getMax3SQL = `-- name: GetMax3 :one SELECT max(1, 3, 2) ` func (q *Queries) GetMax3(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMax3) + row := q.db.QueryRowContext(ctx, getMax3SQL) var max any err := row.Scan(&max) return max, err } -const getMin3 = `-- name: GetMin3 :one +const getMin3SQL = `-- name: GetMin3 :one SELECT min(1, 3, 2) ` func (q *Queries) GetMin3(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getMin3) + row := q.db.QueryRowContext(ctx, getMin3SQL) var min any err := row.Scan(&min) return min, err } -const getNullif = `-- name: GetNullif :one +const getNullifSQL = `-- name: GetNullif :one SELECT nullif(1, 2) ` func (q *Queries) GetNullif(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getNullif) + row := q.db.QueryRowContext(ctx, getNullifSQL) var nullif any err := row.Scan(&nullif) return nullif, err } -const getPrintf = `-- name: GetPrintf :one +const getPrintfSQL = `-- name: GetPrintf :one SELECT printf('Hello %s', 'world') ` func (q *Queries) GetPrintf(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getPrintf) + row := q.db.QueryRowContext(ctx, getPrintfSQL) var printf string err := row.Scan(&printf) return printf, err } -const getQuote = `-- name: GetQuote :one +const getQuoteSQL = `-- name: GetQuote :one SELECT quote(1) ` func (q *Queries) GetQuote(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getQuote) + row := q.db.QueryRowContext(ctx, getQuoteSQL) var quote string err := row.Scan("e) return quote, err } -const getRandom = `-- name: GetRandom :one +const getRandomSQL = `-- name: GetRandom :one SELECT random() ` func (q *Queries) GetRandom(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getRandom) + row := q.db.QueryRowContext(ctx, getRandomSQL) var random int64 err := row.Scan(&random) return random, err } -const getRandomBlob = `-- name: GetRandomBlob :one +const getRandomBlobSQL = `-- name: GetRandomBlob :one SELECT randomblob(16) ` func (q *Queries) GetRandomBlob(ctx context.Context) ([]byte, error) { - row := q.db.QueryRowContext(ctx, getRandomBlob) + row := q.db.QueryRowContext(ctx, getRandomBlobSQL) var randomblob []byte err := row.Scan(&randomblob) return randomblob, err } -const getReplace = `-- name: GetReplace :one +const getReplaceSQL = `-- name: GetReplace :one SELECT replace('abc', 'bc', 'df') ` func (q *Queries) GetReplace(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getReplace) + row := q.db.QueryRowContext(ctx, getReplaceSQL) var replace string err := row.Scan(&replace) return replace, err } -const getRound = `-- name: GetRound :one +const getRoundSQL = `-- name: GetRound :one SELECT round(1.1) ` func (q *Queries) GetRound(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getRound) + row := q.db.QueryRowContext(ctx, getRoundSQL) var round float64 err := row.Scan(&round) return round, err } -const getRound2 = `-- name: GetRound2 :one +const getRound2SQL = `-- name: GetRound2 :one SELECT round(1.1, 2) ` func (q *Queries) GetRound2(ctx context.Context) (float64, error) { - row := q.db.QueryRowContext(ctx, getRound2) + row := q.db.QueryRowContext(ctx, getRound2SQL) var round float64 err := row.Scan(&round) return round, err } -const getRtrim = `-- name: GetRtrim :one +const getRtrimSQL = `-- name: GetRtrim :one SELECT rtrim('ABCDE ') ` func (q *Queries) GetRtrim(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getRtrim) + row := q.db.QueryRowContext(ctx, getRtrimSQL) var rtrim string err := row.Scan(&rtrim) return rtrim, err } -const getRtrim2 = `-- name: GetRtrim2 :one +const getRtrim2SQL = `-- name: GetRtrim2 :one SELECT rtrim('ABCDE:', ':') ` func (q *Queries) GetRtrim2(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getRtrim2) + row := q.db.QueryRowContext(ctx, getRtrim2SQL) var rtrim string err := row.Scan(&rtrim) return rtrim, err } -const getSQLiteCompileOptionGet = `-- name: GetSQLiteCompileOptionGet :one +const getSQLiteCompileOptionGetSQL = `-- name: GetSQLiteCompileOptionGet :one SELECT sqlite_compileoption_get(1) ` func (q *Queries) GetSQLiteCompileOptionGet(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionGet) + row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionGetSQL) var sqlite_compileoption_get sql.NullString err := row.Scan(&sqlite_compileoption_get) return sqlite_compileoption_get, err } -const getSQLiteCompileOptionUsed = `-- name: GetSQLiteCompileOptionUsed :one +const getSQLiteCompileOptionUsedSQL = `-- name: GetSQLiteCompileOptionUsed :one SELECT sqlite_compileoption_used(1) ` func (q *Queries) GetSQLiteCompileOptionUsed(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionUsed) + row := q.db.QueryRowContext(ctx, getSQLiteCompileOptionUsedSQL) var sqlite_compileoption_used int64 err := row.Scan(&sqlite_compileoption_used) return sqlite_compileoption_used, err } -const getSQLiteSourceID = `-- name: GetSQLiteSourceID :one +const getSQLiteSourceIDSQL = `-- name: GetSQLiteSourceID :one SELECT sqlite_source_id() ` func (q *Queries) GetSQLiteSourceID(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSQLiteSourceID) + row := q.db.QueryRowContext(ctx, getSQLiteSourceIDSQL) var sqlite_source_id string err := row.Scan(&sqlite_source_id) return sqlite_source_id, err } -const getSQLiteVersion = `-- name: GetSQLiteVersion :one +const getSQLiteVersionSQL = `-- name: GetSQLiteVersion :one SELECT sqlite_version() ` func (q *Queries) GetSQLiteVersion(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSQLiteVersion) + row := q.db.QueryRowContext(ctx, getSQLiteVersionSQL) var sqlite_version string err := row.Scan(&sqlite_version) return sqlite_version, err } -const getSign = `-- name: GetSign :one +const getSignSQL = `-- name: GetSign :one SELECT sign(1) ` func (q *Queries) GetSign(ctx context.Context) (sql.NullInt64, error) { - row := q.db.QueryRowContext(ctx, getSign) + row := q.db.QueryRowContext(ctx, getSignSQL) var sign sql.NullInt64 err := row.Scan(&sign) return sign, err } -const getSoundex = `-- name: GetSoundex :one +const getSoundexSQL = `-- name: GetSoundex :one SELECT soundex('abc') ` func (q *Queries) GetSoundex(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getSoundex) + row := q.db.QueryRowContext(ctx, getSoundexSQL) var soundex any err := row.Scan(&soundex) return soundex, err } -const getSubstr2 = `-- name: GetSubstr2 :one +const getSubstr2SQL = `-- name: GetSubstr2 :one SELECT substr('abcdef', 2) ` func (q *Queries) GetSubstr2(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSubstr2) + row := q.db.QueryRowContext(ctx, getSubstr2SQL) var substr string err := row.Scan(&substr) return substr, err } -const getSubstr3 = `-- name: GetSubstr3 :one +const getSubstr3SQL = `-- name: GetSubstr3 :one SELECT substr('abcdef', 1, 2) ` func (q *Queries) GetSubstr3(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSubstr3) + row := q.db.QueryRowContext(ctx, getSubstr3SQL) var substr string err := row.Scan(&substr) return substr, err } -const getSubstring2 = `-- name: GetSubstring2 :one +const getSubstring2SQL = `-- name: GetSubstring2 :one SELECT substring('abcdef', 1) ` func (q *Queries) GetSubstring2(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSubstring2) + row := q.db.QueryRowContext(ctx, getSubstring2SQL) var substring string err := row.Scan(&substring) return substring, err } -const getSusbstring3 = `-- name: GetSusbstring3 :one +const getSusbstring3SQL = `-- name: GetSusbstring3 :one SELECT substring('abcdef', 1, 2) ` func (q *Queries) GetSusbstring3(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getSusbstring3) + row := q.db.QueryRowContext(ctx, getSusbstring3SQL) var substring string err := row.Scan(&substring) return substring, err } -const getTotalChanges = `-- name: GetTotalChanges :one +const getTotalChangesSQL = `-- name: GetTotalChanges :one SELECT total_changes() ` func (q *Queries) GetTotalChanges(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getTotalChanges) + row := q.db.QueryRowContext(ctx, getTotalChangesSQL) var total_changes int64 err := row.Scan(&total_changes) return total_changes, err } -const getTrim = `-- name: GetTrim :one +const getTrimSQL = `-- name: GetTrim :one SELECT trim(' ABCDE ') ` func (q *Queries) GetTrim(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getTrim) + row := q.db.QueryRowContext(ctx, getTrimSQL) var trim string err := row.Scan(&trim) return trim, err } -const getTrim2 = `-- name: GetTrim2 :one +const getTrim2SQL = `-- name: GetTrim2 :one SELECT trim(':ABCDE:', ':') ` func (q *Queries) GetTrim2(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getTrim2) + row := q.db.QueryRowContext(ctx, getTrim2SQL) var trim string err := row.Scan(&trim) return trim, err } -const getTypeof = `-- name: GetTypeof :one +const getTypeofSQL = `-- name: GetTypeof :one SELECT typeof('ABCDE') ` func (q *Queries) GetTypeof(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getTypeof) + row := q.db.QueryRowContext(ctx, getTypeofSQL) var typeof string err := row.Scan(&typeof) return typeof, err } -const getUnicode = `-- name: GetUnicode :one +const getUnicodeSQL = `-- name: GetUnicode :one SELECT unicode('A') ` func (q *Queries) GetUnicode(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, getUnicode) + row := q.db.QueryRowContext(ctx, getUnicodeSQL) var unicode int64 err := row.Scan(&unicode) return unicode, err } -const getUnlikely = `-- name: GetUnlikely :one +const getUnlikelySQL = `-- name: GetUnlikely :one SELECT unlikely('12345') ` func (q *Queries) GetUnlikely(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, getUnlikely) + row := q.db.QueryRowContext(ctx, getUnlikelySQL) var unlikely any err := row.Scan(&unlikely) return unlikely, err } -const getUpper = `-- name: GetUpper :one +const getUpperSQL = `-- name: GetUpper :one SELECT upper('abcde') ` func (q *Queries) GetUpper(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, getUpper) + row := q.db.QueryRowContext(ctx, getUpperSQL) var upper string err := row.Scan(&upper) return upper, err } -const getZeroblob = `-- name: GetZeroblob :one +const getZeroblobSQL = `-- name: GetZeroblob :one SELECT zeroblob(16) ` func (q *Queries) GetZeroblob(ctx context.Context) ([]byte, error) { - row := q.db.QueryRowContext(ctx, getZeroblob) + row := q.db.QueryRowContext(ctx, getZeroblobSQL) var zeroblob []byte err := row.Scan(&zeroblob) return zeroblob, err diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go index 638b3aca66..0c5a6d1f5b 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listAuthors = `-- name: ListAuthors :one +const listAuthorsSQL = `-- name: ListAuthors :one SELECT id, username, email, name, bio FROM authors WHERE email = CASE WHEN ? = '' then NULL else ? END @@ -24,7 +24,7 @@ type ListAuthorsParams struct { } func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { - row := q.db.QueryRowContext(ctx, listAuthors, + row := q.db.QueryRowContext(ctx, listAuthorsSQL, arg.Email, arg.Email, arg.Username, diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go index 62c41cac6e..e982446b1b 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :one +const listAuthorsSQL = `-- name: ListAuthors :one SELECT id, username, email, name, bio FROM authors WHERE email = CASE WHEN $1::text = '' then NULL else $1::text END @@ -23,7 +23,7 @@ type ListAuthorsParams struct { } func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { - row := q.db.QueryRowContext(ctx, listAuthors, arg.Email, arg.Username) + row := q.db.QueryRowContext(ctx, listAuthorsSQL, arg.Email, arg.Username) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go index 318977f6a0..11468ebb23 100644 --- a/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :one +const listAuthorsSQL = `-- name: ListAuthors :one SELECT id, username, email, name, bio FROM authors WHERE email = CASE WHEN ?1 = '' then NULL else ?1 END @@ -23,7 +23,7 @@ type ListAuthorsParams struct { } func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { - row := q.db.QueryRowContext(ctx, listAuthors, arg.Email, arg.Username) + row := q.db.QueryRowContext(ctx, listAuthorsSQL, arg.Email, arg.Username) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go index a1c5a532e4..fd022a2559 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertContact = `-- name: InsertContact :exec +const insertContactSQL = `-- name: InsertContact :exec INSERT INTO contacts ( pid, customername @@ -24,6 +24,6 @@ type InsertContactParams struct { } func (q *Queries) InsertContact(ctx context.Context, arg InsertContactParams) error { - _, err := q.db.ExecContext(ctx, insertContact, arg.Pid, arg.Customername) + _, err := q.db.ExecContext(ctx, insertContactSQL, arg.Pid, arg.Customername) return err } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go index 247c97ed60..7a63b47932 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementBoolean = `-- name: CaseStatementBoolean :many +const caseStatementBooleanSQL = `-- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true ELSE false @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { - rows, err := q.db.Query(ctx, caseStatementBoolean, id) + rows, err := q.db.Query(ctx, caseStatementBooleanSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go index 247c97ed60..7a63b47932 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementBoolean = `-- name: CaseStatementBoolean :many +const caseStatementBooleanSQL = `-- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true ELSE false @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { - rows, err := q.db.Query(ctx, caseStatementBoolean, id) + rows, err := q.db.Query(ctx, caseStatementBooleanSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go index 27996143b8..779c27b5f9 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementBoolean = `-- name: CaseStatementBoolean :many +const caseStatementBooleanSQL = `-- name: CaseStatementBoolean :many SELECT CASE WHEN id = $1 THEN true ELSE false @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementBoolean(ctx context.Context, id string) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, caseStatementBoolean, id) + rows, err := q.db.QueryContext(ctx, caseStatementBooleanSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go index 20483dbf8d..c79b02d1f9 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementText = `-- name: CaseStatementText :many +const caseStatementTextSQL = `-- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' ELSE 'bar' @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { - rows, err := q.db.Query(ctx, caseStatementText, id) + rows, err := q.db.Query(ctx, caseStatementTextSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go index 20483dbf8d..c79b02d1f9 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementText = `-- name: CaseStatementText :many +const caseStatementTextSQL = `-- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' ELSE 'bar' @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { - rows, err := q.db.Query(ctx, caseStatementText, id) + rows, err := q.db.Query(ctx, caseStatementTextSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go index a00177369c..c59bac9b9e 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const caseStatementText = `-- name: CaseStatementText :many +const caseStatementTextSQL = `-- name: CaseStatementText :many SELECT CASE WHEN id = $1 THEN 'foo' ELSE 'bar' @@ -18,7 +18,7 @@ FROM foo ` func (q *Queries) CaseStatementText(ctx context.Context, id string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, caseStatementText, id) + rows, err := q.db.QueryContext(ctx, caseStatementTextSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go index b98b3cec48..f4cf62287d 100644 --- a/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const update = `-- name: Update :exec +const updateSQL = `-- name: Update :exec UPDATE testing SET value = CASE ? WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END ` func (q *Queries) Update(ctx context.Context, value sql.NullString) error { - _, err := q.db.ExecContext(ctx, update, value) + _, err := q.db.ExecContext(ctx, updateSQL, value) return err } diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go index 5050fb8a73..ee59e1b460 100644 --- a/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const update = `-- name: Update :exec +const updateSQL = `-- name: Update :exec UPDATE testing SET value = CASE $1 WHEN true THEN 'Hello' WHEN false THEN 'Goodbye' ELSE value END ` func (q *Queries) Update(ctx context.Context, value pgtype.Text) error { - _, err := q.db.Exec(ctx, update, value) + _, err := q.db.Exec(ctx, updateSQL, value) return err } diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go index bda512f196..d2226cb001 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const castCoalesce = `-- name: CastCoalesce :many +const castCoalesceSQL = `-- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo ` func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, castCoalesce) + rows, err := q.db.Query(ctx, castCoalesceSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go index bda512f196..d2226cb001 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const castCoalesce = `-- name: CastCoalesce :many +const castCoalesceSQL = `-- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo ` func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, castCoalesce) + rows, err := q.db.Query(ctx, castCoalesceSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go index 64c60f9dd9..680cb2fe0a 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const castCoalesce = `-- name: CastCoalesce :many +const castCoalesceSQL = `-- name: CastCoalesce :many SELECT coalesce(bar, '')::text as login FROM foo ` func (q *Queries) CastCoalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, castCoalesce) + rows, err := q.db.QueryContext(ctx, castCoalesceSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go index f92cad1f91..e9c4b68d64 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listNullable = `-- name: ListNullable :many +const listNullableSQL = `-- name: ListNullable :many SELECT NULL::text as a, NULL::integer as b, @@ -27,7 +27,7 @@ type ListNullableRow struct { } func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { - rows, err := q.db.Query(ctx, listNullable) + rows, err := q.db.Query(ctx, listNullableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go index 3951ae97f5..8d613142db 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const listNullable = `-- name: ListNullable :many +const listNullableSQL = `-- name: ListNullable :many SELECT NULL::text as a, NULL::integer as b, @@ -28,7 +28,7 @@ type ListNullableRow struct { } func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { - rows, err := q.db.Query(ctx, listNullable) + rows, err := q.db.Query(ctx, listNullableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go index 773e68c6ea..f8b2d556e6 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listNullable = `-- name: ListNullable :many +const listNullableSQL = `-- name: ListNullable :many SELECT NULL::text as a, NULL::integer as b, @@ -27,7 +27,7 @@ type ListNullableRow struct { } func (q *Queries) ListNullable(ctx context.Context) ([]ListNullableRow, error) { - rows, err := q.db.QueryContext(ctx, listNullable) + rows, err := q.db.QueryContext(ctx, listNullableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go index 9d4bcffbab..8b8c9d4f92 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const getData = `-- name: GetData :many +const getDataSQL = `-- name: GetData :many select invalid, foo from my_table where (cast(?1 as boolean) or not invalid) ` func (q *Queries) GetData(ctx context.Context, allowInvalid bool) ([]MyTable, error) { - rows, err := q.db.QueryContext(ctx, getData, allowInvalid) + rows, err := q.db.QueryContext(ctx, getDataSQL, allowInvalid) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go index c15f2a17ed..0fac421377 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_cid, v_oid, v_tid, v_xid from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go index 3e3f4c0a53..9aa77995df 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_xid8_null, v_cid, v_oid, v_tid, v_xid, v_xid8 from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/citext/pgx/go/query.sql.go b/internal/endtoend/testdata/citext/pgx/go/query.sql.go index f96e754e48..3ddc2aaafd 100644 --- a/internal/endtoend/testdata/citext/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/citext/pgx/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getCitexts = `-- name: GetCitexts :many +const getCitextsSQL = `-- name: GetCitexts :many SELECT bar, bat FROM foo ` func (q *Queries) GetCitexts(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, getCitexts) + rows, err := q.db.Query(ctx, getCitextsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go index cf680394af..2b24b4f8e1 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getCitexts = `-- name: GetCitexts :many +const getCitextsSQL = `-- name: GetCitexts :many SELECT bar, bat FROM foo ` func (q *Queries) GetCitexts(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, getCitexts) + rows, err := q.db.QueryContext(ctx, getCitextsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go index 4159107a50..0195b61b76 100644 --- a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertEvent = `-- name: InsertEvent :exec +const insertEventSQL = `-- name: InsertEvent :exec INSERT INTO events (id, name, tag, amount, uid, ip, big) VALUES ({id:UInt64}, {name:String}, {tag:Nullable(String)}, {amount:Decimal(10, 2)}, {uid:UUID}, {ip:IPv4}, {big:Int128}); ` @@ -26,7 +26,7 @@ type InsertEventParams struct { } func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) error { - _, err := q.db.ExecContext(ctx, insertEvent, + _, err := q.db.ExecContext(ctx, insertEventSQL, sql.Named("id", arg.ID), sql.Named("name", arg.Name), sql.Named("tag", arg.Tag), @@ -38,7 +38,7 @@ func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) error return err } -const positionalEvent = `-- name: PositionalEvent :exec +const positionalEventSQL = `-- name: PositionalEvent :exec INSERT INTO events (id, name, tag, amount, uid, ip, big) VALUES (?, ?, ?, ?, ?, ?, ?); ` @@ -54,7 +54,7 @@ type PositionalEventParams struct { } func (q *Queries) PositionalEvent(ctx context.Context, arg PositionalEventParams) error { - _, err := q.db.ExecContext(ctx, positionalEvent, + _, err := q.db.ExecContext(ctx, positionalEventSQL, arg.ID, arg.Name, arg.Tag, @@ -66,7 +66,7 @@ func (q *Queries) PositionalEvent(ctx context.Context, arg PositionalEventParams return err } -const repeatedName = `-- name: RepeatedName :many +const repeatedNameSQL = `-- name: RepeatedName :many SELECT id FROM events WHERE name = {name:String} OR tag = {name:String} OR id = {id:UInt64}; ` @@ -77,7 +77,7 @@ type RepeatedNameParams struct { } func (q *Queries) RepeatedName(ctx context.Context, arg RepeatedNameParams) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, repeatedName, sql.Named("name", arg.Name), sql.Named("id", arg.ID)) + rows, err := q.db.QueryContext(ctx, repeatedNameSQL, sql.Named("name", arg.Name), sql.Named("id", arg.ID)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go index c98120bf50..b502f3aca8 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const coalesce = `-- name: Coalesce :many +const coalesceSQL = `-- name: Coalesce :many SELECT coalesce(bar, '') as login FROM foo ` func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coalesce) + rows, err := q.db.QueryContext(ctx, coalesceSQL) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { return items, nil } -const coalesceColumns = `-- name: CoalesceColumns :many +const coalesceColumnsSQL = `-- name: CoalesceColumns :many SELECT bar, bat, coalesce(bar, bat) FROM foo ` @@ -50,7 +50,7 @@ type CoalesceColumnsRow struct { } func (q *Queries) CoalesceColumns(ctx context.Context) ([]CoalesceColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceColumns) + rows, err := q.db.QueryContext(ctx, coalesceColumnsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go index 061579c42d..352ccefa67 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const coalesceNumeric = `-- name: CoalesceNumeric :many +const coalesceNumericSQL = `-- name: CoalesceNumeric :many SELECT coalesce(baz, 0) as login FROM foo ` func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, coalesceNumeric) + rows, err := q.db.Query(ctx, coalesceNumericSQL) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { return items, nil } -const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +const coalesceNumericColumnsSQL = `-- name: CoalesceNumericColumns :many SELECT baz, qux, coalesce(baz, qux) FROM foo ` @@ -47,7 +47,7 @@ type CoalesceNumericColumnsRow struct { } func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { - rows, err := q.db.Query(ctx, coalesceNumericColumns) + rows, err := q.db.Query(ctx, coalesceNumericColumnsSQL) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumeric return items, nil } -const coalesceNumericNull = `-- name: CoalesceNumericNull :many +const coalesceNumericNullSQL = `-- name: CoalesceNumericNull :many SELECT baz, coalesce(baz) FROM foo ` @@ -77,7 +77,7 @@ type CoalesceNumericNullRow struct { } func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { - rows, err := q.db.Query(ctx, coalesceNumericNull) + rows, err := q.db.Query(ctx, coalesceNumericNullSQL) if err != nil { return nil, err } @@ -96,13 +96,13 @@ func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNul return items, nil } -const coalesceString = `-- name: CoalesceString :many +const coalesceStringSQL = `-- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo ` func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, coalesceString) + rows, err := q.db.Query(ctx, coalesceStringSQL) if err != nil { return nil, err } @@ -121,7 +121,7 @@ func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { return items, nil } -const coalesceStringColumns = `-- name: CoalesceStringColumns :many +const coalesceStringColumnsSQL = `-- name: CoalesceStringColumns :many SELECT bar, bat, coalesce(bar, bat) FROM foo ` @@ -133,7 +133,7 @@ type CoalesceStringColumnsRow struct { } func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { - rows, err := q.db.Query(ctx, coalesceStringColumns) + rows, err := q.db.Query(ctx, coalesceStringColumnsSQL) if err != nil { return nil, err } @@ -152,7 +152,7 @@ func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringCo return items, nil } -const coalesceStringNull = `-- name: CoalesceStringNull :many +const coalesceStringNullSQL = `-- name: CoalesceStringNull :many SELECT bar, coalesce(bar) FROM foo ` @@ -163,7 +163,7 @@ type CoalesceStringNullRow struct { } func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { - rows, err := q.db.Query(ctx, coalesceStringNull) + rows, err := q.db.Query(ctx, coalesceStringNullSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go index f674fa05be..2e1ed3f645 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go @@ -11,13 +11,13 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const coalesceNumeric = `-- name: CoalesceNumeric :many +const coalesceNumericSQL = `-- name: CoalesceNumeric :many SELECT coalesce(baz, 0) as login FROM foo ` func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, coalesceNumeric) + rows, err := q.db.Query(ctx, coalesceNumericSQL) if err != nil { return nil, err } @@ -36,7 +36,7 @@ func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { return items, nil } -const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +const coalesceNumericColumnsSQL = `-- name: CoalesceNumericColumns :many SELECT baz, qux, coalesce(baz, qux) FROM foo ` @@ -48,7 +48,7 @@ type CoalesceNumericColumnsRow struct { } func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { - rows, err := q.db.Query(ctx, coalesceNumericColumns) + rows, err := q.db.Query(ctx, coalesceNumericColumnsSQL) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumeric return items, nil } -const coalesceNumericNull = `-- name: CoalesceNumericNull :many +const coalesceNumericNullSQL = `-- name: CoalesceNumericNull :many SELECT baz, coalesce(baz) FROM foo ` @@ -78,7 +78,7 @@ type CoalesceNumericNullRow struct { } func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { - rows, err := q.db.Query(ctx, coalesceNumericNull) + rows, err := q.db.Query(ctx, coalesceNumericNullSQL) if err != nil { return nil, err } @@ -97,13 +97,13 @@ func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNul return items, nil } -const coalesceString = `-- name: CoalesceString :many +const coalesceStringSQL = `-- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo ` func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, coalesceString) + rows, err := q.db.Query(ctx, coalesceStringSQL) if err != nil { return nil, err } @@ -122,7 +122,7 @@ func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { return items, nil } -const coalesceStringColumns = `-- name: CoalesceStringColumns :many +const coalesceStringColumnsSQL = `-- name: CoalesceStringColumns :many SELECT bar, bat, coalesce(bar, bat) FROM foo ` @@ -134,7 +134,7 @@ type CoalesceStringColumnsRow struct { } func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { - rows, err := q.db.Query(ctx, coalesceStringColumns) + rows, err := q.db.Query(ctx, coalesceStringColumnsSQL) if err != nil { return nil, err } @@ -153,7 +153,7 @@ func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringCo return items, nil } -const coalesceStringNull = `-- name: CoalesceStringNull :many +const coalesceStringNullSQL = `-- name: CoalesceStringNull :many SELECT bar, coalesce(bar) FROM foo ` @@ -164,7 +164,7 @@ type CoalesceStringNullRow struct { } func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { - rows, err := q.db.Query(ctx, coalesceStringNull) + rows, err := q.db.Query(ctx, coalesceStringNullSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go index 2c37a8b80d..c30b7953f5 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const coalesceNumeric = `-- name: CoalesceNumeric :many +const coalesceNumericSQL = `-- name: CoalesceNumeric :many SELECT coalesce(baz, 0) as login FROM foo ` func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, coalesceNumeric) + rows, err := q.db.QueryContext(ctx, coalesceNumericSQL) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) CoalesceNumeric(ctx context.Context) ([]int64, error) { return items, nil } -const coalesceNumericColumns = `-- name: CoalesceNumericColumns :many +const coalesceNumericColumnsSQL = `-- name: CoalesceNumericColumns :many SELECT baz, qux, coalesce(baz, qux) FROM foo ` @@ -50,7 +50,7 @@ type CoalesceNumericColumnsRow struct { } func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumericColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceNumericColumns) + rows, err := q.db.QueryContext(ctx, coalesceNumericColumnsSQL) if err != nil { return nil, err } @@ -72,7 +72,7 @@ func (q *Queries) CoalesceNumericColumns(ctx context.Context) ([]CoalesceNumeric return items, nil } -const coalesceNumericNull = `-- name: CoalesceNumericNull :many +const coalesceNumericNullSQL = `-- name: CoalesceNumericNull :many SELECT baz, coalesce(baz) FROM foo ` @@ -83,7 +83,7 @@ type CoalesceNumericNullRow struct { } func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNullRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceNumericNull) + rows, err := q.db.QueryContext(ctx, coalesceNumericNullSQL) if err != nil { return nil, err } @@ -105,13 +105,13 @@ func (q *Queries) CoalesceNumericNull(ctx context.Context) ([]CoalesceNumericNul return items, nil } -const coalesceString = `-- name: CoalesceString :many +const coalesceStringSQL = `-- name: CoalesceString :many SELECT coalesce(bar, '') as login FROM foo ` func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coalesceString) + rows, err := q.db.QueryContext(ctx, coalesceStringSQL) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func (q *Queries) CoalesceString(ctx context.Context) ([]string, error) { return items, nil } -const coalesceStringColumns = `-- name: CoalesceStringColumns :many +const coalesceStringColumnsSQL = `-- name: CoalesceStringColumns :many SELECT bar, bat, coalesce(bar, bat) FROM foo ` @@ -145,7 +145,7 @@ type CoalesceStringColumnsRow struct { } func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceStringColumns) + rows, err := q.db.QueryContext(ctx, coalesceStringColumnsSQL) if err != nil { return nil, err } @@ -167,7 +167,7 @@ func (q *Queries) CoalesceStringColumns(ctx context.Context) ([]CoalesceStringCo return items, nil } -const coalesceStringNull = `-- name: CoalesceStringNull :many +const coalesceStringNullSQL = `-- name: CoalesceStringNull :many SELECT bar, coalesce(bar) FROM foo ` @@ -178,7 +178,7 @@ type CoalesceStringNullRow struct { } func (q *Queries) CoalesceStringNull(ctx context.Context) ([]CoalesceStringNullRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceStringNull) + rows, err := q.db.QueryContext(ctx, coalesceStringNullSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go index 4324a035ac..cea0d5e14e 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const coalesce = `-- name: Coalesce :many +const coalesceSQL = `-- name: Coalesce :many SELECT coalesce(bar, '') AS login FROM foo ` func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coalesce) + rows, err := q.db.QueryContext(ctx, coalesceSQL) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) Coalesce(ctx context.Context) ([]string, error) { return items, nil } -const coalesceColumns = `-- name: CoalesceColumns :many +const coalesceColumnsSQL = `-- name: CoalesceColumns :many SELECT bar, bat, coalesce(bar, bat) FROM foo ` @@ -50,7 +50,7 @@ type CoalesceColumnsRow struct { } func (q *Queries) CoalesceColumns(ctx context.Context) ([]CoalesceColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, coalesceColumns) + rows, err := q.db.QueryContext(ctx, coalesceColumnsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go index 8ce06bb097..81c87f3477 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo GROUP BY 1 @@ -22,7 +22,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.QueryContext(ctx, sumBaz) + rows, err := q.db.QueryContext(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go index cd1ead7193..f9aa7c7167 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo GROUP BY 1 @@ -23,7 +23,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.Query(ctx, sumBaz) + rows, err := q.db.Query(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go index 0471727c9c..ea06f087c0 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo GROUP BY 1 @@ -22,7 +22,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.Query(ctx, sumBaz) + rows, err := q.db.Query(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go index cb54b62679..9fc780c65a 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo GROUP BY 1 @@ -23,7 +23,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.Query(ctx, sumBaz) + rows, err := q.db.Query(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go index 8ce06bb097..81c87f3477 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) as quantity FROM foo GROUP BY 1 @@ -22,7 +22,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.QueryContext(ctx, sumBaz) + rows, err := q.db.QueryContext(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go index 556c5b5955..2b6e38820a 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const sumBaz = `-- name: SumBaz :many +const sumBazSQL = `-- name: SumBaz :many SELECT bar, coalesce(sum(baz), 0) AS quantity FROM foo GROUP BY 1 @@ -22,7 +22,7 @@ type SumBazRow struct { } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { - rows, err := q.db.QueryContext(ctx, sumBaz) + rows, err := q.db.QueryContext(ctx, sumBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go index 15250f9c59..2b4e4dd8ce 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBar = `-- name: GetBar :many +const getBarSQL = `-- name: GetBar :many SELECT foo.id, COALESCE(bar.id, 0) AS bar_id FROM foo LEFT JOIN bar ON foo.id = bar.id @@ -21,7 +21,7 @@ type GetBarRow struct { } func (q *Queries) GetBar(ctx context.Context) ([]GetBarRow, error) { - rows, err := q.db.QueryContext(ctx, getBar) + rows, err := q.db.QueryContext(ctx, getBarSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go index 689806e7ee..2230011e21 100644 --- a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const addAuthor = `-- name: AddAuthor :execlastid +const addAuthorSQL = `-- name: AddAuthor :execlastid INSERT INTO authors ( address, name, @@ -28,14 +28,14 @@ type AddAuthorParams struct { } func (q *Queries) AddAuthor(ctx context.Context, arg AddAuthorParams) (int64, error) { - result, err := q.db.ExecContext(ctx, addAuthor, arg.Address, arg.CalName, arg.CalDescription) + result, err := q.db.ExecContext(ctx, addAuthorSQL, arg.Address, arg.CalName, arg.CalDescription) if err != nil { return 0, err } return result.LastInsertId() } -const addEvent = `-- name: AddEvent :execlastid +const addEventSQL = `-- name: AddEvent :execlastid INSERT INTO ` + "`" + `Event` + "`" + ` ( Timezone ) VALUES ( @@ -49,7 +49,7 @@ type AddEventParams struct { } func (q *Queries) AddEvent(ctx context.Context, arg AddEventParams) (int64, error) { - result, err := q.db.ExecContext(ctx, addEvent, arg.Timezone, arg.CalendarIdKey, arg.Timezone) + result, err := q.db.ExecContext(ctx, addEventSQL, arg.Timezone, arg.CalendarIdKey, arg.Timezone) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go index 5675e7c029..2875cb613f 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: test :one +const testSQL = `-- name: test :one SELECT id, "!!!nobody,_,-would-believe---this-...?!", "parent id" from bar limit 1 ` func (q *Queries) test(ctx context.Context) (Bar, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var i Bar err := row.Scan(&i.ID, &i.NobodyWouldBelieveThis, &i.ParentID) return i, err diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go index a4b43d3052..7ef5c9f832 100644 --- a/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const getUsers = `-- name: GetUsers :many +const getUsersSQL = `-- name: GetUsers :many SELECT users.id, users.fname, @@ -47,7 +47,7 @@ type GetUsersRow struct { } func (q *Queries) GetUsers(ctx context.Context, searchTerm string) ([]GetUsersRow, error) { - rows, err := q.db.QueryContext(ctx, getUsers, searchTerm) + rows, err := q.db.QueryContext(ctx, getUsersSQL, searchTerm) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go index a4636a1c0c..66b98e41d9 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const withAs = `-- name: WithAs :one +const withAsSQL = `-- name: WithAs :one SELECT 1 AS x, 2 AS y ` @@ -19,13 +19,13 @@ type WithAsRow struct { } func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { - row := q.db.QueryRowContext(ctx, withAs) + row := q.db.QueryRowContext(ctx, withAsSQL) var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } -const withoutAs = `-- name: WithoutAs :one +const withoutAsSQL = `-- name: WithoutAs :one SELECT 1 x, 2 y ` @@ -35,7 +35,7 @@ type WithoutAsRow struct { } func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { - row := q.db.QueryRowContext(ctx, withoutAs) + row := q.db.QueryRowContext(ctx, withoutAsSQL) var i WithoutAsRow err := row.Scan(&i.X, &i.Y) return i, err diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go index ddaee5d60b..bdb3f5c8b0 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const withAs = `-- name: WithAs :one +const withAsSQL = `-- name: WithAs :one SELECT 1 AS x, 2 AS y ` @@ -19,13 +19,13 @@ type WithAsRow struct { } func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { - row := q.db.QueryRow(ctx, withAs) + row := q.db.QueryRow(ctx, withAsSQL) var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } -const withoutAs = `-- name: WithoutAs :one +const withoutAsSQL = `-- name: WithoutAs :one SELECT 1 x, 2 y ` @@ -35,7 +35,7 @@ type WithoutAsRow struct { } func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { - row := q.db.QueryRow(ctx, withoutAs) + row := q.db.QueryRow(ctx, withoutAsSQL) var i WithoutAsRow err := row.Scan(&i.X, &i.Y) return i, err diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go index ddaee5d60b..bdb3f5c8b0 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const withAs = `-- name: WithAs :one +const withAsSQL = `-- name: WithAs :one SELECT 1 AS x, 2 AS y ` @@ -19,13 +19,13 @@ type WithAsRow struct { } func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { - row := q.db.QueryRow(ctx, withAs) + row := q.db.QueryRow(ctx, withAsSQL) var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } -const withoutAs = `-- name: WithoutAs :one +const withoutAsSQL = `-- name: WithoutAs :one SELECT 1 x, 2 y ` @@ -35,7 +35,7 @@ type WithoutAsRow struct { } func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { - row := q.db.QueryRow(ctx, withoutAs) + row := q.db.QueryRow(ctx, withoutAsSQL) var i WithoutAsRow err := row.Scan(&i.X, &i.Y) return i, err diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go index a4636a1c0c..66b98e41d9 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const withAs = `-- name: WithAs :one +const withAsSQL = `-- name: WithAs :one SELECT 1 AS x, 2 AS y ` @@ -19,13 +19,13 @@ type WithAsRow struct { } func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { - row := q.db.QueryRowContext(ctx, withAs) + row := q.db.QueryRowContext(ctx, withAsSQL) var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } -const withoutAs = `-- name: WithoutAs :one +const withoutAsSQL = `-- name: WithoutAs :one SELECT 1 x, 2 y ` @@ -35,7 +35,7 @@ type WithoutAsRow struct { } func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { - row := q.db.QueryRowContext(ctx, withoutAs) + row := q.db.QueryRowContext(ctx, withoutAsSQL) var i WithoutAsRow err := row.Scan(&i.X, &i.Y) return i, err diff --git a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go index 66d96ac3d9..7a8c1d9a31 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const withAs = `-- name: WithAs :one +const withAsSQL = `-- name: WithAs :one SELECT 1 AS x, 2 AS y ` @@ -19,13 +19,13 @@ type WithAsRow struct { } func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { - row := q.db.QueryRowContext(ctx, withAs) + row := q.db.QueryRowContext(ctx, withAsSQL) var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } -const withoutAs = `-- name: WithoutAs :one +const withoutAsSQL = `-- name: WithoutAs :one SELECT 1 AS x, 2 AS y ` @@ -35,7 +35,7 @@ type WithoutAsRow struct { } func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { - row := q.db.QueryRowContext(ctx, withoutAs) + row := q.db.QueryRowContext(ctx, withoutAsSQL) var i WithoutAsRow err := row.Scan(&i.X, &i.Y) return i, err diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go index 8d1169a59a..14fe72ac8f 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go @@ -12,45 +12,45 @@ import ( "github.com/jackc/pgconn" ) -const execFoo = `-- name: ExecFoo :exec +const execFooSQL = `-- name: ExecFoo :exec INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec func (q *Queries) ExecFoo(ctx context.Context) error { - _, err := q.db.Exec(ctx, execFoo) + _, err := q.db.Exec(ctx, execFooSQL) return err } -const execResultFoo = `-- name: ExecResultFoo :execresult +const execResultFooSQL = `-- name: ExecResultFoo :execresult INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, execResultFoo) + return q.db.Exec(ctx, execResultFooSQL) } -const execRowFoo = `-- name: ExecRowFoo :execrows +const execRowFooSQL = `-- name: ExecRowFoo :execrows INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows func (q *Queries) ExecRowFoo(ctx context.Context) (int64, error) { - result, err := q.db.Exec(ctx, execRowFoo) + result, err := q.db.Exec(ctx, execRowFooSQL) if err != nil { return 0, err } return result.RowsAffected(), nil } -const manyFoo = `-- name: ManyFoo :many +const manyFooSQL = `-- name: ManyFoo :many SELECT bar FROM foo ` // This function returns a list of Foos func (q *Queries) ManyFoo(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, manyFoo) + rows, err := q.db.Query(ctx, manyFooSQL) if err != nil { return nil, err } @@ -69,13 +69,13 @@ func (q *Queries) ManyFoo(ctx context.Context) ([]sql.NullString, error) { return items, nil } -const oneFoo = `-- name: OneFoo :one +const oneFooSQL = `-- name: OneFoo :one SELECT bar FROM foo ` // This function returns one Foo func (q *Queries) OneFoo(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRow(ctx, oneFoo) + row := q.db.QueryRow(ctx, oneFooSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go index 22975b4f51..782a2af959 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go @@ -12,45 +12,45 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const execFoo = `-- name: ExecFoo :exec +const execFooSQL = `-- name: ExecFoo :exec INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec func (q *Queries) ExecFoo(ctx context.Context) error { - _, err := q.db.Exec(ctx, execFoo) + _, err := q.db.Exec(ctx, execFooSQL) return err } -const execResultFoo = `-- name: ExecResultFoo :execresult +const execResultFooSQL = `-- name: ExecResultFoo :execresult INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult func (q *Queries) ExecResultFoo(ctx context.Context) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, execResultFoo) + return q.db.Exec(ctx, execResultFooSQL) } -const execRowFoo = `-- name: ExecRowFoo :execrows +const execRowFooSQL = `-- name: ExecRowFoo :execrows INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows func (q *Queries) ExecRowFoo(ctx context.Context) (int64, error) { - result, err := q.db.Exec(ctx, execRowFoo) + result, err := q.db.Exec(ctx, execRowFooSQL) if err != nil { return 0, err } return result.RowsAffected(), nil } -const manyFoo = `-- name: ManyFoo :many +const manyFooSQL = `-- name: ManyFoo :many SELECT bar FROM foo ` // This function returns a list of Foos func (q *Queries) ManyFoo(ctx context.Context) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, manyFoo) + rows, err := q.db.Query(ctx, manyFooSQL) if err != nil { return nil, err } @@ -69,13 +69,13 @@ func (q *Queries) ManyFoo(ctx context.Context) ([]pgtype.Text, error) { return items, nil } -const oneFoo = `-- name: OneFoo :one +const oneFooSQL = `-- name: OneFoo :one SELECT bar FROM foo ` // This function returns one Foo func (q *Queries) OneFoo(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, oneFoo) + row := q.db.QueryRow(ctx, oneFooSQL) var bar pgtype.Text err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go index 7512f5a29a..29a690a5f3 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -12,45 +12,45 @@ import ( "github.com/jackc/pgconn" ) -const execFoo = `-- name: ExecFoo :exec +const execFooSQL = `-- name: ExecFoo :exec INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { - _, err := db.Exec(ctx, execFoo) + _, err := db.Exec(ctx, execFooSQL) return err } -const execResultFoo = `-- name: ExecResultFoo :execresult +const execResultFooSQL = `-- name: ExecResultFoo :execresult INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag, error) { - return db.Exec(ctx, execResultFoo) + return db.Exec(ctx, execResultFooSQL) } -const execRowFoo = `-- name: ExecRowFoo :execrows +const execRowFooSQL = `-- name: ExecRowFoo :execrows INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows func (q *Queries) ExecRowFoo(ctx context.Context, db DBTX) (int64, error) { - result, err := db.Exec(ctx, execRowFoo) + result, err := db.Exec(ctx, execRowFooSQL) if err != nil { return 0, err } return result.RowsAffected(), nil } -const manyFoo = `-- name: ManyFoo :many +const manyFooSQL = `-- name: ManyFoo :many SELECT bar FROM foo ` // This function returns a list of Foos func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]sql.NullString, error) { - rows, err := db.Query(ctx, manyFoo) + rows, err := db.Query(ctx, manyFooSQL) if err != nil { return nil, err } @@ -69,13 +69,13 @@ func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]sql.NullString, error return items, nil } -const oneFoo = `-- name: OneFoo :one +const oneFooSQL = `-- name: OneFoo :one SELECT bar FROM foo ` // This function returns one Foo func (q *Queries) OneFoo(ctx context.Context, db DBTX) (sql.NullString, error) { - row := db.QueryRow(ctx, oneFoo) + row := db.QueryRow(ctx, oneFooSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go index d8d62964a4..1f5f31ba2f 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -12,45 +12,45 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const execFoo = `-- name: ExecFoo :exec +const execFooSQL = `-- name: ExecFoo :exec INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :exec func (q *Queries) ExecFoo(ctx context.Context, db DBTX) error { - _, err := db.Exec(ctx, execFoo) + _, err := db.Exec(ctx, execFooSQL) return err } -const execResultFoo = `-- name: ExecResultFoo :execresult +const execResultFooSQL = `-- name: ExecResultFoo :execresult INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execresult func (q *Queries) ExecResultFoo(ctx context.Context, db DBTX) (pgconn.CommandTag, error) { - return db.Exec(ctx, execResultFoo) + return db.Exec(ctx, execResultFooSQL) } -const execRowFoo = `-- name: ExecRowFoo :execrows +const execRowFooSQL = `-- name: ExecRowFoo :execrows INSERT INTO foo (bar) VALUES ('bar') ` // This function creates a Foo via :execrows func (q *Queries) ExecRowFoo(ctx context.Context, db DBTX) (int64, error) { - result, err := db.Exec(ctx, execRowFoo) + result, err := db.Exec(ctx, execRowFooSQL) if err != nil { return 0, err } return result.RowsAffected(), nil } -const manyFoo = `-- name: ManyFoo :many +const manyFooSQL = `-- name: ManyFoo :many SELECT bar FROM foo ` // This function returns a list of Foos func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]pgtype.Text, error) { - rows, err := db.Query(ctx, manyFoo) + rows, err := db.Query(ctx, manyFooSQL) if err != nil { return nil, err } @@ -69,13 +69,13 @@ func (q *Queries) ManyFoo(ctx context.Context, db DBTX) ([]pgtype.Text, error) { return items, nil } -const oneFoo = `-- name: OneFoo :one +const oneFooSQL = `-- name: OneFoo :one SELECT bar FROM foo ` // This function returns one Foo func (q *Queries) OneFoo(ctx context.Context, db DBTX) (pgtype.Text, error) { - row := db.QueryRow(ctx, oneFoo) + row := db.QueryRow(ctx, oneFooSQL) var bar pgtype.Text err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go index 0ab2b7970f..12b9e7f218 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT baz FROM foo.bar ` func (q *Queries) ListBar(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]string, error) { return items, nil } -const listBat = `-- name: ListBat :many +const listBatSQL = `-- name: ListBat :many SELECT baz FROM foo.bat ` func (q *Queries) ListBat(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listBat) + rows, err := q.db.Query(ctx, listBatSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go index 0ab2b7970f..12b9e7f218 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT baz FROM foo.bar ` func (q *Queries) ListBar(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]string, error) { return items, nil } -const listBat = `-- name: ListBat :many +const listBatSQL = `-- name: ListBat :many SELECT baz FROM foo.bat ` func (q *Queries) ListBat(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listBat) + rows, err := q.db.Query(ctx, listBatSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go index c18f189785..21c0da4e6a 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT baz FROM foo.bar ` func (q *Queries) ListBar(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]string, error) { return items, nil } -const listBat = `-- name: ListBat :many +const listBatSQL = `-- name: ListBat :many SELECT baz FROM foo.bat ` func (q *Queries) ListBat(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listBat) + rows, err := q.db.QueryContext(ctx, listBatSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go index 930559137e..d27e136b3c 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go @@ -10,34 +10,34 @@ import ( "database/sql" ) -const doubleDash = `-- name: DoubleDash :one +const doubleDashSQL = `-- name: DoubleDash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, doubleDash) + row := q.db.QueryRowContext(ctx, doubleDashSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const hash = `-- name: Hash :one +const hashSQL = `-- name: Hash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) Hash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, hash) + row := q.db.QueryRowContext(ctx, hashSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const slashStar = `-- name: SlashStar :one +const slashStarSQL = `-- name: SlashStar :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, slashStar) + row := q.db.QueryRowContext(ctx, slashStarSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go index 25a38d570f..2fb2ffe189 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go @@ -10,23 +10,23 @@ import ( "database/sql" ) -const doubleDash = `-- name: DoubleDash :one +const doubleDashSQL = `-- name: DoubleDash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRow(ctx, doubleDash) + row := q.db.QueryRow(ctx, doubleDashSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const slashStar = `-- name: SlashStar :one +const slashStarSQL = `-- name: SlashStar :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRow(ctx, slashStar) + row := q.db.QueryRow(ctx, slashStarSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go index 6b80af138e..b102ea2bde 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go @@ -11,23 +11,23 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const doubleDash = `-- name: DoubleDash :one +const doubleDashSQL = `-- name: DoubleDash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) DoubleDash(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, doubleDash) + row := q.db.QueryRow(ctx, doubleDashSQL) var bar pgtype.Text err := row.Scan(&bar) return bar, err } -const slashStar = `-- name: SlashStar :one +const slashStarSQL = `-- name: SlashStar :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) SlashStar(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, slashStar) + row := q.db.QueryRow(ctx, slashStarSQL) var bar pgtype.Text err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go index ddb7c2a409..fd9a876734 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go @@ -10,23 +10,23 @@ import ( "database/sql" ) -const doubleDash = `-- name: DoubleDash :one +const doubleDashSQL = `-- name: DoubleDash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, doubleDash) + row := q.db.QueryRowContext(ctx, doubleDashSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const slashStar = `-- name: SlashStar :one +const slashStarSQL = `-- name: SlashStar :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, slashStar) + row := q.db.QueryRowContext(ctx, slashStarSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go index ddb7c2a409..fd9a876734 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go @@ -10,23 +10,23 @@ import ( "database/sql" ) -const doubleDash = `-- name: DoubleDash :one +const doubleDashSQL = `-- name: DoubleDash :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, doubleDash) + row := q.db.QueryRowContext(ctx, doubleDashSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const slashStar = `-- name: SlashStar :one +const slashStarSQL = `-- name: SlashStar :one SELECT bar FROM foo LIMIT 1 ` func (q *Queries) SlashStar(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, slashStar) + row := q.db.QueryRowContext(ctx, slashStarSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go index 50d2309472..499e3ec4a0 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const alsoNotEqual = `-- name: AlsoNotEqual :many +const alsoNotEqualSQL = `-- name: AlsoNotEqual :many SELECT count(*) <> 0 FROM bar ` func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, alsoNotEqual) + rows, err := q.db.QueryContext(ctx, alsoNotEqualSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { return items, nil } -const equal = `-- name: Equal :many +const equalSQL = `-- name: Equal :many SELECT count(*) = 0 FROM bar ` func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, equal) + rows, err := q.db.QueryContext(ctx, equalSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) Equal(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThan = `-- name: GreaterThan :many +const greaterThanSQL = `-- name: GreaterThan :many SELECT count(*) > 0 FROM bar ` func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThan) + rows, err := q.db.QueryContext(ctx, greaterThanSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +const greaterThanOrEqualSQL = `-- name: GreaterThanOrEqual :many SELECT count(*) >= 0 FROM bar ` func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) + rows, err := q.db.QueryContext(ctx, greaterThanOrEqualSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const isNotNull = `-- name: IsNotNull :many +const isNotNullSQL = `-- name: IsNotNull :many SELECT id IS NOT NULL FROM bar ` func (q *Queries) IsNotNull(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, isNotNull) + rows, err := q.db.QueryContext(ctx, isNotNullSQL) if err != nil { return nil, err } @@ -144,12 +144,12 @@ func (q *Queries) IsNotNull(ctx context.Context) ([]bool, error) { return items, nil } -const isNull = `-- name: IsNull :many +const isNullSQL = `-- name: IsNull :many SELECT id IS NULL FROM bar ` func (q *Queries) IsNull(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, isNull) + rows, err := q.db.QueryContext(ctx, isNullSQL) if err != nil { return nil, err } @@ -171,12 +171,12 @@ func (q *Queries) IsNull(ctx context.Context) ([]bool, error) { return items, nil } -const lessThan = `-- name: LessThan :many +const lessThanSQL = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThan) + rows, err := q.db.QueryContext(ctx, lessThanSQL) if err != nil { return nil, err } @@ -198,12 +198,12 @@ func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { return items, nil } -const lessThanOrEqual = `-- name: LessThanOrEqual :many +const lessThanOrEqualSQL = `-- name: LessThanOrEqual :many SELECT count(*) <= 0 FROM bar ` func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThanOrEqual) + rows, err := q.db.QueryContext(ctx, lessThanOrEqualSQL) if err != nil { return nil, err } @@ -225,12 +225,12 @@ func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const notEqual = `-- name: NotEqual :many +const notEqualSQL = `-- name: NotEqual :many SELECT count(*) != 0 FROM bar ` func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, notEqual) + rows, err := q.db.QueryContext(ctx, notEqualSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go index 661d3db543..d6df1224cd 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const alsoNotEqual = `-- name: AlsoNotEqual :many +const alsoNotEqualSQL = `-- name: AlsoNotEqual :many SELECT count(*) <> 0 FROM bar ` func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, alsoNotEqual) + rows, err := q.db.Query(ctx, alsoNotEqualSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { return items, nil } -const equal = `-- name: Equal :many +const equalSQL = `-- name: Equal :many SELECT count(*) = 0 FROM bar ` func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, equal) + rows, err := q.db.Query(ctx, equalSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) Equal(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThan = `-- name: GreaterThan :many +const greaterThanSQL = `-- name: GreaterThan :many SELECT count(*) > 0 FROM bar ` func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, greaterThan) + rows, err := q.db.Query(ctx, greaterThanSQL) if err != nil { return nil, err } @@ -81,12 +81,12 @@ func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +const greaterThanOrEqualSQL = `-- name: GreaterThanOrEqual :many SELECT count(*) >= 0 FROM bar ` func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, greaterThanOrEqual) + rows, err := q.db.Query(ctx, greaterThanOrEqualSQL) if err != nil { return nil, err } @@ -105,12 +105,12 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const lessThan = `-- name: LessThan :many +const lessThanSQL = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, lessThan) + rows, err := q.db.Query(ctx, lessThanSQL) if err != nil { return nil, err } @@ -129,12 +129,12 @@ func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { return items, nil } -const lessThanOrEqual = `-- name: LessThanOrEqual :many +const lessThanOrEqualSQL = `-- name: LessThanOrEqual :many SELECT count(*) <= 0 FROM bar ` func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, lessThanOrEqual) + rows, err := q.db.Query(ctx, lessThanOrEqualSQL) if err != nil { return nil, err } @@ -153,12 +153,12 @@ func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const notEqual = `-- name: NotEqual :many +const notEqualSQL = `-- name: NotEqual :many SELECT count(*) != 0 FROM bar ` func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, notEqual) + rows, err := q.db.Query(ctx, notEqualSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go index 661d3db543..d6df1224cd 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const alsoNotEqual = `-- name: AlsoNotEqual :many +const alsoNotEqualSQL = `-- name: AlsoNotEqual :many SELECT count(*) <> 0 FROM bar ` func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, alsoNotEqual) + rows, err := q.db.Query(ctx, alsoNotEqualSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { return items, nil } -const equal = `-- name: Equal :many +const equalSQL = `-- name: Equal :many SELECT count(*) = 0 FROM bar ` func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, equal) + rows, err := q.db.Query(ctx, equalSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) Equal(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThan = `-- name: GreaterThan :many +const greaterThanSQL = `-- name: GreaterThan :many SELECT count(*) > 0 FROM bar ` func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, greaterThan) + rows, err := q.db.Query(ctx, greaterThanSQL) if err != nil { return nil, err } @@ -81,12 +81,12 @@ func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +const greaterThanOrEqualSQL = `-- name: GreaterThanOrEqual :many SELECT count(*) >= 0 FROM bar ` func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, greaterThanOrEqual) + rows, err := q.db.Query(ctx, greaterThanOrEqualSQL) if err != nil { return nil, err } @@ -105,12 +105,12 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const lessThan = `-- name: LessThan :many +const lessThanSQL = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, lessThan) + rows, err := q.db.Query(ctx, lessThanSQL) if err != nil { return nil, err } @@ -129,12 +129,12 @@ func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { return items, nil } -const lessThanOrEqual = `-- name: LessThanOrEqual :many +const lessThanOrEqualSQL = `-- name: LessThanOrEqual :many SELECT count(*) <= 0 FROM bar ` func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, lessThanOrEqual) + rows, err := q.db.Query(ctx, lessThanOrEqualSQL) if err != nil { return nil, err } @@ -153,12 +153,12 @@ func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const notEqual = `-- name: NotEqual :many +const notEqualSQL = `-- name: NotEqual :many SELECT count(*) != 0 FROM bar ` func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.Query(ctx, notEqual) + rows, err := q.db.Query(ctx, notEqualSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go index 93f785a8cb..cde36da436 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const alsoNotEqual = `-- name: AlsoNotEqual :many +const alsoNotEqualSQL = `-- name: AlsoNotEqual :many SELECT count(*) <> 0 FROM bar ` func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, alsoNotEqual) + rows, err := q.db.QueryContext(ctx, alsoNotEqualSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { return items, nil } -const equal = `-- name: Equal :many +const equalSQL = `-- name: Equal :many SELECT count(*) = 0 FROM bar ` func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, equal) + rows, err := q.db.QueryContext(ctx, equalSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) Equal(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThan = `-- name: GreaterThan :many +const greaterThanSQL = `-- name: GreaterThan :many SELECT count(*) > 0 FROM bar ` func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThan) + rows, err := q.db.QueryContext(ctx, greaterThanSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +const greaterThanOrEqualSQL = `-- name: GreaterThanOrEqual :many SELECT count(*) >= 0 FROM bar ` func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) + rows, err := q.db.QueryContext(ctx, greaterThanOrEqualSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const lessThan = `-- name: LessThan :many +const lessThanSQL = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThan) + rows, err := q.db.QueryContext(ctx, lessThanSQL) if err != nil { return nil, err } @@ -144,12 +144,12 @@ func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { return items, nil } -const lessThanOrEqual = `-- name: LessThanOrEqual :many +const lessThanOrEqualSQL = `-- name: LessThanOrEqual :many SELECT count(*) <= 0 FROM bar ` func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThanOrEqual) + rows, err := q.db.QueryContext(ctx, lessThanOrEqualSQL) if err != nil { return nil, err } @@ -171,12 +171,12 @@ func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const notEqual = `-- name: NotEqual :many +const notEqualSQL = `-- name: NotEqual :many SELECT count(*) != 0 FROM bar ` func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, notEqual) + rows, err := q.db.QueryContext(ctx, notEqualSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go index 93f785a8cb..cde36da436 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const alsoNotEqual = `-- name: AlsoNotEqual :many +const alsoNotEqualSQL = `-- name: AlsoNotEqual :many SELECT count(*) <> 0 FROM bar ` func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, alsoNotEqual) + rows, err := q.db.QueryContext(ctx, alsoNotEqualSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) AlsoNotEqual(ctx context.Context) ([]bool, error) { return items, nil } -const equal = `-- name: Equal :many +const equalSQL = `-- name: Equal :many SELECT count(*) = 0 FROM bar ` func (q *Queries) Equal(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, equal) + rows, err := q.db.QueryContext(ctx, equalSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) Equal(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThan = `-- name: GreaterThan :many +const greaterThanSQL = `-- name: GreaterThan :many SELECT count(*) > 0 FROM bar ` func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThan) + rows, err := q.db.QueryContext(ctx, greaterThanSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) GreaterThan(ctx context.Context) ([]bool, error) { return items, nil } -const greaterThanOrEqual = `-- name: GreaterThanOrEqual :many +const greaterThanOrEqualSQL = `-- name: GreaterThanOrEqual :many SELECT count(*) >= 0 FROM bar ` func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, greaterThanOrEqual) + rows, err := q.db.QueryContext(ctx, greaterThanOrEqualSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const lessThan = `-- name: LessThan :many +const lessThanSQL = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThan) + rows, err := q.db.QueryContext(ctx, lessThanSQL) if err != nil { return nil, err } @@ -144,12 +144,12 @@ func (q *Queries) LessThan(ctx context.Context) ([]bool, error) { return items, nil } -const lessThanOrEqual = `-- name: LessThanOrEqual :many +const lessThanOrEqualSQL = `-- name: LessThanOrEqual :many SELECT count(*) <= 0 FROM bar ` func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, lessThanOrEqual) + rows, err := q.db.QueryContext(ctx, lessThanOrEqualSQL) if err != nil { return nil, err } @@ -171,12 +171,12 @@ func (q *Queries) LessThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } -const notEqual = `-- name: NotEqual :many +const notEqualSQL = `-- name: NotEqual :many SELECT count(*) != 0 FROM bar ` func (q *Queries) NotEqual(ctx context.Context) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, notEqual) + rows, err := q.db.QueryContext(ctx, notEqualSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go index fca6954bff..3f2d728ff2 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listPaths = `-- name: ListPaths :many +const listPathsSQL = `-- name: ListPaths :many SELECT point_one, point_two FROM foo.paths ` func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { - rows, err := q.db.Query(ctx, listPaths) + rows, err := q.db.Query(ctx, listPathsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go index fca6954bff..3f2d728ff2 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listPaths = `-- name: ListPaths :many +const listPathsSQL = `-- name: ListPaths :many SELECT point_one, point_two FROM foo.paths ` func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { - rows, err := q.db.Query(ctx, listPaths) + rows, err := q.db.Query(ctx, listPathsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go index ae8a6b840b..0f4c82fd30 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listPaths = `-- name: ListPaths :many +const listPathsSQL = `-- name: ListPaths :many SELECT point_one, point_two FROM foo.paths ` func (q *Queries) ListPaths(ctx context.Context) ([]FooPath, error) { - rows, err := q.db.QueryContext(ctx, listPaths) + rows, err := q.db.QueryContext(ctx, listPathsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go index 1861778316..0592b83f83 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go @@ -12,23 +12,23 @@ import ( "github.com/google/uuid" ) -const time2ByTime = `-- name: Time2ByTime :one +const time2ByTimeSQL = `-- name: Time2ByTime :one SELECT time2 FROM foo WHERE time=$1 ` func (q *Queries) Time2ByTime(ctx context.Context, argTime time.Time) (time.Time, error) { - row := q.db.QueryRowContext(ctx, time2ByTime, argTime) + row := q.db.QueryRowContext(ctx, time2ByTimeSQL, argTime) var time2 time.Time err := row.Scan(&time2) return time2, err } -const uuid2ByUuid = `-- name: Uuid2ByUuid :one +const uuid2ByUuidSQL = `-- name: Uuid2ByUuid :one SELECT uuid2 FROM foo WHERE uuid=$1 ` func (q *Queries) Uuid2ByUuid(ctx context.Context, argUuid uuid.UUID) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, uuid2ByUuid, argUuid) + row := q.db.QueryRowContext(ctx, uuid2ByUuidSQL, argUuid) var uuid2 uuid.UUID err := row.Scan(&uuid2) return uuid2, err diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go index 91bd6628f8..86aed9e232 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "database/sql" ) -const insertSingleValue = `-- name: InsertSingleValue :copyfrom +const insertSingleValueSQL = `-- name: InsertSingleValue :copyfrom INSERT INTO foo (a) VALUES (?) ` -const insertValues = `-- name: InsertValues :copyfrom +const insertValuesSQL = `-- name: InsertValues :copyfrom INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?) ` diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go index 582785f08f..10ce7f1840 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go @@ -12,21 +12,21 @@ import ( "github.com/jackc/pgconn" ) -const deleteValues = `-- name: DeleteValues :execresult +const deleteValuesSQL = `-- name: DeleteValues :execresult DELETE FROM myschema.foo ` func (q *Queries) DeleteValues(ctx context.Context) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, deleteValues) + return q.db.Exec(ctx, deleteValuesSQL) } -const insertSingleValue = `-- name: InsertSingleValue :exec +const insertSingleValueSQL = `-- name: InsertSingleValue :exec INSERT INTO myschema.foo (a) VALUES ($1) ` func (q *Queries) InsertSingleValue(ctx context.Context, a sql.NullString) error { - _, err := q.db.Exec(ctx, insertSingleValue, a) + _, err := q.db.Exec(ctx, insertSingleValueSQL, a) return err } diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go index 5be522e851..ba38c8c939 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go @@ -12,21 +12,21 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const deleteValues = `-- name: DeleteValues :execresult +const deleteValuesSQL = `-- name: DeleteValues :execresult DELETE FROM myschema.foo ` func (q *Queries) DeleteValues(ctx context.Context) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, deleteValues) + return q.db.Exec(ctx, deleteValuesSQL) } -const insertSingleValue = `-- name: InsertSingleValue :exec +const insertSingleValueSQL = `-- name: InsertSingleValue :exec INSERT INTO myschema.foo (a) VALUES ($1) ` func (q *Queries) InsertSingleValue(ctx context.Context, a pgtype.Text) error { - _, err := q.db.Exec(ctx, insertSingleValue, a) + _, err := q.db.Exec(ctx, insertSingleValueSQL, a) return err } diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go index 83233f4f4a..b6112ceb2e 100644 --- a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "database/sql" ) -const insertMultipleValues = `-- name: InsertMultipleValues :copyfrom +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :copyfrom INSERT INTO foo (a, b) VALUES (?, ?) ` diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go index 68c76e940d..af55d8cf4e 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "database/sql" ) -const insertSingleValue = `-- name: InsertSingleValue :copyfrom +const insertSingleValueSQL = `-- name: InsertSingleValue :copyfrom INSERT INTO foo (a) VALUES (?) ` diff --git a/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go b/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go index de351869a7..8862c8d924 100644 --- a/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go +++ b/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go @@ -13,12 +13,12 @@ import ( "github.com/shopspring/decimal" ) -const allTypes = `-- name: AllTypes :many +const allTypesSQL = `-- name: AllTypes :many SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; ` func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { - rows, err := q.db.QueryContext(ctx, allTypes) + rows, err := q.db.QueryContext(ctx, allTypesSQL) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { return items, nil } -const casts = `-- name: Casts :one +const castsSQL = `-- name: Casts :one SELECT CAST(id AS String) AS a, toDecimal64(id, 4) AS b, @@ -89,7 +89,7 @@ type CastsRow struct { } func (q *Queries) Casts(ctx context.Context) (CastsRow, error) { - row := q.db.QueryRowContext(ctx, casts) + row := q.db.QueryRowContext(ctx, castsSQL) var i CastsRow err := row.Scan( &i.A, @@ -102,7 +102,7 @@ func (q *Queries) Casts(ctx context.Context) (CastsRow, error) { return i, err } -const placeholders = `-- name: Placeholders :many +const placeholdersSQL = `-- name: Placeholders :many SELECT id FROM things WHERE id = {p1:UInt64} AND name = {p2:String} AND amount > {p3:Float64} AND tag = {p4:Nullable(String)} AND price = {p5:Decimal(10, 2)}; ` @@ -116,7 +116,7 @@ type PlaceholdersParams struct { } func (q *Queries) Placeholders(ctx context.Context, arg PlaceholdersParams) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, placeholders, + rows, err := q.db.QueryContext(ctx, placeholdersSQL, sql.Named("p1", arg.P1), sql.Named("p2", arg.P2), sql.Named("p3", arg.P3), @@ -144,12 +144,12 @@ func (q *Queries) Placeholders(ctx context.Context, arg PlaceholdersParams) ([]u return items, nil } -const starColumns = `-- name: StarColumns :many +const starColumnsSQL = `-- name: StarColumns :many SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; ` func (q *Queries) StarColumns(ctx context.Context) ([]Thing, error) { - rows, err := q.db.QueryContext(ctx, starColumns) + rows, err := q.db.QueryContext(ctx, starColumnsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go b/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go index 1fdc2d244a..bb86717199 100644 --- a/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go +++ b/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go @@ -12,12 +12,12 @@ import ( "github.com/duckdb/duckdb-go/v2" ) -const allTypes = `-- name: AllTypes :many +const allTypesSQL = `-- name: AllTypes :many SELECT id, ints, fixed, point, attrs, either, price, title, kind, m, mm, big, ubig, data, bits, uid, tstz, tsns, iv, doc, grid, vi, f4, points, lists, body, n FROM things; ` func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { - rows, err := q.db.QueryContext(ctx, allTypes) + rows, err := q.db.QueryContext(ctx, allTypesSQL) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { return items, nil } -const casts = `-- name: Casts :one +const castsSQL = `-- name: Casts :one SELECT $1::DECIMAL(5,2) AS a, $2::INTEGER[] AS b, @@ -103,7 +103,7 @@ type CastsRow struct { } func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { - row := q.db.QueryRowContext(ctx, casts, + row := q.db.QueryRowContext(ctx, castsSQL, arg.Column1, arg.Column2, arg.Column3, @@ -127,7 +127,7 @@ func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) return i, err } -const params = `-- name: Params :one +const paramsSQL = `-- name: Params :one SELECT id FROM things WHERE ints = $1 AND point = $2 AND price = $3 AND m = $4 AND either = $5 AND grid = $6; ` @@ -142,7 +142,7 @@ type ParamsParams struct { } func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int32, error) { - row := q.db.QueryRowContext(ctx, params, + row := q.db.QueryRowContext(ctx, paramsSQL, arg.Ints, arg.Point, arg.Price, diff --git a/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go b/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go index b9ae7acb56..66b4fbdbbf 100644 --- a/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go @@ -13,12 +13,12 @@ import ( "cloud.google.com/go/spanner" ) -const allTypes = `-- name: AllTypes :many +const allTypesSQL = `-- name: AllTypes :many SELECT id, s, smax, n, byt, ai, as2, ts, d, j, b, f, f32, u FROM things ` func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { - rows, err := q.db.QueryContext(ctx, allTypes) + rows, err := q.db.QueryContext(ctx, allTypesSQL) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { return items, nil } -const casts = `-- name: Casts :one +const castsSQL = `-- name: Casts :one SELECT CAST(@a AS NUMERIC) AS a, CAST(@b AS ARRAY) AS b, @@ -79,7 +79,7 @@ type CastsRow struct { } func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { - row := q.db.QueryRowContext(ctx, casts, + row := q.db.QueryRowContext(ctx, castsSQL, sql.Named("a", arg.A), sql.Named("b", arg.B), sql.Named("d", arg.D), @@ -95,7 +95,7 @@ func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) return i, err } -const params = `-- name: Params :one +const paramsSQL = `-- name: Params :one SELECT id FROM things WHERE s = @s AND n = @n AND smax = @smax AND f32 = @f32 ` @@ -108,7 +108,7 @@ type ParamsParams struct { } func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int64, error) { - row := q.db.QueryRowContext(ctx, params, + row := q.db.QueryRowContext(ctx, paramsSQL, sql.Named("s", arg.S), sql.Named("n", arg.N), sql.Named("smax", arg.Smax), diff --git a/internal/endtoend/testdata/core_types/mssql/go/query.sql.go b/internal/endtoend/testdata/core_types/mssql/go/query.sql.go index 1645f7911b..f27828c79b 100644 --- a/internal/endtoend/testdata/core_types/mssql/go/query.sql.go +++ b/internal/endtoend/testdata/core_types/mssql/go/query.sql.go @@ -11,12 +11,12 @@ import ( "time" ) -const allTypes = `-- name: AllTypes :many +const allTypesSQL = `-- name: AllTypes :many SELECT id, price, amount, plain, body, title, code, ncode, blob, key16, created, updated, offset_at, tm, f, f53, r, m, b, u, x, j, sv, rv, g, h, vec, sn, phone, code2, code3, bare FROM things; ` func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { - rows, err := q.db.QueryContext(ctx, allTypes) + rows, err := q.db.QueryContext(ctx, allTypesSQL) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { return items, nil } -const casts = `-- name: Casts :one +const castsSQL = `-- name: Casts :one SELECT CAST(amount AS DECIMAL(5,2)) AS a, CAST(title AS NVARCHAR(MAX)) AS b, @@ -111,7 +111,7 @@ type CastsRow struct { } func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { - row := q.db.QueryRowContext(ctx, casts, + row := q.db.QueryRowContext(ctx, castsSQL, sql.Named("a", arg.A), sql.Named("b", arg.B), sql.Named("c", arg.C), @@ -133,7 +133,7 @@ func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) return i, err } -const params = `-- name: Params :one +const paramsSQL = `-- name: Params :one SELECT id FROM things WHERE price = @price AND body = @body AND phone = @phone AND offset_at = @offset_at; ` @@ -146,7 +146,7 @@ type ParamsParams struct { } func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int64, error) { - row := q.db.QueryRowContext(ctx, params, + row := q.db.QueryRowContext(ctx, paramsSQL, sql.Named("price", arg.Price), sql.Named("body", arg.Body), sql.Named("phone", arg.Phone), diff --git a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go index 817ad88789..c502de2691 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const countStarLower = `-- name: CountStarLower :one +const countStarLowerSQL = `-- name: CountStarLower :one SELECT count(*) FROM bar ` func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarLower) + row := q.db.QueryRowContext(ctx, countStarLowerSQL) var count int64 err := row.Scan(&count) return count, err } -const countStarUpper = `-- name: CountStarUpper :one +const countStarUpperSQL = `-- name: CountStarUpper :one SELECT COUNT(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarUpper) + row := q.db.QueryRowContext(ctx, countStarUpperSQL) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go index b4498da0b3..da54379766 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const countStarLower = `-- name: CountStarLower :one +const countStarLowerSQL = `-- name: CountStarLower :one SELECT count(*) FROM bar ` func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, countStarLower) + row := q.db.QueryRow(ctx, countStarLowerSQL) var count int64 err := row.Scan(&count) return count, err } -const countStarUpper = `-- name: CountStarUpper :one +const countStarUpperSQL = `-- name: CountStarUpper :one SELECT COUNT(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, countStarUpper) + row := q.db.QueryRow(ctx, countStarUpperSQL) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go index b4498da0b3..da54379766 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const countStarLower = `-- name: CountStarLower :one +const countStarLowerSQL = `-- name: CountStarLower :one SELECT count(*) FROM bar ` func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, countStarLower) + row := q.db.QueryRow(ctx, countStarLowerSQL) var count int64 err := row.Scan(&count) return count, err } -const countStarUpper = `-- name: CountStarUpper :one +const countStarUpperSQL = `-- name: CountStarUpper :one SELECT COUNT(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, countStarUpper) + row := q.db.QueryRow(ctx, countStarUpperSQL) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go index 817ad88789..c502de2691 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const countStarLower = `-- name: CountStarLower :one +const countStarLowerSQL = `-- name: CountStarLower :one SELECT count(*) FROM bar ` func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarLower) + row := q.db.QueryRowContext(ctx, countStarLowerSQL) var count int64 err := row.Scan(&count) return count, err } -const countStarUpper = `-- name: CountStarUpper :one +const countStarUpperSQL = `-- name: CountStarUpper :one SELECT COUNT(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarUpper) + row := q.db.QueryRowContext(ctx, countStarUpperSQL) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go index 155bfc114a..6411a7b177 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const countStarLower = `-- name: CountStarLower :one +const countStarLowerSQL = `-- name: CountStarLower :one SELECT count(*) FROM bar ` func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarLower) + row := q.db.QueryRowContext(ctx, countStarLowerSQL) var count int64 err := row.Scan(&count) return count, err } -const countStarUpper = `-- name: CountStarUpper :one +const countStarUpperSQL = `-- name: CountStarUpper :one SELECT count(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countStarUpper) + row := q.db.QueryRowContext(ctx, countStarUpperSQL) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go index fab385a1e6..65a62f84c5 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getFirst = `-- name: GetFirst :many +const getFirstSQL = `-- name: GetFirst :many SELECT val FROM mat_first_view ` func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getFirst) + rows, err := q.db.QueryContext(ctx, getFirstSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go index 40b8cbe292..a80169e3e5 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getFirst = `-- name: GetFirst :many +const getFirstSQL = `-- name: GetFirst :many SELECT val FROM second_table ` func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getFirst) + rows, err := q.db.QueryContext(ctx, getFirstSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go index d354d45d45..27d97ddcc8 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, date_of_birth FROM super_users ` func (q *Queries) GetAll(ctx context.Context) ([]SuperUser, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go index d354d45d45..27d97ddcc8 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, date_of_birth FROM super_users ` func (q *Queries) GetAll(ctx context.Context) ([]SuperUser, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go b/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go index da7ee04904..5e8ca04ec4 100644 --- a/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listVenueNames = `-- name: ListVenueNames :many +const listVenueNamesSQL = `-- name: ListVenueNames :many SELECT id, name, city FROM venue_names ` @@ -21,7 +21,7 @@ type ListVenueNamesRow struct { } func (q *Queries) ListVenueNames(ctx context.Context) ([]ListVenueNamesRow, error) { - rows, err := q.db.QueryContext(ctx, listVenueNames) + rows, err := q.db.QueryContext(ctx, listVenueNamesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go index c959a7153f..659fac5cc9 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getFirst = `-- name: GetFirst :many +const getFirstSQL = `-- name: GetFirst :many SELECT val FROM first_view ` func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getFirst) + rows, err := q.db.QueryContext(ctx, getFirstSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { return items, nil } -const getSecond = `-- name: GetSecond :many +const getSecondSQL = `-- name: GetSecond :many SELECT val, val2 FROM second_view WHERE val2 = $1 ` func (q *Queries) GetSecond(ctx context.Context) ([]SecondView, error) { - rows, err := q.db.QueryContext(ctx, getSecond) + rows, err := q.db.QueryContext(ctx, getSecondSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go index 08b6f2fa8b..b0e669dfb2 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getFirst = `-- name: GetFirst :many +const getFirstSQL = `-- name: GetFirst :many SELECT val FROM first_view ` func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getFirst) + rows, err := q.db.QueryContext(ctx, getFirstSQL) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { return items, nil } -const getSecond = `-- name: GetSecond :many +const getSecondSQL = `-- name: GetSecond :many SELECT val, val2 FROM second_view WHERE val2 = $1 ` func (q *Queries) GetSecond(ctx context.Context, val2 sql.NullInt32) ([]SecondView, error) { - rows, err := q.db.QueryContext(ctx, getSecond, val2) + rows, err := q.db.QueryContext(ctx, getSecondSQL, val2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go index 0c88a4122e..a5efeefed0 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getFirst = `-- name: GetFirst :many +const getFirstSQL = `-- name: GetFirst :many SELECT val FROM first_view ` func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getFirst) + rows, err := q.db.QueryContext(ctx, getFirstSQL) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) GetFirst(ctx context.Context) ([]string, error) { return items, nil } -const getSecond = `-- name: GetSecond :many +const getSecondSQL = `-- name: GetSecond :many SELECT val, val2 FROM second_view WHERE val2 = ? ` func (q *Queries) GetSecond(ctx context.Context, val2 sql.NullInt64) ([]SecondView, error) { - rows, err := q.db.QueryContext(ctx, getSecond, val2) + rows, err := q.db.QueryContext(ctx, getSecondSQL, val2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go index dbaccd81cd..e394cf2e37 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTECount = `-- name: CTECount :many +const cTECountSQL = `-- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar ), ready_count AS ( @@ -25,7 +25,7 @@ type CTECountRow struct { } func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { - rows, err := q.db.QueryContext(ctx, cTECount) + rows, err := q.db.QueryContext(ctx, cTECountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go index 8f46c91591..45c47e4e96 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTECount = `-- name: CTECount :many +const cTECountSQL = `-- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar ), ready_count AS ( @@ -25,7 +25,7 @@ type CTECountRow struct { } func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { - rows, err := q.db.Query(ctx, cTECount) + rows, err := q.db.Query(ctx, cTECountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go index 8f46c91591..45c47e4e96 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTECount = `-- name: CTECount :many +const cTECountSQL = `-- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar ), ready_count AS ( @@ -25,7 +25,7 @@ type CTECountRow struct { } func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { - rows, err := q.db.Query(ctx, cTECount) + rows, err := q.db.Query(ctx, cTECountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go index dbaccd81cd..e394cf2e37 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTECount = `-- name: CTECount :many +const cTECountSQL = `-- name: CTECount :many WITH all_count AS ( SELECT count(*) FROM bar ), ready_count AS ( @@ -25,7 +25,7 @@ type CTECountRow struct { } func (q *Queries) CTECount(ctx context.Context) ([]CTECountRow, error) { - rows, err := q.db.QueryContext(ctx, cTECount) + rows, err := q.db.QueryContext(ctx, cTECountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go index a3d95916d7..4605f401a3 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTEFilter = `-- name: CTEFilter :many +const cTEFilterSQL = `-- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = ? ) @@ -18,7 +18,7 @@ FROM filter_count ` func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, cTEFilter, ready) + rows, err := q.db.QueryContext(ctx, cTEFilterSQL, ready) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go index 6f1d58cb39..fa5b077d08 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTEFilter = `-- name: CTEFilter :many +const cTEFilterSQL = `-- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 ) @@ -18,7 +18,7 @@ FROM filter_count ` func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { - rows, err := q.db.Query(ctx, cTEFilter, ready) + rows, err := q.db.Query(ctx, cTEFilterSQL, ready) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go index 6f1d58cb39..fa5b077d08 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTEFilter = `-- name: CTEFilter :many +const cTEFilterSQL = `-- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 ) @@ -18,7 +18,7 @@ FROM filter_count ` func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { - rows, err := q.db.Query(ctx, cTEFilter, ready) + rows, err := q.db.Query(ctx, cTEFilterSQL, ready) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go index 62294fe4ed..1c22ad32f3 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const cTEFilter = `-- name: CTEFilter :many +const cTEFilterSQL = `-- name: CTEFilter :many WITH filter_count AS ( SELECT count(*) FROM bar WHERE ready = $1 ) @@ -18,7 +18,7 @@ FROM filter_count ` func (q *Queries) CTEFilter(ctx context.Context, ready bool) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, cTEFilter, ready) + rows, err := q.db.QueryContext(ctx, cTEFilterSQL, ready) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go index 0fd419b000..f8f49d2fda 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :exec +const deleteReadyWithCTESQL = `-- name: DeleteReadyWithCTE :exec WITH ready_ids AS ( SELECT id FROM bar WHERE ready ) @@ -17,6 +17,6 @@ DELETE FROM bar WHERE id IN (SELECT id FROM ready_ids) ` func (q *Queries) DeleteReadyWithCTE(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, deleteReadyWithCTE) + _, err := q.db.ExecContext(ctx, deleteReadyWithCTESQL) return err } diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go index 31f9300755..876f091155 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +const deleteReadyWithCTESQL = `-- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready ) @@ -18,7 +18,7 @@ RETURNING id ` func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, deleteReadyWithCTE) + rows, err := q.db.Query(ctx, deleteReadyWithCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go index 31f9300755..876f091155 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +const deleteReadyWithCTESQL = `-- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready ) @@ -18,7 +18,7 @@ RETURNING id ` func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, deleteReadyWithCTE) + rows, err := q.db.Query(ctx, deleteReadyWithCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go index fd4e4c3db2..6be6eb7bc3 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteReadyWithCTE = `-- name: DeleteReadyWithCTE :many +const deleteReadyWithCTESQL = `-- name: DeleteReadyWithCTE :many WITH ready_ids AS ( SELECT id FROM bar WHERE ready ) @@ -18,7 +18,7 @@ RETURNING id ` func (q *Queries) DeleteReadyWithCTE(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, deleteReadyWithCTE) + rows, err := q.db.QueryContext(ctx, deleteReadyWithCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go index 1238110b59..cc49515488 100644 --- a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listItems = `-- name: ListItems :one +const listItemsSQL = `-- name: ListItems :one WITH items1 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name), items2 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name) @@ -27,7 +27,7 @@ type ListItemsRow struct { } func (q *Queries) ListItems(ctx context.Context) (ListItemsRow, error) { - row := q.db.QueryRow(ctx, listItems) + row := q.db.QueryRow(ctx, listItemsSQL) var i ListItemsRow err := row.Scan(&i.Id1, &i.Id2) return i, err diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go index 64c2320add..755f994c58 100644 --- a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const badQuery = `-- name: BadQuery :exec +const badQuerySQL = `-- name: BadQuery :exec WITH q AS ( @@ -29,6 +29,6 @@ WHERE c1.name = $1 ` func (q *Queries) BadQuery(ctx context.Context, dollar_1 pgtype.Text) error { - _, err := q.db.Exec(ctx, badQuery, dollar_1) + _, err := q.db.Exec(ctx, badQuerySQL, dollar_1) return err } diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go index 2b4b7f76c6..2db1595b54 100644 --- a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const badQuery = `-- name: BadQuery :one +const badQuerySQL = `-- name: BadQuery :one WITH q AS ( @@ -36,7 +36,7 @@ type BadQueryRow struct { } func (q *Queries) BadQuery(ctx context.Context) (BadQueryRow, error) { - row := q.db.QueryRow(ctx, badQuery) + row := q.db.QueryRow(ctx, badQuerySQL) var i BadQueryRow err := row.Scan( &i.Name, diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go index 63c955bde2..19e5e708da 100644 --- a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one WITH person AS( WITH summary AS( WITH mb AS( @@ -31,7 +31,7 @@ select total from person ` func (q *Queries) GetAuthor(ctx context.Context) (pgtype.Int8, error) { - row := q.db.QueryRow(ctx, getAuthor) + row := q.db.QueryRow(ctx, getAuthorSQL) var total pgtype.Int8 err := row.Scan(&total) return total, err diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go index 3fb405a017..9589e9825c 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const cTERecursive = `-- name: CTERecursive :many +const cTERecursiveSQL = `-- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.id, b.parent_id FROM bar AS b WHERE b.id = ? @@ -27,7 +27,7 @@ type CTERecursiveRow struct { } func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { - rows, err := q.db.QueryContext(ctx, cTERecursive, id) + rows, err := q.db.QueryContext(ctx, cTERecursiveSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go index 97d5c2cd7c..824db63ea9 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const cTERecursive = `-- name: CTERecursive :many +const cTERecursiveSQL = `-- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.id, b.parent_id FROM bar AS b WHERE b.id = $1 @@ -27,7 +27,7 @@ type CTERecursiveRow struct { } func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { - rows, err := q.db.Query(ctx, cTERecursive, id) + rows, err := q.db.Query(ctx, cTERecursiveSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go index 515bac8e58..531daed01f 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const cTERecursive = `-- name: CTERecursive :many +const cTERecursiveSQL = `-- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.id, b.parent_id FROM bar AS b WHERE b.id = $1 @@ -28,7 +28,7 @@ type CTERecursiveRow struct { } func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { - rows, err := q.db.Query(ctx, cTERecursive, id) + rows, err := q.db.Query(ctx, cTERecursiveSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go index 12419a781c..a908725c21 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const cTERecursive = `-- name: CTERecursive :many +const cTERecursiveSQL = `-- name: CTERecursive :many WITH RECURSIVE cte AS ( SELECT b.id, b.parent_id FROM bar AS b WHERE b.id = $1 @@ -27,7 +27,7 @@ type CTERecursiveRow struct { } func (q *Queries) CTERecursive(ctx context.Context, id int32) ([]CTERecursiveRow, error) { - rows, err := q.db.QueryContext(ctx, cTERecursive, id) + rows, err := q.db.QueryContext(ctx, cTERecursiveSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go index 9bb959847b..7a2e507930 100644 --- a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getSubordinates = `-- name: GetSubordinates :many +const getSubordinatesSQL = `-- name: GetSubordinates :many WITH RECURSIVE subordinates(name, manager) AS ( SELECT NULL, $1::TEXT @@ -36,7 +36,7 @@ WHERE ` func (q *Queries) GetSubordinates(ctx context.Context, name pgtype.Text) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, getSubordinates, name) + rows, err := q.db.Query(ctx, getSubordinatesSQL, name) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go index 6034af9188..15c4a50632 100644 --- a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getDictTree = `-- name: GetDictTree :many +const getDictTreeSQL = `-- name: GetDictTree :many with recursive dictTree(id, code, parent_code, label, value, path, depth) AS ( select id, code, parent_code, label, value, ARRAY[COALESCE((select id from dict where code=''),'virtual_root'), id], 1 as depth from dict where app_id = '1' and parent_code = '' and is_delete=false union @@ -31,7 +31,7 @@ type GetDictTreeRow struct { } func (q *Queries) GetDictTree(ctx context.Context) ([]GetDictTreeRow, error) { - rows, err := q.db.Query(ctx, getDictTree) + rows, err := q.db.Query(ctx, getDictTreeSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go index 60559a075c..dc062d0bb5 100644 --- a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getLatestVersion = `-- name: GetLatestVersion :one +const getLatestVersionSQL = `-- name: GetLatestVersion :one WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( SELECT base.id, base.id AS chain_id, 0 as chain_counter FROM versions AS base @@ -26,13 +26,13 @@ ORDER BY search_tree.chain_id, chain_counter DESC ` func (q *Queries) GetLatestVersion(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, getLatestVersion) + row := q.db.QueryRow(ctx, getLatestVersionSQL) var id int64 err := row.Scan(&id) return id, err } -const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +const getLatestVersionWithSubquerySQL = `-- name: GetLatestVersionWithSubquery :one SELECT id FROM versions WHERE versions.id IN ( @@ -53,7 +53,7 @@ WHERE versions.id IN ( ` func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + row := q.db.QueryRow(ctx, getLatestVersionWithSubquerySQL) var id int64 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go index a60bc65d95..80be990e51 100644 --- a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const listCaseIntentHistory = `-- name: ListCaseIntentHistory :many +const listCaseIntentHistorySQL = `-- name: ListCaseIntentHistory :many WITH RECURSIVE descendants AS ( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1 AS lvl FROM case_intent_parent_join @@ -37,7 +37,7 @@ type ListCaseIntentHistoryRow struct { } func (q *Queries) ListCaseIntentHistory(ctx context.Context, caseIntentID pgtype.Int8) ([]ListCaseIntentHistoryRow, error) { - rows, err := q.db.Query(ctx, listCaseIntentHistory, caseIntentID) + rows, err := q.db.Query(ctx, listCaseIntentHistorySQL, caseIntentID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go index 463398c104..c2b3b5c368 100644 --- a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const testRecursive = `-- name: TestRecursive :one +const testRecursiveSQL = `-- name: TestRecursive :one WITH t1 AS ( select 1 as foo ) @@ -17,7 +17,7 @@ SELECT foo FROM t1 ` func (q *Queries) TestRecursive(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, testRecursive) + row := q.db.QueryRow(ctx, testRecursiveSQL) var foo int32 err := row.Scan(&foo) return foo, err diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go index 3d729de8a8..bbe3db294d 100644 --- a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const updateAttribute = `-- name: UpdateAttribute :one +const updateAttributeSQL = `-- name: UpdateAttribute :one with updated_attribute as (UPDATE attribute_value SET val = CASE WHEN $1::bool THEN $2 ELSE val END @@ -35,7 +35,7 @@ type UpdateAttributeRow struct { } func (q *Queries) UpdateAttribute(ctx context.Context, arg UpdateAttributeParams) (UpdateAttributeRow, error) { - row := q.db.QueryRow(ctx, updateAttribute, arg.FilterValue, arg.Value, arg.ID) + row := q.db.QueryRow(ctx, updateAttributeSQL, arg.FilterValue, arg.Value, arg.ID) var i UpdateAttributeRow err := row.Scan(&i.ID, &i.Val, &i.Name) return i, err diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go index b44b0a9d2c..e397bdf3db 100644 --- a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const updateUserAddressWithAddress = `-- name: UpdateUserAddressWithAddress :one +const updateUserAddressWithAddressSQL = `-- name: UpdateUserAddressWithAddress :one WITH t1 AS ( UPDATE "address" as a SET @@ -61,7 +61,7 @@ type UpdateUserAddressWithAddressRow struct { } func (q *Queries) UpdateUserAddressWithAddress(ctx context.Context, arg UpdateUserAddressWithAddressParams) (UpdateUserAddressWithAddressRow, error) { - row := q.db.QueryRow(ctx, updateUserAddressWithAddress, + row := q.db.QueryRow(ctx, updateUserAddressWithAddressSQL, arg.AddressLine, arg.Region, arg.City, diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go index 8d9bdb7961..e8fde487ba 100644 --- a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, parent_id FROM L ` func (q *Queries) GetAll(ctx context.Context) ([]L, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func (q *Queries) GetAll(ctx context.Context) ([]L, error) { return items, nil } -const getAll1 = `-- name: GetAll1 :many +const getAll1SQL = `-- name: GetAll1 :many with recursive cte as ( select id, L_ID, F from T union all @@ -50,7 +50,7 @@ type GetAll1Row struct { } func (q *Queries) GetAll1(ctx context.Context, lID pgtype.Int4) ([]GetAll1Row, error) { - rows, err := q.db.Query(ctx, getAll1, lID) + rows, err := q.db.Query(ctx, getAll1SQL, lID) if err != nil { return nil, err } @@ -69,7 +69,7 @@ func (q *Queries) GetAll1(ctx context.Context, lID pgtype.Int4) ([]GetAll1Row, e return items, nil } -const getAll2 = `-- name: GetAll2 :many +const getAll2SQL = `-- name: GetAll2 :many with recursive cte as ( select id, L_ID, F from T where T.ID=2 union all @@ -84,7 +84,7 @@ type GetAll2Row struct { } func (q *Queries) GetAll2(ctx context.Context, lID pgtype.Int4) ([]GetAll2Row, error) { - rows, err := q.db.Query(ctx, getAll2, lID) + rows, err := q.db.Query(ctx, getAll2SQL, lID) if err != nil { return nil, err } @@ -103,7 +103,7 @@ func (q *Queries) GetAll2(ctx context.Context, lID pgtype.Int4) ([]GetAll2Row, e return items, nil } -const getAll3 = `-- name: GetAll3 :many +const getAll3SQL = `-- name: GetAll3 :many select id from T where L_ID in( with recursive cte as ( select id, L_ID, F from T where T.ID =2 @@ -114,7 +114,7 @@ select id from T where L_ID in( ` func (q *Queries) GetAll3(ctx context.Context, dollar_1 pgtype.Int4) ([]int64, error) { - rows, err := q.db.Query(ctx, getAll3, dollar_1) + rows, err := q.db.Query(ctx, getAll3SQL, dollar_1) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func (q *Queries) GetAll3(ctx context.Context, dollar_1 pgtype.Int4) ([]int64, e return items, nil } -const getAll4 = `-- name: GetAll4 :many +const getAll4SQL = `-- name: GetAll4 :many select id from T where L_ID in( with recursive L as ( select id, L_ID, F from T where T.ID =2 @@ -144,7 +144,7 @@ select id from T where L_ID in( ` func (q *Queries) GetAll4(ctx context.Context, lID pgtype.Int4) ([]int64, error) { - rows, err := q.db.Query(ctx, getAll4, lID) + rows, err := q.db.Query(ctx, getAll4SQL, lID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go index 3bf45fbc2b..78e6b5ed85 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT col_a, col_b, col_c FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT col_a, col_b, col_c FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go index cbe50cff67..fc142c2c9b 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT col_a, col_b FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT col_a, col_b FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go index cbe50cff67..fc142c2c9b 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT col_a, col_b FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT col_a, col_b FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go index 69b40a8dc8..830ba7fb94 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT col_a, col_b FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT col_a, col_b FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go index 247c17182c..66b2ac8d79 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT col_a, col_b FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]Bar, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT col_a, col_b FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/datatype/mysql/go/query.sql.go b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go index 96b4633882..86a35ceb8d 100644 --- a/internal/endtoend/testdata/datatype/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go index 29ea3c7023..21788595ab 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go index 29ea3c7023..21788595ab 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go index 302372424a..71ad3cdd83 100644 --- a/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int64 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go index 96b4633882..86a35ceb8d 100644 --- a/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go index b916b596b3..3e41795e16 100644 --- a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const someQuery = `-- name: SomeQuery :many +const someQuerySQL = `-- name: SomeQuery :many select id from "computed_tables"."something" ` func (q *Queries) SomeQuery(ctx context.Context) ([]pgtype.Int4, error) { - rows, err := q.db.Query(ctx, someQuery) + rows, err := q.db.Query(ctx, someQuerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go index a197546f8a..2d8de12422 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT id, name, location, size FROM venues ` func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go index f6fb2a4b5b..feeefbce1b 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT name, location, size FROM venues ` func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go index 92690255c1..7506febb73 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT id, name, capacity, notes FROM venues ` func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go index 43e0007167..ab41e448f6 100644 --- a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertUser = `-- name: InsertUser :exec +const insertUserSQL = `-- name: InsertUser :exec INSERT INTO users (full_name, "EmailAddress", created_at) VALUES (?, ?, ?) ` @@ -22,17 +22,17 @@ type InsertUserParams struct { } func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) error { - _, err := q.db.ExecContext(ctx, insertUser, arg.FullName, arg.EmailAddress, arg.CreatedAt) + _, err := q.db.ExecContext(ctx, insertUserSQL, arg.FullName, arg.EmailAddress, arg.CreatedAt) return err } -const selectUsers = `-- name: SelectUsers :many +const selectUsersSQL = `-- name: SelectUsers :many SELECT id, full_name, "EmailAddress", created_at FROM users ` func (q *Queries) SelectUsers(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, selectUsers) + rows, err := q.db.QueryContext(ctx, selectUsersSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go index d0eefdd98e..bd23c21f09 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT id, name FROM venues ` func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go index a0b6155ece..05dcdd40cf 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT baz FROM foo ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go index ef6ecead1f..280250006b 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listArenas = `-- name: ListArenas :many +const listArenasSQL = `-- name: ListArenas :many SELECT id FROM arena ` func (q *Queries) ListArenas(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, listArenas) + rows, err := q.db.QueryContext(ctx, listArenasSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListArenas(ctx context.Context) ([]int64, error) { return items, nil } -const listVenues = `-- name: ListVenues :many +const listVenuesSQL = `-- name: ListVenues :many SELECT id FROM venue ` func (q *Queries) ListVenues(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, listVenues) + rows, err := q.db.QueryContext(ctx, listVenuesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go index e52ada4441..54c8f4840d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT name FROM arenas ` func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go index d8317bd784..3dd07193bb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const placeholder = `-- name: Placeholder :many +const placeholderSQL = `-- name: Placeholder :many SELECT boo FROM foo ` func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, placeholder) + rows, err := q.db.QueryContext(ctx, placeholderSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go index 3f12a3b6c2..e330d18874 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -10,20 +10,20 @@ import ( "database/sql" ) -const getFooBar = `-- name: GetFooBar :exec +const getFooBarSQL = `-- name: GetFooBar :exec SELECT name FROM foo.bar ` func (q *Queries) GetFooBar(ctx context.Context) error { - _, err := q.db.Exec(ctx, getFooBar) + _, err := q.db.Exec(ctx, getFooBarSQL) return err } -const updateFooBar = `-- name: UpdateFooBar :exec +const updateFooBarSQL = `-- name: UpdateFooBar :exec UPDATE foo.bar SET name = $1 ` func (q *Queries) UpdateFooBar(ctx context.Context, name sql.NullString) error { - _, err := q.db.Exec(ctx, updateFooBar, name) + _, err := q.db.Exec(ctx, updateFooBarSQL, name) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go index 6f05e298b0..73f113a9da 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -11,20 +11,20 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getFooBar = `-- name: GetFooBar :exec +const getFooBarSQL = `-- name: GetFooBar :exec SELECT name FROM foo.bar ` func (q *Queries) GetFooBar(ctx context.Context) error { - _, err := q.db.Exec(ctx, getFooBar) + _, err := q.db.Exec(ctx, getFooBarSQL) return err } -const updateFooBar = `-- name: UpdateFooBar :exec +const updateFooBarSQL = `-- name: UpdateFooBar :exec UPDATE foo.bar SET name = $1 ` func (q *Queries) UpdateFooBar(ctx context.Context, name pgtype.Text) error { - _, err := q.db.Exec(ctx, updateFooBar, name) + _, err := q.db.Exec(ctx, updateFooBarSQL, name) return err } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go index 880cfc64d0..05a4611b58 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go @@ -10,20 +10,20 @@ import ( "database/sql" ) -const getFooBar = `-- name: GetFooBar :exec +const getFooBarSQL = `-- name: GetFooBar :exec SELECT name FROM foo.bar ` func (q *Queries) GetFooBar(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, getFooBar) + _, err := q.db.ExecContext(ctx, getFooBarSQL) return err } -const updateFooBar = `-- name: UpdateFooBar :exec +const updateFooBarSQL = `-- name: UpdateFooBar :exec UPDATE foo.bar SET name = $1 ` func (q *Queries) UpdateFooBar(ctx context.Context, name sql.NullString) error { - _, err := q.db.ExecContext(ctx, updateFooBar, name) + _, err := q.db.ExecContext(ctx, updateFooBarSQL, name) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go index 7f56a7b60b..d8f9117388 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go index 7f56a7b60b..d8f9117388 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go index ac0f963c19..bf5cdbf83f 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go index 7f56a7b60b..d8f9117388 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go index 7f56a7b60b..d8f9117388 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go index ac0f963c19..bf5cdbf83f 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go index 22ba6e5467..33e402806d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status, level FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go index 22ba6e5467..33e402806d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status, level FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go index 6b9793aff1..d87d0a3b98 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, status, level FROM log_lines ` func (q *Queries) ListAuthors(ctx context.Context) ([]LogLine, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go index 1a5a73200e..079bb54bc9 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT foobar, digit FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go index 0b678224d9..100a2c0690 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT val FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go index 0b678224d9..100a2c0690 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT val FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go index 7c474a58e5..167b0c5f34 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT val FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foobar, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go index 60db046ca1..821226b7e4 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const callInsertData = `-- name: CallInsertData :exec +const callInsertDataSQL = `-- name: CallInsertData :exec CALL insert_data(?, ?) ` @@ -19,20 +19,20 @@ type CallInsertDataParams struct { } func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { - _, err := q.db.ExecContext(ctx, callInsertData, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, callInsertDataSQL, arg.A, arg.B) return err } -const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +const callInsertDataNoArgsSQL = `-- name: CallInsertDataNoArgs :exec CALL insert_data(1, 2) ` func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, callInsertDataNoArgs) + _, err := q.db.ExecContext(ctx, callInsertDataNoArgsSQL) return err } -const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +const callInsertDataSqlcArgsSQL = `-- name: CallInsertDataSqlcArgs :exec CALL insert_data(?, ?) ` @@ -42,6 +42,6 @@ type CallInsertDataSqlcArgsParams struct { } func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { - _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgsSQL, arg.Foo, arg.Bar) return err } diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go index 65ec5313d2..e162e47a11 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const callInsertData = `-- name: CallInsertData :exec +const callInsertDataSQL = `-- name: CallInsertData :exec CALL insert_data($1, $2) ` @@ -19,11 +19,11 @@ type CallInsertDataParams struct { } func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { - _, err := q.db.Exec(ctx, callInsertData, arg.A, arg.B) + _, err := q.db.Exec(ctx, callInsertDataSQL, arg.A, arg.B) return err } -const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +const callInsertDataNamedSQL = `-- name: CallInsertDataNamed :exec CALL insert_data(b => $1, a => $2) ` @@ -33,20 +33,20 @@ type CallInsertDataNamedParams struct { } func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { - _, err := q.db.Exec(ctx, callInsertDataNamed, arg.B, arg.A) + _, err := q.db.Exec(ctx, callInsertDataNamedSQL, arg.B, arg.A) return err } -const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +const callInsertDataNoArgsSQL = `-- name: CallInsertDataNoArgs :exec CALL insert_data(1, 2) ` func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { - _, err := q.db.Exec(ctx, callInsertDataNoArgs) + _, err := q.db.Exec(ctx, callInsertDataNoArgsSQL) return err } -const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +const callInsertDataSqlcArgsSQL = `-- name: CallInsertDataSqlcArgs :exec CALL insert_data($1, $2) ` @@ -56,6 +56,6 @@ type CallInsertDataSqlcArgsParams struct { } func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { - _, err := q.db.Exec(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + _, err := q.db.Exec(ctx, callInsertDataSqlcArgsSQL, arg.Foo, arg.Bar) return err } diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go index 65ec5313d2..e162e47a11 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const callInsertData = `-- name: CallInsertData :exec +const callInsertDataSQL = `-- name: CallInsertData :exec CALL insert_data($1, $2) ` @@ -19,11 +19,11 @@ type CallInsertDataParams struct { } func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { - _, err := q.db.Exec(ctx, callInsertData, arg.A, arg.B) + _, err := q.db.Exec(ctx, callInsertDataSQL, arg.A, arg.B) return err } -const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +const callInsertDataNamedSQL = `-- name: CallInsertDataNamed :exec CALL insert_data(b => $1, a => $2) ` @@ -33,20 +33,20 @@ type CallInsertDataNamedParams struct { } func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { - _, err := q.db.Exec(ctx, callInsertDataNamed, arg.B, arg.A) + _, err := q.db.Exec(ctx, callInsertDataNamedSQL, arg.B, arg.A) return err } -const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +const callInsertDataNoArgsSQL = `-- name: CallInsertDataNoArgs :exec CALL insert_data(1, 2) ` func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { - _, err := q.db.Exec(ctx, callInsertDataNoArgs) + _, err := q.db.Exec(ctx, callInsertDataNoArgsSQL) return err } -const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +const callInsertDataSqlcArgsSQL = `-- name: CallInsertDataSqlcArgs :exec CALL insert_data($1, $2) ` @@ -56,6 +56,6 @@ type CallInsertDataSqlcArgsParams struct { } func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { - _, err := q.db.Exec(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + _, err := q.db.Exec(ctx, callInsertDataSqlcArgsSQL, arg.Foo, arg.Bar) return err } diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go index 8a4bc9a6c5..d6439b325c 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const callInsertData = `-- name: CallInsertData :exec +const callInsertDataSQL = `-- name: CallInsertData :exec CALL insert_data($1, $2) ` @@ -19,11 +19,11 @@ type CallInsertDataParams struct { } func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { - _, err := q.db.ExecContext(ctx, callInsertData, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, callInsertDataSQL, arg.A, arg.B) return err } -const callInsertDataNamed = `-- name: CallInsertDataNamed :exec +const callInsertDataNamedSQL = `-- name: CallInsertDataNamed :exec CALL insert_data(b => $1, a => $2) ` @@ -33,20 +33,20 @@ type CallInsertDataNamedParams struct { } func (q *Queries) CallInsertDataNamed(ctx context.Context, arg CallInsertDataNamedParams) error { - _, err := q.db.ExecContext(ctx, callInsertDataNamed, arg.B, arg.A) + _, err := q.db.ExecContext(ctx, callInsertDataNamedSQL, arg.B, arg.A) return err } -const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +const callInsertDataNoArgsSQL = `-- name: CallInsertDataNoArgs :exec CALL insert_data(1, 2) ` func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, callInsertDataNoArgs) + _, err := q.db.ExecContext(ctx, callInsertDataNoArgsSQL) return err } -const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +const callInsertDataSqlcArgsSQL = `-- name: CallInsertDataSqlcArgs :exec CALL insert_data($1, $2) ` @@ -56,6 +56,6 @@ type CallInsertDataSqlcArgsParams struct { } func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { - _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgsSQL, arg.Foo, arg.Bar) return err } diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go index 4e956ff8fe..20f9e48597 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAllOrganisations = `-- name: GetAllOrganisations :many +const getAllOrganisationsSQL = `-- name: GetAllOrganisations :many SELECT party_id, name, legal_name FROM organisation ` func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { - rows, err := q.db.Query(ctx, getAllOrganisations) + rows, err := q.db.Query(ctx, getAllOrganisationsSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, erro return items, nil } -const getAllParties = `-- name: GetAllParties :many +const getAllPartiesSQL = `-- name: GetAllParties :many SELECT party_id, name FROM party ` func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { - rows, err := q.db.Query(ctx, getAllParties) + rows, err := q.db.Query(ctx, getAllPartiesSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { return items, nil } -const getAllPeople = `-- name: GetAllPeople :many +const getAllPeopleSQL = `-- name: GetAllPeople :many SELECT party_id, name, first_name, last_name FROM person ` func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { - rows, err := q.db.Query(ctx, getAllPeople) + rows, err := q.db.Query(ctx, getAllPeopleSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go index 4e956ff8fe..20f9e48597 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAllOrganisations = `-- name: GetAllOrganisations :many +const getAllOrganisationsSQL = `-- name: GetAllOrganisations :many SELECT party_id, name, legal_name FROM organisation ` func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { - rows, err := q.db.Query(ctx, getAllOrganisations) + rows, err := q.db.Query(ctx, getAllOrganisationsSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, erro return items, nil } -const getAllParties = `-- name: GetAllParties :many +const getAllPartiesSQL = `-- name: GetAllParties :many SELECT party_id, name FROM party ` func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { - rows, err := q.db.Query(ctx, getAllParties) + rows, err := q.db.Query(ctx, getAllPartiesSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { return items, nil } -const getAllPeople = `-- name: GetAllPeople :many +const getAllPeopleSQL = `-- name: GetAllPeople :many SELECT party_id, name, first_name, last_name FROM person ` func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { - rows, err := q.db.Query(ctx, getAllPeople) + rows, err := q.db.Query(ctx, getAllPeopleSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go index 797e41c58c..73be0c2943 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAllOrganisations = `-- name: GetAllOrganisations :many +const getAllOrganisationsSQL = `-- name: GetAllOrganisations :many SELECT party_id, name, legal_name FROM organisation ` func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, error) { - rows, err := q.db.QueryContext(ctx, getAllOrganisations) + rows, err := q.db.QueryContext(ctx, getAllOrganisationsSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) GetAllOrganisations(ctx context.Context) ([]Organisation, erro return items, nil } -const getAllParties = `-- name: GetAllParties :many +const getAllPartiesSQL = `-- name: GetAllParties :many SELECT party_id, name FROM party ` func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { - rows, err := q.db.QueryContext(ctx, getAllParties) + rows, err := q.db.QueryContext(ctx, getAllPartiesSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) GetAllParties(ctx context.Context) ([]Party, error) { return items, nil } -const getAllPeople = `-- name: GetAllPeople :many +const getAllPeopleSQL = `-- name: GetAllPeople :many SELECT party_id, name, first_name, last_name FROM person ` func (q *Queries) GetAllPeople(ctx context.Context) ([]Person, error) { - rows, err := q.db.QueryContext(ctx, getAllPeople) + rows, err := q.db.QueryContext(ctx, getAllPeopleSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go index c399414100..5f6fbf2d60 100644 --- a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const allRanked = `-- name: AllRanked :many +const allRankedSQL = `-- name: AllRanked :many SELECT ranked, rank_by_effect_size, rank_by_abs_percent_change FROM changes_ranked ` func (q *Queries) AllRanked(ctx context.Context) ([]ChangesRanked, error) { - rows, err := q.db.Query(ctx, allRanked) + rows, err := q.db.Query(ctx, allRankedSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go index 8a2db174a7..a0a14e1fd5 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.Exec(ctx, placeholder) + _, err := q.db.Exec(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go index cb67855dbb..fe7b87cd30 100644 --- a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthorMv = `-- name: GetAuthorMv :one +const getAuthorMvSQL = `-- name: GetAuthorMv :one SELECT id, name, bio FROM authors_mv WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { - row := q.db.QueryRow(ctx, getAuthorMv, id) + row := q.db.QueryRow(ctx, getAuthorMvSQL, id) var i AuthorsMv err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go index cb67855dbb..fe7b87cd30 100644 --- a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthorMv = `-- name: GetAuthorMv :one +const getAuthorMvSQL = `-- name: GetAuthorMv :one SELECT id, name, bio FROM authors_mv WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { - row := q.db.QueryRow(ctx, getAuthorMv, id) + row := q.db.QueryRow(ctx, getAuthorMvSQL, id) var i AuthorsMv err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go index 34ff922f61..1124b1c255 100644 --- a/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const listAlbums = `-- name: ListAlbums :many +const listAlbumsSQL = `-- name: ListAlbums :many SELECT singer_id, album_id, title, created_at FROM albums WHERE singer_id = @singer_id ` func (q *Queries) ListAlbums(ctx context.Context, singerID int64) ([]Album, error) { - rows, err := q.db.QueryContext(ctx, listAlbums, sql.Named("singer_id", singerID)) + rows, err := q.db.QueryContext(ctx, listAlbumsSQL, sql.Named("singer_id", singerID)) if err != nil { return nil, err } @@ -42,12 +42,12 @@ func (q *Queries) ListAlbums(ctx context.Context, singerID int64) ([]Album, erro return items, nil } -const listSingers = `-- name: ListSingers :many +const listSingersSQL = `-- name: ListSingers :many SELECT singer_id, first_name, last_name, full_name, active, updated_at FROM singers ` func (q *Queries) ListSingers(ctx context.Context) ([]Singer, error) { - rows, err := q.db.QueryContext(ctx, listSingers) + rows, err := q.db.QueryContext(ctx, listSingersSQL) if err != nil { return nil, err } @@ -76,12 +76,12 @@ func (q *Queries) ListSingers(ctx context.Context) ([]Singer, error) { return items, nil } -const listTickets = `-- name: ListTickets :many +const listTicketsSQL = `-- name: ListTickets :many SELECT ticket_id, singer_id, seat_id, embedding FROM tickets ` func (q *Queries) ListTickets(ctx context.Context) ([]Ticket, error) { - rows, err := q.db.QueryContext(ctx, listTickets) + rows, err := q.db.QueryContext(ctx, listTicketsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go index a314078bdd..6bff251f01 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const deleteFrom = `-- name: DeleteFrom :exec +const deleteFromSQL = `-- name: DeleteFrom :exec DELETE FROM foo WHERE id = ? ` func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.ExecContext(ctx, deleteFrom, id) + _, err := q.db.ExecContext(ctx, deleteFromSQL, id) return err } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go index e23a77b11b..b2ee68f3a6 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const deleteFrom = `-- name: DeleteFrom :exec +const deleteFromSQL = `-- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1 ` func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.Exec(ctx, deleteFrom, id) + _, err := q.db.Exec(ctx, deleteFromSQL, id) return err } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go index e23a77b11b..b2ee68f3a6 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const deleteFrom = `-- name: DeleteFrom :exec +const deleteFromSQL = `-- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1 ` func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.Exec(ctx, deleteFrom, id) + _, err := q.db.Exec(ctx, deleteFromSQL, id) return err } diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go index f489dfe95c..f644e03a7e 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const deleteFrom = `-- name: DeleteFrom :exec +const deleteFromSQL = `-- name: DeleteFrom :exec DELETE FROM foo WHERE id = $1 ` func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.ExecContext(ctx, deleteFrom, id) + _, err := q.db.ExecContext(ctx, deleteFromSQL, id) return err } diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go index a314078bdd..6bff251f01 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const deleteFrom = `-- name: DeleteFrom :exec +const deleteFromSQL = `-- name: DeleteFrom :exec DELETE FROM foo WHERE id = ? ` func (q *Queries) DeleteFrom(ctx context.Context, id string) error { - _, err := q.db.ExecContext(ctx, deleteFrom, id) + _, err := q.db.ExecContext(ctx, deleteFromSQL, id) return err } diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go index 9755fc008b..31a514bfbb 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const removeAllAuthorsFromTheGreatGatsby = `-- name: RemoveAllAuthorsFromTheGreatGatsby :exec +const removeAllAuthorsFromTheGreatGatsbySQL = `-- name: RemoveAllAuthorsFromTheGreatGatsby :exec DELETE author_book FROM author_book @@ -19,6 +19,6 @@ WHERE ` func (q *Queries) RemoveAllAuthorsFromTheGreatGatsby(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, removeAllAuthorsFromTheGreatGatsby) + _, err := q.db.ExecContext(ctx, removeAllAuthorsFromTheGreatGatsbySQL) return err } diff --git a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go index 8af3119a9c..4928f6c32c 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteJoin = `-- name: DeleteJoin :exec +const deleteJoinSQL = `-- name: DeleteJoin :exec DELETE jt.*, pt.* FROM @@ -26,22 +26,22 @@ type DeleteJoinParams struct { } func (q *Queries) DeleteJoin(ctx context.Context, arg DeleteJoinParams) error { - _, err := q.db.ExecContext(ctx, deleteJoin, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, deleteJoinSQL, arg.ID, arg.UserID) return err } -const deleteJoinWithSubquery = `-- name: DeleteJoinWithSubquery :exec +const deleteJoinWithSubquerySQL = `-- name: DeleteJoinWithSubquery :exec DELETE pt FROM primary_table pt JOIN (SELECT 1 as id) jt ON pt.id = jt.id ` func (q *Queries) DeleteJoinWithSubquery(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, deleteJoinWithSubquery) + _, err := q.db.ExecContext(ctx, deleteJoinWithSubquerySQL) return err } -const deleteLeftJoin = `-- name: DeleteLeftJoin :exec +const deleteLeftJoinSQL = `-- name: DeleteLeftJoin :exec DELETE jt.*, pt.* FROM @@ -58,11 +58,11 @@ type DeleteLeftJoinParams struct { } func (q *Queries) DeleteLeftJoin(ctx context.Context, arg DeleteLeftJoinParams) error { - _, err := q.db.ExecContext(ctx, deleteLeftJoin, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, deleteLeftJoinSQL, arg.ID, arg.UserID) return err } -const deleteRightJoin = `-- name: DeleteRightJoin :exec +const deleteRightJoinSQL = `-- name: DeleteRightJoin :exec DELETE jt.*, pt.* FROM @@ -79,6 +79,6 @@ type DeleteRightJoinParams struct { } func (q *Queries) DeleteRightJoin(ctx context.Context, arg DeleteRightJoinParams) error { - _, err := q.db.ExecContext(ctx, deleteRightJoin, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, deleteRightJoinSQL, arg.ID, arg.UserID) return err } diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go index 0e5ca9c70d..fa4983d218 100644 --- a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getSomeDeletedNotOk = `-- name: GetSomeDeletedNotOk :many +const getSomeDeletedNotOkSQL = `-- name: GetSomeDeletedNotOk :many DELETE FROM a USING b WHERE a.b_id_fk = b.b_id @@ -19,7 +19,7 @@ RETURNING b.b_id ` func (q *Queries) GetSomeDeletedNotOk(ctx context.Context) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, getSomeDeletedNotOk) + rows, err := q.db.Query(ctx, getSomeDeletedNotOkSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/diff_no_output/go/query.sql.go b/internal/endtoend/testdata/diff_no_output/go/query.sql.go index 06188537ee..0fc9b84192 100644 --- a/internal/endtoend/testdata/diff_no_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_no_output/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -25,31 +25,31 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY bio ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -71,12 +71,12 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { return items, nil } -const selectOne = `-- name: SelectOne :one +const selectOneSQL = `-- name: SelectOne :one SELECT 1 ` func (q *Queries) SelectOne(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, selectOne) + row := q.db.QueryRowContext(ctx, selectOneSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/diff_output/go/query.sql.go b/internal/endtoend/testdata/diff_output/go/query.sql.go index 3024509385..395721f977 100644 --- a/internal/endtoend/testdata/diff_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_output/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -25,41 +25,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/diff_output/stderr.txt b/internal/endtoend/testdata/diff_output/stderr.txt index e7e455436e..92518e7307 100644 --- a/internal/endtoend/testdata/diff_output/stderr.txt +++ b/internal/endtoend/testdata/diff_output/stderr.txt @@ -15,22 +15,22 @@ return i, err } --const deleteAuthor = `-- name: DeleteAuthor :exec +-const deleteAuthorSQL = `-- name: DeleteAuthor :exec -DELETE FROM authors -WHERE id = $1 -` - -func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { -- _, err := q.db.ExecContext(ctx, deleteAuthor, id) +- _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) - return err -} - - const getAuthor = `-- name: GetAuthor :one + const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 @@ -55,7 +45,7 @@ - const listAuthors = `-- name: ListAuthors :many + const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors +ORDER BY bio -ORDER BY name @@ -42,12 +42,12 @@ return items, nil } + -+const selectOne = `-- name: SelectOne :one ++const selectOneSQL = `-- name: SelectOne :one +SELECT 1 +` + +func (q *Queries) SelectOne(ctx context.Context) (int32, error) { -+ row := q.db.QueryRowContext(ctx, selectOne) ++ row := q.db.QueryRowContext(ctx, selectOneSQL) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go index 06e1c1e75b..6c20eaa1e2 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const doStuff = `-- name: DoStuff :exec +const doStuffSQL = `-- name: DoStuff :exec DO $$ BEGIN ALTER TABLE authors @@ -19,6 +19,6 @@ $$ ` func (q *Queries) DoStuff(ctx context.Context) error { - _, err := q.db.Exec(ctx, doStuff) + _, err := q.db.Exec(ctx, doStuffSQL) return err } diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go index 5d7824c46e..ec7a5026c9 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const doStuff = `-- name: DoStuff :exec +const doStuffSQL = `-- name: DoStuff :exec DO $$ BEGIN ALTER TABLE authors @@ -19,6 +19,6 @@ $$ ` func (q *Queries) DoStuff(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, doStuff) + _, err := q.db.ExecContext(ctx, doStuffSQL) return err } diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go b/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go index 75cce3477f..31f54a3852 100644 --- a/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go +++ b/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createEvent = `-- name: CreateEvent :exec +const createEventSQL = `-- name: CreateEvent :exec INSERT INTO events (id, payload, meta) VALUES ($1, $2, $3); ` @@ -21,11 +21,11 @@ type CreateEventParams struct { } func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) error { - _, err := q.db.ExecContext(ctx, createEvent, arg.ID, arg.Payload, arg.Meta) + _, err := q.db.ExecContext(ctx, createEventSQL, arg.ID, arg.Payload, arg.Meta) return err } -const eventKind = `-- name: EventKind :one +const eventKindSQL = `-- name: EventKind :one SELECT json_extract(payload, '$.kind') AS kind, json_extract_string(payload, '$.kind') AS kind_text FROM events WHERE id = $1; ` @@ -36,18 +36,18 @@ type EventKindRow struct { } func (q *Queries) EventKind(ctx context.Context, id int32) (EventKindRow, error) { - row := q.db.QueryRowContext(ctx, eventKind, id) + row := q.db.QueryRowContext(ctx, eventKindSQL, id) var i EventKindRow err := row.Scan(&i.Kind, &i.KindText) return i, err } -const eventsByPayload = `-- name: EventsByPayload :many +const eventsByPayloadSQL = `-- name: EventsByPayload :many SELECT id FROM events WHERE payload = $1; ` func (q *Queries) EventsByPayload(ctx context.Context, payload string) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, eventsByPayload, payload) + rows, err := q.db.QueryContext(ctx, eventsByPayloadSQL, payload) if err != nil { return nil, err } @@ -69,23 +69,23 @@ func (q *Queries) EventsByPayload(ctx context.Context, payload string) ([]int32, return items, nil } -const getEvent = `-- name: GetEvent :one +const getEventSQL = `-- name: GetEvent :one SELECT id, payload, meta FROM events WHERE id = $1; ` func (q *Queries) GetEvent(ctx context.Context, id int32) (Event, error) { - row := q.db.QueryRowContext(ctx, getEvent, id) + row := q.db.QueryRowContext(ctx, getEventSQL, id) var i Event err := row.Scan(&i.ID, &i.Payload, &i.Meta) return i, err } -const payloadText = `-- name: PayloadText :one +const payloadTextSQL = `-- name: PayloadText :one SELECT CAST(payload AS VARCHAR) AS payload_text FROM events WHERE id = $1; ` func (q *Queries) PayloadText(ctx context.Context, id int32) (string, error) { - row := q.db.QueryRowContext(ctx, payloadText, id) + row := q.db.QueryRowContext(ctx, payloadTextSQL, id) var payload_text string err := row.Scan(&payload_text) return payload_text, err diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/db/db.go b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/db/models.go b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/models.go new file mode 100644 index 0000000000..5e50e88a95 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/models.go @@ -0,0 +1,49 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql/driver" + "fmt" +) + +type Foo string + +const () + +func (e *Foo) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = Foo(s) + case string: + *e = Foo(s) + default: + return fmt.Errorf("unsupported scan type for Foo: %T", src) + } + return nil +} + +type NullFoo struct { + Foo Foo + Valid bool // Valid is true if Foo is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFoo) Scan(value any) error { + if value == nil { + ns.Foo, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Foo.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFoo) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Foo), nil +} diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/db/query.sql.go b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/query.sql.go new file mode 100644 index 0000000000..55aa43b27e --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" +) + +const FooSQL = `-- name: Foo :one +SELECT 1 +` + +func (q *Queries) Foo(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, FooSQL) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt deleted file mode 100644 index 1a9b5f80b5..0000000000 --- a/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package -error generating code: query constant name conflicts with enum name: Foo diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go index aa7c5c0112..f39177fb70 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go index aa7c5c0112..f39177fb70 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go index aa7c5c0112..f39177fb70 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go index aa7c5c0112..f39177fb70 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go index f589654638..b1e2a4b099 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go index 0ba10beb98..a026f3110a 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go index 0ba10beb98..a026f3110a 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go index 5d4efe1719..2878d04151 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go index 98787cd712..40a90d807e 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -50,7 +50,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.Query(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go index 6992864769..93481ca046 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const UpdateBarID = `-- name: UpdateBarID :exec +const UpdateBarIDSQL = `-- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2 ` @@ -19,6 +19,6 @@ type UpdateBarIDParams struct { } func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { - _, err := q.db.Exec(ctx, UpdateBarID, arg.ID, arg.ID_2) + _, err := q.db.Exec(ctx, UpdateBarIDSQL, arg.ID, arg.ID_2) return err } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go index 6992864769..93481ca046 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const UpdateBarID = `-- name: UpdateBarID :exec +const UpdateBarIDSQL = `-- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2 ` @@ -19,6 +19,6 @@ type UpdateBarIDParams struct { } func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { - _, err := q.db.Exec(ctx, UpdateBarID, arg.ID, arg.ID_2) + _, err := q.db.Exec(ctx, UpdateBarIDSQL, arg.ID, arg.ID_2) return err } diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go index 3863b2b816..0fc7335ee2 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const UpdateBarID = `-- name: UpdateBarID :exec +const UpdateBarIDSQL = `-- name: UpdateBarID :exec UPDATE bar SET id = $1 WHERE id = $2 ` @@ -19,6 +19,6 @@ type UpdateBarIDParams struct { } func (q *Queries) UpdateBarID(ctx context.Context, arg UpdateBarIDParams) error { - _, err := q.db.ExecContext(ctx, UpdateBarID, arg.ID, arg.ID_2) + _, err := q.db.ExecContext(ctx, UpdateBarIDSQL, arg.ID, arg.ID_2) return err } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go index 4dc2b1c98d..21dd119fee 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.QueryContext(ctx, getAll) + rows, err := db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go index 6972686105..f1f9361cbb 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.Query(ctx, getAll) + rows, err := db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go index 6972686105..f1f9361cbb 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.Query(ctx, getAll) + rows, err := db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go index 4dc2b1c98d..21dd119fee 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.QueryContext(ctx, getAll) + rows, err := db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go index 4dc2b1c98d..21dd119fee 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.QueryContext(ctx, getAll) + rows, err := db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go index c3459e46dc..64c7059d4a 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role, required_role, name FROM users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go index c8928aad1a..b7f3cb9149 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role, required_role FROM users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role NullUserRole) ([]User, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go index 0ba72bc7fd..9a3b3e0047 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role, required_role FROM users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go index 72afc38d12..b895f9676e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const createUser = `-- name: CreateUser :exec +const createUserSQL = `-- name: CreateUser :exec INSERT INTO users (role, required_role, status) VALUES ($1, $2, $3) ` @@ -20,16 +20,16 @@ type CreateUserParams struct { } func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error { - _, err := q.db.Exec(ctx, createUser, arg.Role, arg.RequiredRole, arg.Status) + _, err := q.db.Exec(ctx, createUserSQL, arg.Role, arg.RequiredRole, arg.Status) return err } -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role, required_role, status FROM users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go index 29ea3c7023..21788595ab 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go index 29ea3c7023..21788595ab 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go index b8250f95de..b9d68c413a 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const noop = `-- name: Noop :one +const noopSQL = `-- name: Noop :one SELECT 1 ` func (q *Queries) Noop(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, noop) + row := q.db.QueryRowContext(ctx, noopSQL) var column_1 int64 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go index 96b4633882..86a35ceb8d 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go index e36af84dd6..431401a267 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT a, b FROM foo ` func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { return items, nil } -const getAllAByB = `-- name: GetAllAByB :many +const getAllAByBSQL = `-- name: GetAllAByB :many SELECT a FROM foo WHERE b = ? ` func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullInt32, error) { - rows, err := q.db.QueryContext(ctx, getAllAByB, b) + rows, err := q.db.QueryContext(ctx, getAllAByBSQL, b) if err != nil { return nil, err } @@ -64,7 +64,7 @@ func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullIn return items, nil } -const getOne = `-- name: GetOne :one +const getOneSQL = `-- name: GetOne :one SELECT a, b FROM foo WHERE a = ? AND b = ? LIMIT 1 ` @@ -74,7 +74,7 @@ type GetOneParams struct { } func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { - row := q.db.QueryRowContext(ctx, getOne, arg.A, arg.B) + row := q.db.QueryRowContext(ctx, getOneSQL, arg.A, arg.B) var i Foo err := row.Scan(&i.A, &i.B) return &i, err diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go index 90195fa4cd..0158ccf0dd 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO foo (a, b) VALUES ($1, $2) ON CONFLICT DO NOTHING @@ -42,7 +42,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) * a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go index 63eca2afd1..bace6d305d 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT a, b FROM foo ` func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -34,12 +34,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { return items, nil } -const getAllAByB = `-- name: GetAllAByB :many +const getAllAByBSQL = `-- name: GetAllAByB :many SELECT a FROM foo WHERE b = $1 ` func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullInt32, error) { - rows, err := q.db.Query(ctx, getAllAByB, b) + rows, err := q.db.Query(ctx, getAllAByBSQL, b) if err != nil { return nil, err } @@ -58,7 +58,7 @@ func (q *Queries) GetAllAByB(ctx context.Context, b sql.NullInt32) ([]sql.NullIn return items, nil } -const getOne = `-- name: GetOne :one +const getOneSQL = `-- name: GetOne :one SELECT a, b FROM foo WHERE a = $1 AND b = $2 LIMIT 1 ` @@ -68,7 +68,7 @@ type GetOneParams struct { } func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { - row := q.db.QueryRow(ctx, getOne, arg.A, arg.B) + row := q.db.QueryRow(ctx, getOneSQL, arg.A, arg.B) var i Foo err := row.Scan(&i.A, &i.B) return &i, err diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go index 8f9c369c5e..e3fca6d350 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go @@ -17,7 +17,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const insertValues = `-- name: InsertValues :batchone +const insertValuesSQL = `-- name: InsertValues :batchone INSERT INTO foo (a, b) VALUES ($1, $2) ON CONFLICT DO NOTHING @@ -42,7 +42,7 @@ func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) * a.A, a.B, } - batch.Queue(insertValues, vals...) + batch.Queue(insertValuesSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &InsertValuesBatchResults{br, len(arg), false} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go index 4b927ee755..318f50c328 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT a, b FROM foo ` func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -35,12 +35,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) { return items, nil } -const getAllAByB = `-- name: GetAllAByB :many +const getAllAByBSQL = `-- name: GetAllAByB :many SELECT a FROM foo WHERE b = $1 ` func (q *Queries) GetAllAByB(ctx context.Context, b pgtype.Int4) ([]pgtype.Int4, error) { - rows, err := q.db.Query(ctx, getAllAByB, b) + rows, err := q.db.Query(ctx, getAllAByBSQL, b) if err != nil { return nil, err } @@ -59,7 +59,7 @@ func (q *Queries) GetAllAByB(ctx context.Context, b pgtype.Int4) ([]pgtype.Int4, return items, nil } -const getOne = `-- name: GetOne :one +const getOneSQL = `-- name: GetOne :one SELECT a, b FROM foo WHERE a = $1 AND b = $2 LIMIT 1 ` @@ -69,7 +69,7 @@ type GetOneParams struct { } func (q *Queries) GetOne(ctx context.Context, arg *GetOneParams) (*Foo, error) { - row := q.db.QueryRow(ctx, getOne, arg.A, arg.B) + row := q.db.QueryRow(ctx, getOneSQL, arg.A, arg.B) var i Foo err := row.Scan(&i.A, &i.B) return &i, err diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go index b3da6e1539..9af249c2a5 100644 --- a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM ( SELECT id FROM bar ) bar @@ -21,7 +21,7 @@ SELECT id FROM ( // SELECT id FROM bar // ) bar func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { return items, nil } -const removeBar = `-- name: RemoveBar :exec +const removeBarSQL = `-- name: RemoveBar :exec DELETE FROM bar WHERE id = $1 ` @@ -51,6 +51,6 @@ DELETE FROM bar WHERE id = $1 // // DELETE FROM bar WHERE id = $1 func (q *Queries) RemoveBar(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, removeBar, id) + _, err := q.db.ExecContext(ctx, removeBarSQL, id) return err } diff --git a/internal/endtoend/testdata/enum/mysql/go/query.sql.go b/internal/endtoend/testdata/enum/mysql/go/query.sql.go index 8285426162..d664da046f 100644 --- a/internal/endtoend/testdata/enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/enum/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteBySize = `-- name: DeleteBySize :exec +const deleteBySizeSQL = `-- name: DeleteBySize :exec DELETE FROM users WHERE shoe_size = ? AND shirt_size = ? ` @@ -21,16 +21,16 @@ type DeleteBySizeParams struct { } func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { - _, err := db.ExecContext(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + _, err := db.ExecContext(ctx, deleteBySizeSQL, arg.ShoeSize, arg.ShirtSize) return err } -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.QueryContext(ctx, getAll) + rows, err := db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -59,7 +59,7 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { return items, nil } -const newUser = `-- name: NewUser :exec +const newUserSQL = `-- name: NewUser :exec INSERT INTO users ( id, first_name, @@ -81,7 +81,7 @@ type NewUserParams struct { } func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { - _, err := db.ExecContext(ctx, newUser, + _, err := db.ExecContext(ctx, newUserSQL, arg.ID, arg.FirstName, arg.LastName, @@ -92,7 +92,7 @@ func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error return err } -const updateSizes = `-- name: UpdateSizes :exec +const updateSizesSQL = `-- name: UpdateSizes :exec UPDATE users SET shoe_size = ?, shirt_size = ? WHERE id = ? @@ -105,6 +105,6 @@ type UpdateSizesParams struct { } func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { - _, err := db.ExecContext(ctx, updateSizes, arg.ShoeSize, arg.ShirtSize, arg.ID) + _, err := db.ExecContext(ctx, updateSizesSQL, arg.ShoeSize, arg.ShirtSize, arg.ID) return err } diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go index c5d026827f..54aa4c5a06 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteBySize = `-- name: DeleteBySize :exec +const deleteBySizeSQL = `-- name: DeleteBySize :exec DELETE FROM users WHERE shoe_size = $1 AND shirt_size = $2 ` @@ -21,16 +21,16 @@ type DeleteBySizeParams struct { } func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { - _, err := db.Exec(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + _, err := db.Exec(ctx, deleteBySizeSQL, arg.ShoeSize, arg.ShirtSize) return err } -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.Query(ctx, getAll) + rows, err := db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { return items, nil } -const newUser = `-- name: NewUser :exec +const newUserSQL = `-- name: NewUser :exec INSERT INTO users ( first_name, last_name, @@ -76,7 +76,7 @@ type NewUserParams struct { } func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { - _, err := db.Exec(ctx, newUser, + _, err := db.Exec(ctx, newUserSQL, arg.FirstName, arg.LastName, arg.Age, @@ -86,7 +86,7 @@ func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error return err } -const updateSizes = `-- name: UpdateSizes :exec +const updateSizesSQL = `-- name: UpdateSizes :exec UPDATE users SET shoe_size = $2, shirt_size = $3 WHERE id = $1 @@ -99,6 +99,6 @@ type UpdateSizesParams struct { } func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { - _, err := db.Exec(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + _, err := db.Exec(ctx, updateSizesSQL, arg.ID, arg.ShoeSize, arg.ShirtSize) return err } diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go index f26449a7f5..999cfbab8e 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const deleteBySize = `-- name: DeleteBySize :exec +const deleteBySizeSQL = `-- name: DeleteBySize :exec DELETE FROM users WHERE shoe_size = $1 AND shirt_size = $2 ` @@ -22,16 +22,16 @@ type DeleteBySizeParams struct { } func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { - _, err := db.Exec(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + _, err := db.Exec(ctx, deleteBySizeSQL, arg.ShoeSize, arg.ShirtSize) return err } -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.Query(ctx, getAll) + rows, err := db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { return items, nil } -const newUser = `-- name: NewUser :exec +const newUserSQL = `-- name: NewUser :exec INSERT INTO users ( first_name, last_name, @@ -77,7 +77,7 @@ type NewUserParams struct { } func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { - _, err := db.Exec(ctx, newUser, + _, err := db.Exec(ctx, newUserSQL, arg.FirstName, arg.LastName, arg.Age, @@ -87,7 +87,7 @@ func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error return err } -const updateSizes = `-- name: UpdateSizes :exec +const updateSizesSQL = `-- name: UpdateSizes :exec UPDATE users SET shoe_size = $2, shirt_size = $3 WHERE id = $1 @@ -100,6 +100,6 @@ type UpdateSizesParams struct { } func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { - _, err := db.Exec(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + _, err := db.Exec(ctx, updateSizesSQL, arg.ID, arg.ShoeSize, arg.ShirtSize) return err } diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go index 7c6eefe6e4..a74156d7cb 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteBySize = `-- name: DeleteBySize :exec +const deleteBySizeSQL = `-- name: DeleteBySize :exec DELETE FROM users WHERE shoe_size = $1 AND shirt_size = $2 ` @@ -21,16 +21,16 @@ type DeleteBySizeParams struct { } func (q *Queries) DeleteBySize(ctx context.Context, db DBTX, arg DeleteBySizeParams) error { - _, err := db.ExecContext(ctx, deleteBySize, arg.ShoeSize, arg.ShirtSize) + _, err := db.ExecContext(ctx, deleteBySizeSQL, arg.ShoeSize, arg.ShirtSize) return err } -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age, shoe_size, shirt_size FROM users ` func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { - rows, err := db.QueryContext(ctx, getAll) + rows, err := db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -59,7 +59,7 @@ func (q *Queries) GetAll(ctx context.Context, db DBTX) ([]User, error) { return items, nil } -const newUser = `-- name: NewUser :exec +const newUserSQL = `-- name: NewUser :exec INSERT INTO users ( first_name, last_name, @@ -79,7 +79,7 @@ type NewUserParams struct { } func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error { - _, err := db.ExecContext(ctx, newUser, + _, err := db.ExecContext(ctx, newUserSQL, arg.FirstName, arg.LastName, arg.Age, @@ -89,7 +89,7 @@ func (q *Queries) NewUser(ctx context.Context, db DBTX, arg NewUserParams) error return err } -const updateSizes = `-- name: UpdateSizes :exec +const updateSizesSQL = `-- name: UpdateSizes :exec UPDATE users SET shoe_size = $2, shirt_size = $3 WHERE id = $1 @@ -102,6 +102,6 @@ type UpdateSizesParams struct { } func (q *Queries) UpdateSizes(ctx context.Context, db DBTX, arg UpdateSizesParams) error { - _, err := db.ExecContext(ctx, updateSizes, arg.ID, arg.ShoeSize, arg.ShirtSize) + _, err := db.ExecContext(ctx, updateSizesSQL, arg.ID, arg.ShoeSize, arg.ShirtSize) return err } diff --git a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go index 9932531a90..b1b1d0de6e 100644 --- a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, foo, bar, added, add_item, remove_item FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -43,12 +43,12 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { return items, nil } -const listBooks = `-- name: ListBooks :many +const listBooksSQL = `-- name: ListBooks :many SELECT id, foo FROM books ` func (q *Queries) ListBooks(ctx context.Context) ([]Book, error) { - rows, err := q.db.QueryContext(ctx, listBooks) + rows, err := q.db.QueryContext(ctx, listBooksSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go index 84b460c645..41579fc0b7 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id FROM foo ` func (q *Queries) GetAll(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go index 99fbd91476..2b5d07614f 100644 --- a/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const createTable = `-- name: CreateTable :exec +const createTableSQL = `-- name: CreateTable :exec CREATE TABLE test (id INTEGER NOT NULL) ` func (q *Queries) CreateTable(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, createTable) + _, err := q.db.ExecContext(ctx, createTableSQL) return err } diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go index 0d5b9d8070..6d4ede28cb 100644 --- a/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const createTable = `-- name: CreateTable :exec +const createTableSQL = `-- name: CreateTable :exec CREATE TABLE test (id INTEGER NOT NULL) ` func (q *Queries) CreateTable(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, createTable) + _, err := q.db.ExecContext(ctx, createTableSQL) return err } diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go index c80f32b7a0..9af0ba21a0 100644 --- a/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const createTable = `-- name: CreateTable :exec +const createTableSQL = `-- name: CreateTable :exec CREATE TABLE test (id INTEGER NOT NULL) ` func (q *Queries) CreateTable(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, createTable) + _, err := q.db.ExecContext(ctx, createTableSQL) return err } diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go index c505de5a81..6a20b73343 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go @@ -9,22 +9,22 @@ import ( "context" ) -const bar = `-- name: Bar :exec +const barSQL = `-- name: Bar :exec SELECT bar FROM foo ` func (q *Queries) Bar(ctx context.Context) error { - _, err := q.db.Exec(ctx, bar) + _, err := q.db.Exec(ctx, barSQL) return err } -const bars = `-- name: Bars :exec +const barsSQL = `-- name: Bars :exec SELECT bars FROM foo ` func (q *Queries) Bars(ctx context.Context) error { - _, err := q.db.Exec(ctx, bars) + _, err := q.db.Exec(ctx, barsSQL) return err } diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go index c505de5a81..6a20b73343 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go @@ -9,22 +9,22 @@ import ( "context" ) -const bar = `-- name: Bar :exec +const barSQL = `-- name: Bar :exec SELECT bar FROM foo ` func (q *Queries) Bar(ctx context.Context) error { - _, err := q.db.Exec(ctx, bar) + _, err := q.db.Exec(ctx, barSQL) return err } -const bars = `-- name: Bars :exec +const barsSQL = `-- name: Bars :exec SELECT bars FROM foo ` func (q *Queries) Bars(ctx context.Context) error { - _, err := q.db.Exec(ctx, bars) + _, err := q.db.Exec(ctx, barsSQL) return err } diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go index 4b511a4137..e31e6f2471 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go @@ -9,22 +9,22 @@ import ( "context" ) -const bar = `-- name: Bar :exec +const barSQL = `-- name: Bar :exec SELECT bar FROM foo ` func (q *Queries) Bar(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, bar) + _, err := q.db.ExecContext(ctx, barSQL) return err } -const bars = `-- name: Bars :exec +const barsSQL = `-- name: Bars :exec SELECT bars FROM foo ` func (q *Queries) Bars(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, bars) + _, err := q.db.ExecContext(ctx, barsSQL) return err } diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go index 6aa6ca6696..f1a9f38ee7 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const insertBar = `-- name: InsertBar :execlastid +const insertBarSQL = `-- name: InsertBar :execlastid INSERT INTO bar () VALUES () ` func (q *Queries) InsertBar(ctx context.Context) (int64, error) { - result, err := q.db.ExecContext(ctx, insertBar) + result, err := q.db.ExecContext(ctx, insertBarSQL) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go index e3e9074056..31e879c2a0 100644 --- a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const resetTaskRun = `-- name: ResetTaskRun :exec +const resetTaskRunSQL = `-- name: ResetTaskRun :exec UPDATE job SET last_run = NOW() FROM ( @@ -25,6 +25,6 @@ RETURNING job.last_run AS this_run, ` func (q *Queries) ResetTaskRun(ctx context.Context, taskName string) error { - _, err := q.db.Exec(ctx, resetTaskRun, taskName) + _, err := q.db.Exec(ctx, resetTaskRunSQL, taskName) return err } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go index 2c403cbff0..009c8edbca 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go @@ -11,10 +11,10 @@ import ( "github.com/jackc/pgconn" ) -const deleteBarByID = `-- name: DeleteBarByID :execresult +const deleteBarByIDSQL = `-- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, deleteBarByID, id) + return q.db.Exec(ctx, deleteBarByIDSQL, id) } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go index aab583009e..a63546aea3 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go @@ -11,10 +11,10 @@ import ( "github.com/jackc/pgx/v5/pgconn" ) -const deleteBarByID = `-- name: DeleteBarByID :execresult +const deleteBarByIDSQL = `-- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, deleteBarByID, id) + return q.db.Exec(ctx, deleteBarByIDSQL, id) } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go index 173b4e845a..ad05d8bf81 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go @@ -10,10 +10,10 @@ import ( "database/sql" ) -const deleteBarByID = `-- name: DeleteBarByID :execresult +const deleteBarByIDSQL = `-- name: DeleteBarByID :execresult DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (sql.Result, error) { - return q.db.ExecContext(ctx, deleteBarByID, id) + return q.db.ExecContext(ctx, deleteBarByIDSQL, id) } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go index edcaa4be4f..2898b8bd26 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const deleteBarByID = `-- name: DeleteBarByID :execrows +const deleteBarByIDSQL = `-- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { - result, err := q.db.Exec(ctx, deleteBarByID, id) + result, err := q.db.Exec(ctx, deleteBarByIDSQL, id) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go index edcaa4be4f..2898b8bd26 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const deleteBarByID = `-- name: DeleteBarByID :execrows +const deleteBarByIDSQL = `-- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { - result, err := q.db.Exec(ctx, deleteBarByID, id) + result, err := q.db.Exec(ctx, deleteBarByIDSQL, id) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go index 8d51824386..60211f09a1 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const deleteBarByID = `-- name: DeleteBarByID :execrows +const deleteBarByIDSQL = `-- name: DeleteBarByID :execrows DELETE FROM bar WHERE id = $1 ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteBarByID, id) + result, err := q.db.ExecContext(ctx, deleteBarByIDSQL, id) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go index 69c870213b..160bdc3823 100644 --- a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :execresult +const createAuthorSQL = `-- name: CreateAuthor :execresult INSERT INTO authors (id, name, bio) VALUES (?, ?, ?) ` @@ -22,32 +22,32 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { - return q.db.ExecContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + return q.db.ExecContext(ctx, createAuthorSQL, arg.ID, arg.Name, arg.Bio) } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ? ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name FROM authors ORDER BY name ` @@ -58,7 +58,7 @@ type ListAuthorsRow struct { } func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go index 2e2ced077f..f9fd2cbbc3 100644 --- a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go @@ -12,7 +12,7 @@ import ( "github.com/lib/pq" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (id, name, bio) VALUES ($1, $2, $3) RETURNING id, name, bio, tags @@ -25,7 +25,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.ID, arg.Name, arg.Bio) var i Author err := row.Scan( &i.ID, @@ -36,23 +36,23 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, tags FROM authors WHERE id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, @@ -63,7 +63,7 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name FROM authors ORDER BY name ` @@ -74,7 +74,7 @@ type ListAuthorsRow struct { } func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go index d26dc4d217..0f383fb9aa 100644 --- a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (id, name, bio) VALUES (?, ?, ?) RETURNING id, name, bio @@ -23,36 +23,36 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.ID, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ? ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name FROM authors ORDER BY name @@ -64,7 +64,7 @@ type ListAuthorsRow struct { } func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go index 5f514710d8..0b156347aa 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT a.id, name, b.id, title FROM authors AS a FULL JOIN books AS b ON a.id = b.id @@ -26,7 +26,7 @@ type GetAuthorRow struct { } func (q *Queries) GetAuthor(ctx context.Context, id int64) (GetAuthorRow, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i GetAuthorRow err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go index 4727e1d36a..d54e8f5abb 100644 --- a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const percentile = `-- name: Percentile :one +const percentileSQL = `-- name: Percentile :one select percentile_disc(0.5) within group (order by authors.name) from authors ` func (q *Queries) Percentile(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, percentile) + row := q.db.QueryRowContext(ctx, percentileSQL) var percentile_disc string err := row.Scan(&percentile_disc) return percentile_disc, err diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go index 04707cb600..814f9c3308 100644 --- a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const percentile = `-- name: Percentile :one +const percentileSQL = `-- name: Percentile :one select percentile_disc(0.5) within group (order by authors.name) from authors ` func (q *Queries) Percentile(ctx context.Context) (any, error) { - row := q.db.QueryRowContext(ctx, percentile) + row := q.db.QueryRowContext(ctx, percentileSQL) var percentile_disc any err := row.Scan(&percentile_disc) return percentile_disc, err diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go index f520132643..1ada6992fb 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go @@ -9,40 +9,40 @@ import ( "context" ) -const makeIntervalDays = `-- name: MakeIntervalDays :one +const makeIntervalDaysSQL = `-- name: MakeIntervalDays :one SELECT make_interval(days => $1::int) ` func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (int64, error) { - row := q.db.QueryRow(ctx, makeIntervalDays, dollar_1) + row := q.db.QueryRow(ctx, makeIntervalDaysSQL, dollar_1) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalMonths = `-- name: MakeIntervalMonths :one +const makeIntervalMonthsSQL = `-- name: MakeIntervalMonths :one SELECT make_interval(months => $1::int) ` func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (int64, error) { - row := q.db.QueryRow(ctx, makeIntervalMonths, months) + row := q.db.QueryRow(ctx, makeIntervalMonthsSQL, months) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalSecs = `-- name: MakeIntervalSecs :one +const makeIntervalSecsSQL = `-- name: MakeIntervalSecs :one SELECT make_interval(secs => $1) ` func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (int64, error) { - row := q.db.QueryRow(ctx, makeIntervalSecs, secs) + row := q.db.QueryRow(ctx, makeIntervalSecsSQL, secs) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const plus = `-- name: Plus :one +const plusSQL = `-- name: Plus :one SELECT plus(b => $2, a => $1) ` @@ -52,18 +52,18 @@ type PlusParams struct { } func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { - row := q.db.QueryRow(ctx, plus, arg.A, arg.B) + row := q.db.QueryRow(ctx, plusSQL, arg.A, arg.B) var plus int32 err := row.Scan(&plus) return plus, err } -const tableArgs = `-- name: TableArgs :one +const tableArgsSQL = `-- name: TableArgs :one SELECT table_args(x => $1) ` func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { - row := q.db.QueryRow(ctx, tableArgs, x) + row := q.db.QueryRow(ctx, tableArgsSQL, x) var table_args int32 err := row.Scan(&table_args) return table_args, err diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go index 953e59d293..6e41e9ffe3 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go @@ -11,40 +11,40 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const makeIntervalDays = `-- name: MakeIntervalDays :one +const makeIntervalDaysSQL = `-- name: MakeIntervalDays :one SELECT make_interval(days => $1::int) ` func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (pgtype.Interval, error) { - row := q.db.QueryRow(ctx, makeIntervalDays, dollar_1) + row := q.db.QueryRow(ctx, makeIntervalDaysSQL, dollar_1) var make_interval pgtype.Interval err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalMonths = `-- name: MakeIntervalMonths :one +const makeIntervalMonthsSQL = `-- name: MakeIntervalMonths :one SELECT make_interval(months => $1::int) ` func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (pgtype.Interval, error) { - row := q.db.QueryRow(ctx, makeIntervalMonths, months) + row := q.db.QueryRow(ctx, makeIntervalMonthsSQL, months) var make_interval pgtype.Interval err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalSecs = `-- name: MakeIntervalSecs :one +const makeIntervalSecsSQL = `-- name: MakeIntervalSecs :one SELECT make_interval(secs => $1) ` func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (pgtype.Interval, error) { - row := q.db.QueryRow(ctx, makeIntervalSecs, secs) + row := q.db.QueryRow(ctx, makeIntervalSecsSQL, secs) var make_interval pgtype.Interval err := row.Scan(&make_interval) return make_interval, err } -const plus = `-- name: Plus :one +const plusSQL = `-- name: Plus :one SELECT plus(b => $2, a => $1) ` @@ -54,18 +54,18 @@ type PlusParams struct { } func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { - row := q.db.QueryRow(ctx, plus, arg.A, arg.B) + row := q.db.QueryRow(ctx, plusSQL, arg.A, arg.B) var plus int32 err := row.Scan(&plus) return plus, err } -const tableArgs = `-- name: TableArgs :one +const tableArgsSQL = `-- name: TableArgs :one SELECT table_args(x => $1) ` func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { - row := q.db.QueryRow(ctx, tableArgs, x) + row := q.db.QueryRow(ctx, tableArgsSQL, x) var table_args int32 err := row.Scan(&table_args) return table_args, err diff --git a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go index fbdc347401..cf84d66a92 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go @@ -9,40 +9,40 @@ import ( "context" ) -const makeIntervalDays = `-- name: MakeIntervalDays :one +const makeIntervalDaysSQL = `-- name: MakeIntervalDays :one SELECT make_interval(days => $1::int) ` func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalDays, dollar_1) + row := q.db.QueryRowContext(ctx, makeIntervalDaysSQL, dollar_1) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalMonths = `-- name: MakeIntervalMonths :one +const makeIntervalMonthsSQL = `-- name: MakeIntervalMonths :one SELECT make_interval(months => $1::int) ` func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalMonths, months) + row := q.db.QueryRowContext(ctx, makeIntervalMonthsSQL, months) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const makeIntervalSecs = `-- name: MakeIntervalSecs :one +const makeIntervalSecsSQL = `-- name: MakeIntervalSecs :one SELECT make_interval(secs => $1) ` func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (int64, error) { - row := q.db.QueryRowContext(ctx, makeIntervalSecs, secs) + row := q.db.QueryRowContext(ctx, makeIntervalSecsSQL, secs) var make_interval int64 err := row.Scan(&make_interval) return make_interval, err } -const plus = `-- name: Plus :one +const plusSQL = `-- name: Plus :one SELECT plus(b => $2, a => $1) ` @@ -52,18 +52,18 @@ type PlusParams struct { } func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) { - row := q.db.QueryRowContext(ctx, plus, arg.A, arg.B) + row := q.db.QueryRowContext(ctx, plusSQL, arg.A, arg.B) var plus int32 err := row.Scan(&plus) return plus, err } -const tableArgs = `-- name: TableArgs :one +const tableArgsSQL = `-- name: TableArgs :one SELECT table_args(x => $1) ` func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) { - row := q.db.QueryRowContext(ctx, tableArgs, x) + row := q.db.QueryRowContext(ctx, tableArgsSQL, x) var table_args int32 err := row.Scan(&table_args) return table_args, err diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go index bf68c7c7b7..589db831d8 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const plusPositionalCast = `-- name: PlusPositionalCast :one +const plusPositionalCastSQL = `-- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER) ` @@ -19,7 +19,7 @@ type PlusPositionalCastParams struct { } func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { - row := q.db.QueryRow(ctx, plusPositionalCast, arg.A, arg.Column2) + row := q.db.QueryRow(ctx, plusPositionalCastSQL, arg.A, arg.Column2) var plus int32 err := row.Scan(&plus) return plus, err diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go index bf68c7c7b7..589db831d8 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const plusPositionalCast = `-- name: PlusPositionalCast :one +const plusPositionalCastSQL = `-- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER) ` @@ -19,7 +19,7 @@ type PlusPositionalCastParams struct { } func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { - row := q.db.QueryRow(ctx, plusPositionalCast, arg.A, arg.Column2) + row := q.db.QueryRow(ctx, plusPositionalCastSQL, arg.A, arg.Column2) var plus int32 err := row.Scan(&plus) return plus, err diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go index 1fb02009db..aa22d6618b 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const plusPositionalCast = `-- name: PlusPositionalCast :one +const plusPositionalCastSQL = `-- name: PlusPositionalCast :one SELECT plus($1, $2::INTEGER) ` @@ -19,7 +19,7 @@ type PlusPositionalCastParams struct { } func (q *Queries) PlusPositionalCast(ctx context.Context, arg PlusPositionalCastParams) (int32, error) { - row := q.db.QueryRowContext(ctx, plusPositionalCast, arg.A, arg.Column2) + row := q.db.QueryRowContext(ctx, plusPositionalCastSQL, arg.A, arg.Column2) var plus int32 err := row.Scan(&plus) return plus, err diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go index 8807bc6b96..14cc923bc8 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const demo = `-- name: Demo :one +const demoSQL = `-- name: Demo :one SELECT CAST(GREATEST(1,2,3,4,5) AS UNSIGNED) as col1 ` func (q *Queries) Demo(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, demo) + row := q.db.QueryRowContext(ctx, demoSQL) var col1 int64 err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go index 02480c08dd..2607cfda29 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/google/uuid" ) -const demo = `-- name: Demo :one +const demoSQL = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, demo, name) + row := q.db.QueryRow(ctx, demoSQL, name) var col1 uuid.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go index 9de4f9e8c7..20bb12f03a 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const demo = `-- name: Demo :one +const demoSQL = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` func (q *Queries) Demo(ctx context.Context, name string) (pgtype.UUID, error) { - row := q.db.QueryRow(ctx, demo, name) + row := q.db.QueryRow(ctx, demoSQL, name) var col1 pgtype.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go index 2c648a810f..9eff751087 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/google/uuid" ) -const demo = `-- name: Demo :one +const demoSQL = `-- name: Demo :one SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1 ` func (q *Queries) Demo(ctx context.Context, name string) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, demo, name) + row := q.db.QueryRowContext(ctx, demoSQL, name) var col1 uuid.UUID err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go index 5d39885531..0df39c9ee2 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const demo = `-- name: Demo :one +const demoSQL = `-- name: Demo :one SELECT CAST(char(1, 2, 3, 4, 5) AS BLOB) AS col1 ` func (q *Queries) Demo(ctx context.Context) ([]byte, error) { - row := q.db.QueryRowContext(ctx, demo) + row := q.db.QueryRowContext(ctx, demoSQL) var col1 []byte err := row.Scan(&col1) return col1, err diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go index ebbde9761e..3b33573bbf 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const authorPages = `-- name: AuthorPages :many +const authorPagesSQL = `-- name: AuthorPages :many select author, count(title) as num_books, SUM(pages) as total_pages from books group by author @@ -22,7 +22,7 @@ type AuthorPagesRow struct { } func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { - rows, err := q.db.QueryContext(ctx, authorPages) + rows, err := q.db.QueryContext(ctx, authorPagesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go index 5a1be47c96..3e483a9676 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const authorPages = `-- name: AuthorPages :many +const authorPagesSQL = `-- name: AuthorPages :many select author, count(title) as num_books, SUM(pages) as total_pages from books group by author @@ -22,7 +22,7 @@ type AuthorPagesRow struct { } func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { - rows, err := q.db.QueryContext(ctx, authorPages) + rows, err := q.db.QueryContext(ctx, authorPagesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go index 8e56ea38b6..7dcc19809c 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const authorPages = `-- name: AuthorPages :many +const authorPagesSQL = `-- name: AuthorPages :many SELECT author, count(title) AS num_books, sum(pages) AS total_pages FROM books GROUP BY author @@ -23,7 +23,7 @@ type AuthorPagesRow struct { } func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { - rows, err := q.db.QueryContext(ctx, authorPages) + rows, err := q.db.QueryContext(ctx, authorPagesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go b/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go index 62cd454cf2..a597376843 100644 --- a/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go +++ b/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go @@ -14,7 +14,7 @@ import ( "cloud.google.com/go/spanner" ) -const aggregates = `-- name: Aggregates :one +const aggregatesSQL = `-- name: Aggregates :one SELECT COUNT(*) AS total, SUM(amount) AS total_amount, AVG(id) AS mean_id, MAX(name) AS last_name, ARRAY_AGG(id) AS ids, STRING_AGG(name, ',') AS names FROM events @@ -30,7 +30,7 @@ type AggregatesRow struct { } func (q *Queries) Aggregates(ctx context.Context) (AggregatesRow, error) { - row := q.db.QueryRowContext(ctx, aggregates) + row := q.db.QueryRowContext(ctx, aggregatesSQL) var i AggregatesRow err := row.Scan( &i.Total, @@ -43,7 +43,7 @@ func (q *Queries) Aggregates(ctx context.Context) (AggregatesRow, error) { return i, err } -const conditionals = `-- name: Conditionals :many +const conditionalsSQL = `-- name: Conditionals :many SELECT COALESCE(nickname, name) AS display_name, IFNULL(ratio, 0) AS ratio_or_zero, NULLIF(name, '') AS non_empty, IF(id > 10, name, nickname) AS chosen, GREATEST(id, 1) AS at_least_one FROM events @@ -58,7 +58,7 @@ type ConditionalsRow struct { } func (q *Queries) Conditionals(ctx context.Context) ([]ConditionalsRow, error) { - rows, err := q.db.QueryContext(ctx, conditionals) + rows, err := q.db.QueryContext(ctx, conditionalsSQL) if err != nil { return nil, err } @@ -86,7 +86,7 @@ func (q *Queries) Conditionals(ctx context.Context) ([]ConditionalsRow, error) { return items, nil } -const mayBeNull = `-- name: MayBeNull :many +const mayBeNullSQL = `-- name: MayBeNull :many SELECT JSON_VALUE(details, '$.kind') AS kind, REGEXP_EXTRACT(name, 'a+') AS run, SAFE_DIVIDE(id, 0) AS ratio, SAFE.SUBSTR(name, 1, 3) AS prefix, ARRAY_FIRST(scores) AS first_score FROM events @@ -101,7 +101,7 @@ type MayBeNullRow struct { } func (q *Queries) MayBeNull(ctx context.Context) ([]MayBeNullRow, error) { - rows, err := q.db.QueryContext(ctx, mayBeNull) + rows, err := q.db.QueryContext(ctx, mayBeNullSQL) if err != nil { return nil, err } @@ -129,7 +129,7 @@ func (q *Queries) MayBeNull(ctx context.Context) ([]MayBeNullRow, error) { return items, nil } -const paramsFromFunctions = `-- name: ParamsFromFunctions :many +const paramsFromFunctionsSQL = `-- name: ParamsFromFunctions :many SELECT id FROM events WHERE STARTS_WITH(name, @prefix) AND TIMESTAMP_TRUNC(happened_at, DAY) = @day AND EXTRACT(DATE FROM happened_at) = @on AND ARRAY_INCLUDES(scores, @score) @@ -143,7 +143,7 @@ type ParamsFromFunctionsParams struct { } func (q *Queries) ParamsFromFunctions(ctx context.Context, arg ParamsFromFunctionsParams) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, paramsFromFunctions, + rows, err := q.db.QueryContext(ctx, paramsFromFunctionsSQL, sql.Named("prefix", arg.Prefix), sql.Named("day", arg.Day), sql.Named("on", arg.On), @@ -170,7 +170,7 @@ func (q *Queries) ParamsFromFunctions(ctx context.Context, arg ParamsFromFunctio return items, nil } -const propagates = `-- name: Propagates :many +const propagatesSQL = `-- name: Propagates :many SELECT UPPER(name) AS upper_name, UPPER(nickname) AS upper_nickname, LENGTH(nickname) AS nickname_length FROM events ` @@ -182,7 +182,7 @@ type PropagatesRow struct { } func (q *Queries) Propagates(ctx context.Context) ([]PropagatesRow, error) { - rows, err := q.db.QueryContext(ctx, propagates) + rows, err := q.db.QueryContext(ctx, propagatesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go index 2208cc1620..0268c4bda7 100644 --- a/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one SELECT id FROM add_author ( $1, $2 ) @@ -23,7 +23,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (pgtype.Int4, error) { - row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthorSQL, arg.Name, arg.Bio) var id pgtype.Int4 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go index 00ee09a655..d3e1236378 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getDate = `-- name: GetDate :one +const getDateSQL = `-- name: GetDate :one SELECT now from NOW() ` func (q *Queries) GetDate(ctx context.Context) (pgtype.Timestamptz, error) { - row := q.db.QueryRow(ctx, getDate) + row := q.db.QueryRow(ctx, getDateSQL) var now pgtype.Timestamptz err := row.Scan(&now) return now, err diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go index ebdc67b295..a70a7b7da1 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getDate = `-- name: GetDate :one +const getDateSQL = `-- name: GetDate :one SELECT from CURRENT_DATE ` @@ -17,7 +17,7 @@ type GetDateRow struct { } func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { - row := q.db.QueryRow(ctx, getDate) + row := q.db.QueryRow(ctx, getDateSQL) var i GetDateRow err := row.Scan() return i, err diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go index 456c69230c..2703e59c75 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getDate = `-- name: GetDate :one +const getDateSQL = `-- name: GetDate :one SELECT from CURRENT_DATE ` @@ -17,7 +17,7 @@ type GetDateRow struct { } func (q *Queries) GetDate(ctx context.Context) (GetDateRow, error) { - row := q.db.QueryRowContext(ctx, getDate) + row := q.db.QueryRowContext(ctx, getDateSQL) var i GetDateRow err := row.Scan() return i, err diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go index 48e3ea33ed..2ba7e1e6d6 100644 --- a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getData = `-- name: GetData :one +const getDataSQL = `-- name: GetData :one SELECT key, value FROM my_table, jsonb_each(data) LIMIT 1 @@ -23,7 +23,7 @@ type GetDataRow struct { } func (q *Queries) GetData(ctx context.Context) (GetDataRow, error) { - row := q.db.QueryRow(ctx, getData) + row := q.db.QueryRow(ctx, getDataSQL) var i GetDataRow err := row.Scan(&i.Key, &i.Value) return i, err diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go index 6ada9c4632..979dd33e62 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT ($1::int) + i FROM generate_series(0, $2::int) AS i LIMIT 1 @@ -21,7 +21,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go index 6ada9c4632..979dd33e62 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT ($1::int) + i FROM generate_series(0, $2::int) AS i LIMIT 1 @@ -21,7 +21,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go index 147fc31b1b..cffc877b75 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT ($1::int) + i FROM generate_series(0, $2::int) AS i LIMIT 1 @@ -21,7 +21,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.QueryContext(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go index f09cfb2a96..c923f9ec68 100644 --- a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const foo = `-- name: Foo :one +const fooSQL = `-- name: Foo :one SELECT register_account FROM register_account('a', 'b') ` func (q *Queries) Foo(ctx context.Context) (pgtype.Int4, error) { - row := q.db.QueryRow(ctx, foo) + row := q.db.QueryRow(ctx, fooSQL) var register_account pgtype.Int4 err := row.Scan(®ister_account) return register_account, err diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go index 6d65297c96..768a0ca47c 100644 --- a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const testFuncSelectBlog = `-- name: TestFuncSelectBlog :many +const testFuncSelectBlogSQL = `-- name: TestFuncSelectBlog :many select id, name from test_select_blog($1) ` @@ -21,7 +21,7 @@ type TestFuncSelectBlogRow struct { } func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) ([]TestFuncSelectBlogRow, error) { - rows, err := q.db.Query(ctx, testFuncSelectBlog, pID) + rows, err := q.db.Query(ctx, testFuncSelectBlogSQL, pID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go index 1072289270..c5a44e5d74 100644 --- a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go @@ -11,34 +11,34 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const testFuncGetTime = `-- name: TestFuncGetTime :one +const testFuncGetTimeSQL = `-- name: TestFuncGetTime :one select test_func_get_time from test_func_get_time() ` func (q *Queries) TestFuncGetTime(ctx context.Context) (pgtype.Timestamp, error) { - row := q.db.QueryRow(ctx, testFuncGetTime) + row := q.db.QueryRow(ctx, testFuncGetTimeSQL) var test_func_get_time pgtype.Timestamp err := row.Scan(&test_func_get_time) return test_func_get_time, err } -const testFuncSelectBlog = `-- name: TestFuncSelectBlog :one +const testFuncSelectBlogSQL = `-- name: TestFuncSelectBlog :one select test_func_select_blog from test_func_select_blog($1) ` func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) (any, error) { - row := q.db.QueryRow(ctx, testFuncSelectBlog, pID) + row := q.db.QueryRow(ctx, testFuncSelectBlogSQL, pID) var test_func_select_blog any err := row.Scan(&test_func_select_blog) return test_func_select_blog, err } -const testFuncSelectString = `-- name: TestFuncSelectString :one +const testFuncSelectStringSQL = `-- name: TestFuncSelectString :one select test_func_select_string from test_func_select_string($1) ` func (q *Queries) TestFuncSelectString(ctx context.Context, pString string) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, testFuncSelectString, pString) + row := q.db.QueryRow(ctx, testFuncSelectStringSQL, pString) var test_func_select_string pgtype.Text err := row.Scan(&test_func_select_string) return test_func_select_string, err diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go index cca8f98d47..d28b2e77c3 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const updateJ = `-- name: UpdateJ :exec +const updateJSQL = `-- name: UpdateJ :exec UPDATE test SET @@ -28,7 +28,7 @@ type UpdateJParams struct { } func (q *Queries) UpdateJ(ctx context.Context, arg UpdateJParams) error { - _, err := q.db.ExecContext(ctx, updateJ, + _, err := q.db.ExecContext(ctx, updateJSQL, arg.Column1, arg.Column2, arg.Column3, diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go index fdeffb2df1..2b773f22e2 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_box_null, v_circle_null, v_line_null, v_lseg_null, v_path_null, v_point_null, v_polygon_null, v_box, v_circle, v_line, v_lseg, v_path, v_point, v_polygon from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go index fdeffb2df1..2b773f22e2 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_box_null, v_circle_null, v_line_null, v_lseg_null, v_path_null, v_point_null, v_polygon_null, v_box, v_circle, v_line, v_lseg, v_path, v_point, v_polygon from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go index a928562973..35b424bc0d 100644 --- a/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const selectFoo = `-- name: SelectFoo :many +const selectFooSQL = `-- name: SelectFoo :many SELECT bar_id FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectFoo) + rows, err := q.db.QueryContext(ctx, selectFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go index da4d925c9c..877134d55c 100644 --- a/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go +++ b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectFoo = `-- name: SelectFoo :many +const selectFooSQL = `-- name: SelectFoo :many SELECT bar_id, site_url FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectFoo) + rows, err := q.db.QueryContext(ctx, selectFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go index 1b8a297a43..0eeaa99be9 100644 --- a/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const selectFoo = `-- name: SelectFoo :many +const selectFooSQL = `-- name: SelectFoo :many SELECT bar FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectFoo) + rows, err := q.db.QueryContext(ctx, selectFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go index 1b8a297a43..0eeaa99be9 100644 --- a/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const selectFoo = `-- name: SelectFoo :many +const selectFooSQL = `-- name: SelectFoo :many SELECT bar FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectFoo) + rows, err := q.db.QueryContext(ctx, selectFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/having/mysql/go/query.sql.go b/internal/endtoend/testdata/having/mysql/go/query.sql.go index 7bfd67d0aa..ebade9d014 100644 --- a/internal/endtoend/testdata/having/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/having/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const coldCities = `-- name: ColdCities :many +const coldCitiesSQL = `-- name: ColdCities :many SELECT city FROM weather GROUP BY city @@ -17,7 +17,7 @@ HAVING max(temp_lo) < ? ` func (q *Queries) ColdCities(ctx context.Context, tempLo int32) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coldCities, tempLo) + rows, err := q.db.QueryContext(ctx, coldCitiesSQL, tempLo) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/having/postgresql/go/query.sql.go b/internal/endtoend/testdata/having/postgresql/go/query.sql.go index d986320b50..8bc0c4ddef 100644 --- a/internal/endtoend/testdata/having/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/having/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const coldCities = `-- name: ColdCities :many +const coldCitiesSQL = `-- name: ColdCities :many SELECT city FROM weather GROUP BY city @@ -17,7 +17,7 @@ HAVING max(temp_lo) < $1 ` func (q *Queries) ColdCities(ctx context.Context, tempLo int32) ([]string, error) { - rows, err := q.db.QueryContext(ctx, coldCities, tempLo) + rows, err := q.db.QueryContext(ctx, coldCitiesSQL, tempLo) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go index 8a304684e7..08baeb02c2 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgtype" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT bar FROM foo ` func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -35,12 +35,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { return items, nil } -const listBaz = `-- name: ListBaz :many +const listBazSQL = `-- name: ListBaz :many SELECT baz FROM foo ` func (q *Queries) ListBaz(ctx context.Context) ([]pgtype.Hstore, error) { - rows, err := q.db.Query(ctx, listBaz) + rows, err := q.db.Query(ctx, listBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go index 29e48479ed..3bd8af649e 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT bar FROM foo ` func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -35,12 +35,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]pgtype.Hstore, error) { return items, nil } -const listBaz = `-- name: ListBaz :many +const listBazSQL = `-- name: ListBaz :many SELECT baz FROM foo ` func (q *Queries) ListBaz(ctx context.Context) ([]pgtype.Hstore, error) { - rows, err := q.db.Query(ctx, listBaz) + rows, err := q.db.Query(ctx, listBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go index 66bd5eb6da..0fc716eab3 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT bar FROM foo ` func (q *Queries) ListBar(ctx context.Context) ([]any, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]any, error) { return items, nil } -const listBaz = `-- name: ListBaz :many +const listBazSQL = `-- name: ListBaz :many SELECT baz FROM foo ` func (q *Queries) ListBaz(ctx context.Context) ([]any, error) { - rows, err := q.db.QueryContext(ctx, listBaz) + rows, err := q.db.QueryContext(ctx, listBazSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go index 79b96bb8d6..e472be8fe4 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const identicalTable = `-- name: IdenticalTable :many +const identicalTableSQL = `-- name: IdenticalTable :many SELECT id FROM foo ` func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identicalTable) + rows, err := q.db.QueryContext(ctx, identicalTableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go index d09aae88dc..53afb09d9d 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const identicalTable = `-- name: IdenticalTable :many +const identicalTableSQL = `-- name: IdenticalTable :many SELECT id FROM foo ` func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, identicalTable) + rows, err := q.db.Query(ctx, identicalTableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go index d09aae88dc..53afb09d9d 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const identicalTable = `-- name: IdenticalTable :many +const identicalTableSQL = `-- name: IdenticalTable :many SELECT id FROM foo ` func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, identicalTable) + rows, err := q.db.Query(ctx, identicalTableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go index 79b96bb8d6..e472be8fe4 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const identicalTable = `-- name: IdenticalTable :many +const identicalTableSQL = `-- name: IdenticalTable :many SELECT id FROM foo ` func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identicalTable) + rows, err := q.db.QueryContext(ctx, identicalTableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go index 79b96bb8d6..e472be8fe4 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const identicalTable = `-- name: IdenticalTable :many +const identicalTableSQL = `-- name: IdenticalTable :many SELECT id FROM foo ` func (q *Queries) IdenticalTable(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identicalTable) + rows, err := q.db.QueryContext(ctx, identicalTableSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go index 03a9f67e53..c80e1ee57d 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :execresult +const createAuthorSQL = `-- name: CreateAuthor :execresult INSERT INTO Authors ( Name, Bio ) VALUES ( @@ -24,38 +24,38 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { - return q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + return q.db.ExecContext(ctx, createAuthorSQL, arg.Name, arg.Bio) } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM Authors WHERE ID = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM Authors WHERE ID = ? LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM Authors ORDER BY Name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go index 48317c8f65..ca113b1029 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const fn = `-- name: Fn :one +const fnSQL = `-- name: Fn :one SELECT f$n() ` func (q *Queries) Fn(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, fn) + row := q.db.QueryRowContext(ctx, fnSQL) var f_n int32 err := row.Scan(&f_n) return f_n, err diff --git a/internal/endtoend/testdata/in_union/mysql/go/query.sql.go b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go index 352b50a772..7a7a75375e 100644 --- a/internal/endtoend/testdata/in_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthors = `-- name: GetAuthors :many +const getAuthorsSQL = `-- name: GetAuthors :many SELECT id, name, bio FROM authors WHERE author_id IN (SELECT author_id FROM book1 UNION SELECT author_id FROM book2) ` func (q *Queries) GetAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, getAuthors) + rows, err := q.db.QueryContext(ctx, getAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go index ae221c6c47..3663b70770 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getProductMetadata = `-- name: GetProductMetadata :many +const getProductMetadataSQL = `-- name: GetProductMetadata :many SELECT id FROM product_metadata ` func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getProductMetadata) + rows, err := q.db.QueryContext(ctx, getProductMetadataSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listCalories = `-- name: ListCalories :many +const listCaloriesSQL = `-- name: ListCalories :many SELECT id FROM calories ` func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCalories) + rows, err := q.db.QueryContext(ctx, listCaloriesSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { return items, nil } -const listCampuses = `-- name: ListCampuses :many +const listCampusesSQL = `-- name: ListCampuses :many SELECT id FROM campus ` func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCampuses) + rows, err := q.db.QueryContext(ctx, listCampusesSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } -const listMetadata = `-- name: ListMetadata :many +const listMetadataSQL = `-- name: ListMetadata :many SELECT id FROM product_meta ` func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listMetadata) + rows, err := q.db.QueryContext(ctx, listMetadataSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listStudents = `-- name: ListStudents :many +const listStudentsSQL = `-- name: ListStudents :many SELECT id FROM students ` func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listStudents) + rows, err := q.db.QueryContext(ctx, listStudentsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go index 950dc18262..ceae543d6d 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getProductMetadata = `-- name: GetProductMetadata :many +const getProductMetadataSQL = `-- name: GetProductMetadata :many SELECT id FROM product_metadata ` func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, getProductMetadata) + rows, err := q.db.Query(ctx, getProductMetadataSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listCalories = `-- name: ListCalories :many +const listCaloriesSQL = `-- name: ListCalories :many SELECT id FROM calories ` func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listCalories) + rows, err := q.db.Query(ctx, listCaloriesSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { return items, nil } -const listCampuses = `-- name: ListCampuses :many +const listCampusesSQL = `-- name: ListCampuses :many SELECT id FROM campus ` func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listCampuses) + rows, err := q.db.Query(ctx, listCampusesSQL) if err != nil { return nil, err } @@ -81,12 +81,12 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } -const listMetadata = `-- name: ListMetadata :many +const listMetadataSQL = `-- name: ListMetadata :many SELECT id FROM product_meta ` func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listMetadata) + rows, err := q.db.Query(ctx, listMetadataSQL) if err != nil { return nil, err } @@ -105,12 +105,12 @@ func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listStudents = `-- name: ListStudents :many +const listStudentsSQL = `-- name: ListStudents :many SELECT id FROM students ` func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listStudents) + rows, err := q.db.Query(ctx, listStudentsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go index 950dc18262..ceae543d6d 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getProductMetadata = `-- name: GetProductMetadata :many +const getProductMetadataSQL = `-- name: GetProductMetadata :many SELECT id FROM product_metadata ` func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, getProductMetadata) + rows, err := q.db.Query(ctx, getProductMetadataSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listCalories = `-- name: ListCalories :many +const listCaloriesSQL = `-- name: ListCalories :many SELECT id FROM calories ` func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listCalories) + rows, err := q.db.Query(ctx, listCaloriesSQL) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { return items, nil } -const listCampuses = `-- name: ListCampuses :many +const listCampusesSQL = `-- name: ListCampuses :many SELECT id FROM campus ` func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listCampuses) + rows, err := q.db.Query(ctx, listCampusesSQL) if err != nil { return nil, err } @@ -81,12 +81,12 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } -const listMetadata = `-- name: ListMetadata :many +const listMetadataSQL = `-- name: ListMetadata :many SELECT id FROM product_meta ` func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listMetadata) + rows, err := q.db.Query(ctx, listMetadataSQL) if err != nil { return nil, err } @@ -105,12 +105,12 @@ func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listStudents = `-- name: ListStudents :many +const listStudentsSQL = `-- name: ListStudents :many SELECT id FROM students ` func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, listStudents) + rows, err := q.db.Query(ctx, listStudentsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go index ae221c6c47..3663b70770 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getProductMetadata = `-- name: GetProductMetadata :many +const getProductMetadataSQL = `-- name: GetProductMetadata :many SELECT id FROM product_metadata ` func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getProductMetadata) + rows, err := q.db.QueryContext(ctx, getProductMetadataSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listCalories = `-- name: ListCalories :many +const listCaloriesSQL = `-- name: ListCalories :many SELECT id FROM calories ` func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCalories) + rows, err := q.db.QueryContext(ctx, listCaloriesSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { return items, nil } -const listCampuses = `-- name: ListCampuses :many +const listCampusesSQL = `-- name: ListCampuses :many SELECT id FROM campus ` func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCampuses) + rows, err := q.db.QueryContext(ctx, listCampusesSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } -const listMetadata = `-- name: ListMetadata :many +const listMetadataSQL = `-- name: ListMetadata :many SELECT id FROM product_meta ` func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listMetadata) + rows, err := q.db.QueryContext(ctx, listMetadataSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listStudents = `-- name: ListStudents :many +const listStudentsSQL = `-- name: ListStudents :many SELECT id FROM students ` func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listStudents) + rows, err := q.db.QueryContext(ctx, listStudentsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go index ae221c6c47..3663b70770 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getProductMetadata = `-- name: GetProductMetadata :many +const getProductMetadataSQL = `-- name: GetProductMetadata :many SELECT id FROM product_metadata ` func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getProductMetadata) + rows, err := q.db.QueryContext(ctx, getProductMetadataSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listCalories = `-- name: ListCalories :many +const listCaloriesSQL = `-- name: ListCalories :many SELECT id FROM calories ` func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCalories) + rows, err := q.db.QueryContext(ctx, listCaloriesSQL) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (q *Queries) ListCalories(ctx context.Context) ([]string, error) { return items, nil } -const listCampuses = `-- name: ListCampuses :many +const listCampusesSQL = `-- name: ListCampuses :many SELECT id FROM campus ` func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listCampuses) + rows, err := q.db.QueryContext(ctx, listCampusesSQL) if err != nil { return nil, err } @@ -90,12 +90,12 @@ func (q *Queries) ListCampuses(ctx context.Context) ([]string, error) { return items, nil } -const listMetadata = `-- name: ListMetadata :many +const listMetadataSQL = `-- name: ListMetadata :many SELECT id FROM product_meta ` func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listMetadata) + rows, err := q.db.QueryContext(ctx, listMetadataSQL) if err != nil { return nil, err } @@ -117,12 +117,12 @@ func (q *Queries) ListMetadata(ctx context.Context) ([]string, error) { return items, nil } -const listStudents = `-- name: ListStudents :many +const listStudentsSQL = `-- name: ListStudents :many SELECT id FROM students ` func (q *Queries) ListStudents(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listStudents) + rows, err := q.db.QueryContext(ctx, listStudentsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go index 15a9da239b..cca40788ed 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go @@ -9,34 +9,34 @@ import ( "context" ) -const deleteBarByID = `-- name: DeleteBarByID :one +const deleteBarByIDSQL = `-- name: DeleteBarByID :one DELETE FROM bars WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (Bar, error) { - row := q.db.QueryRow(ctx, deleteBarByID, id) + row := q.db.QueryRow(ctx, deleteBarByIDSQL, id) var i Bar err := row.Scan(&i.ID, &i.Name) return i, err } -const deleteExclusionByID = `-- name: DeleteExclusionByID :one +const deleteExclusionByIDSQL = `-- name: DeleteExclusionByID :one DELETE FROM exclusions WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteExclusionByID(ctx context.Context, id int32) (Exclusions, error) { - row := q.db.QueryRow(ctx, deleteExclusionByID, id) + row := q.db.QueryRow(ctx, deleteExclusionByIDSQL, id) var i Exclusions err := row.Scan(&i.ID, &i.Name) return i, err } -const deleteMyDataByID = `-- name: DeleteMyDataByID :one +const deleteMyDataByIDSQL = `-- name: DeleteMyDataByID :one DELETE FROM my_data WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteMyDataByID(ctx context.Context, id int32) (MyData, error) { - row := q.db.QueryRow(ctx, deleteMyDataByID, id) + row := q.db.QueryRow(ctx, deleteMyDataByIDSQL, id) var i MyData err := row.Scan(&i.ID, &i.Name) return i, err diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go index 15a9da239b..cca40788ed 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go @@ -9,34 +9,34 @@ import ( "context" ) -const deleteBarByID = `-- name: DeleteBarByID :one +const deleteBarByIDSQL = `-- name: DeleteBarByID :one DELETE FROM bars WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteBarByID(ctx context.Context, id int32) (Bar, error) { - row := q.db.QueryRow(ctx, deleteBarByID, id) + row := q.db.QueryRow(ctx, deleteBarByIDSQL, id) var i Bar err := row.Scan(&i.ID, &i.Name) return i, err } -const deleteExclusionByID = `-- name: DeleteExclusionByID :one +const deleteExclusionByIDSQL = `-- name: DeleteExclusionByID :one DELETE FROM exclusions WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteExclusionByID(ctx context.Context, id int32) (Exclusions, error) { - row := q.db.QueryRow(ctx, deleteExclusionByID, id) + row := q.db.QueryRow(ctx, deleteExclusionByIDSQL, id) var i Exclusions err := row.Scan(&i.ID, &i.Name) return i, err } -const deleteMyDataByID = `-- name: DeleteMyDataByID :one +const deleteMyDataByIDSQL = `-- name: DeleteMyDataByID :one DELETE FROM my_data WHERE id = $1 RETURNING id, name ` func (q *Queries) DeleteMyDataByID(ctx context.Context, id int32) (MyData, error) { - row := q.db.QueryRow(ctx, deleteMyDataByID, id) + row := q.db.QueryRow(ctx, deleteMyDataByIDSQL, id) var i MyData err := row.Scan(&i.ID, &i.Name) return i, err diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go index 7fe4ff6eeb..f17ce28a7d 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertCode = `-- name: InsertCode :one +const insertCodeSQL = `-- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -31,7 +31,7 @@ type InsertCodeParams struct { } func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { - row := q.db.QueryRow(ctx, insertCode, + row := q.db.QueryRow(ctx, insertCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go index f22c13e3fa..8ff8ad3d3c 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertCode = `-- name: InsertCode :one +const insertCodeSQL = `-- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -32,7 +32,7 @@ type InsertCodeParams struct { } func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { - row := q.db.QueryRow(ctx, insertCode, + row := q.db.QueryRow(ctx, insertCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go index b5379c448e..7c5dd5c019 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertCode = `-- name: InsertCode :one +const insertCodeSQL = `-- name: InsertCode :one WITH cc AS ( INSERT INTO td3.codes(created_by, updated_by, code, hash, is_private) VALUES ($1, $1, $2, $3, false) @@ -31,7 +31,7 @@ type InsertCodeParams struct { } func (q *Queries) InsertCode(ctx context.Context, arg InsertCodeParams) (Td3TestCode, error) { - row := q.db.QueryRowContext(ctx, insertCode, + row := q.db.QueryRowContext(ctx, insertCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go index 26ca36f673..aa6f38df32 100644 --- a/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const insertWorkspace = `-- name: InsertWorkspace :exec +const insertWorkspaceSQL = `-- name: InsertWorkspace :exec INSERT INTO workspace DEFAULT VALUES ` func (q *Queries) InsertWorkspace(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, insertWorkspace) + _, err := q.db.ExecContext(ctx, insertWorkspaceSQL) return err } diff --git a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go index 7b7d191166..9040b51c1c 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, ? FROM bar WHERE ready = ? @@ -21,6 +21,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) + _, err := q.db.ExecContext(ctx, insertSelectSQL, arg.Meta, arg.Ready) return err } diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go index a3e177f807..a114337af9 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 FROM bar WHERE ready = $2 @@ -21,6 +21,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.Exec(ctx, insertSelect, arg.Meta, arg.Ready) + _, err := q.db.Exec(ctx, insertSelectSQL, arg.Meta, arg.Ready) return err } diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go index a3e177f807..a114337af9 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 FROM bar WHERE ready = $2 @@ -21,6 +21,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.Exec(ctx, insertSelect, arg.Meta, arg.Ready) + _, err := q.db.Exec(ctx, insertSelectSQL, arg.Meta, arg.Ready) return err } diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go index bbf3dd7853..d0b0c2dcad 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, $1 FROM bar WHERE ready = $2 @@ -21,6 +21,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) + _, err := q.db.ExecContext(ctx, insertSelectSQL, arg.Meta, arg.Ready) return err } diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go index b158e67cff..36f63e6321 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, ? FROM bar @@ -22,6 +22,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.ExecContext(ctx, insertSelect, arg.Meta, arg.Ready) + _, err := q.db.ExecContext(ctx, insertSelectSQL, arg.Meta, arg.Ready) return err } diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go index 88f2aff71f..8da1c0b267 100644 --- a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertOrders = `-- name: InsertOrders :exec +const insertOrdersSQL = `-- name: InsertOrders :exec insert into Orders (id,name) select id , CASE WHEN $1::BOOLEAN THEN $2 ELSE s.name END from Orders s @@ -23,6 +23,6 @@ type InsertOrdersParams struct { } func (q *Queries) InsertOrders(ctx context.Context, arg InsertOrdersParams) error { - _, err := q.db.Exec(ctx, insertOrders, arg.NameDoUpdate, arg.Name) + _, err := q.db.Exec(ctx, insertOrdersSQL, arg.NameDoUpdate, arg.Name) return err } diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go index eaa742192a..74774d48bf 100644 --- a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertSelect = `-- name: InsertSelect :exec +const insertSelectSQL = `-- name: InsertSelect :exec INSERT INTO authors (id, name, bio) SELECT $1, name, bio FROM authors @@ -24,6 +24,6 @@ type InsertSelectParams struct { } func (q *Queries) InsertSelect(ctx context.Context, arg InsertSelectParams) error { - _, err := q.db.Exec(ctx, insertSelect, arg.ID, arg.Name) + _, err := q.db.Exec(ctx, insertSelectSQL, arg.ID, arg.Name) return err } diff --git a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go index 90f9be9c62..1e30d3d738 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertMultipleValues = `-- name: InsertMultipleValues :exec +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :exec INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) ` @@ -22,7 +22,7 @@ type InsertMultipleValuesParams struct { } func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { - _, err := q.db.ExecContext(ctx, insertMultipleValues, + _, err := q.db.ExecContext(ctx, insertMultipleValuesSQL, arg.A, arg.B, arg.A_2, @@ -31,7 +31,7 @@ func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleVa return err } -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES (?, ?) ` @@ -41,6 +41,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go index a1db3238e0..b55fbd3de7 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertMultipleValues = `-- name: InsertMultipleValues :exec +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :exec INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) ` @@ -22,7 +22,7 @@ type InsertMultipleValuesParams struct { } func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { - _, err := q.db.Exec(ctx, insertMultipleValues, + _, err := q.db.Exec(ctx, insertMultipleValuesSQL, arg.A, arg.B, arg.A_2, @@ -31,7 +31,7 @@ func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleVa return err } -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` @@ -41,6 +41,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go index 998054c88e..e80c3b0590 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertMultipleValues = `-- name: InsertMultipleValues :exec +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :exec INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) ` @@ -23,7 +23,7 @@ type InsertMultipleValuesParams struct { } func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { - _, err := q.db.Exec(ctx, insertMultipleValues, + _, err := q.db.Exec(ctx, insertMultipleValuesSQL, arg.A, arg.B, arg.A_2, @@ -32,7 +32,7 @@ func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleVa return err } -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` @@ -42,6 +42,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go index aa5109e0a7..c24e326229 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertMultipleValues = `-- name: InsertMultipleValues :exec +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :exec INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) ` @@ -22,7 +22,7 @@ type InsertMultipleValuesParams struct { } func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { - _, err := q.db.ExecContext(ctx, insertMultipleValues, + _, err := q.db.ExecContext(ctx, insertMultipleValuesSQL, arg.A, arg.B, arg.A_2, @@ -31,7 +31,7 @@ func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleVa return err } -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` @@ -41,6 +41,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go index 5bdada7bb8..3c797f59a3 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertMultipleValues = `-- name: InsertMultipleValues :exec +const insertMultipleValuesSQL = `-- name: InsertMultipleValues :exec INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) ` @@ -22,7 +22,7 @@ type InsertMultipleValuesParams struct { } func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { - _, err := q.db.ExecContext(ctx, insertMultipleValues, + _, err := q.db.ExecContext(ctx, insertMultipleValuesSQL, arg.A, arg.B, arg.A_2, @@ -31,7 +31,7 @@ func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleVa return err } -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES (?, ?) ` @@ -41,6 +41,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go index ffff33d238..4319d2f603 100644 --- a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertStatus = `-- name: InsertStatus :exec +const insertStatusSQL = `-- name: InsertStatus :exec INSERT INTO status VALUES ($1, $2) ` @@ -21,6 +21,6 @@ type InsertStatusParams struct { } func (q *Queries) InsertStatus(ctx context.Context, arg InsertStatusParams) error { - _, err := q.db.Exec(ctx, insertStatus, arg.Column1, arg.Column2) + _, err := q.db.Exec(ctx, insertStatusSQL, arg.Column1, arg.Column2) return err } diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go index 1dc377d446..aa84fd4f21 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES (?, ?) ` @@ -20,6 +20,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go index 7146cb6696..83717d9c13 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2) ` @@ -20,6 +20,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go index 73457eb358..ac58640f01 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2) ` @@ -21,6 +21,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.Exec(ctx, insertValues, arg.A, arg.B) + _, err := q.db.Exec(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go index b064886ba9..083540af9f 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const insertValues = `-- name: InsertValues :exec +const insertValuesSQL = `-- name: InsertValues :exec INSERT INTO public.foo (a, b) VALUES ($1, $2) ` @@ -20,6 +20,6 @@ type InsertValuesParams struct { } func (q *Queries) InsertValues(ctx context.Context, arg InsertValuesParams) error { - _, err := q.db.ExecContext(ctx, insertValues, arg.A, arg.B) + _, err := q.db.ExecContext(ctx, insertValuesSQL, arg.A, arg.B) return err } diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go index 18b6e70226..263258fe59 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const get = `-- name: Get :many +const getSQL = `-- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1 ` func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.Query(ctx, get, limit) + rows, err := q.db.Query(ctx, getSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go index 18b6e70226..263258fe59 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const get = `-- name: Get :many +const getSQL = `-- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1 ` func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.Query(ctx, get, limit) + rows, err := q.db.Query(ctx, getSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go index abdc431b60..0d37c86f91 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const get = `-- name: Get :many +const getSQL = `-- name: Get :many SELECT bar, "interval" FROM foo LIMIT $1 ` func (q *Queries) Get(ctx context.Context, limit int32) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, get, limit) + rows, err := q.db.QueryContext(ctx, getSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go index 81c6870a31..06b3fca397 100644 --- a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio, missing_column ) VALUES ( @@ -26,7 +26,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go index ecfe1474c8..d42bb54102 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const aliasExpand = `-- name: AliasExpand :many +const aliasExpandSQL = `-- name: AliasExpand :many SELECT f.id, b.id, title FROM foo f JOIN bar b ON b.id = f.id @@ -24,7 +24,7 @@ type AliasExpandRow struct { } func (q *Queries) AliasExpand(ctx context.Context, id uint64) ([]AliasExpandRow, error) { - rows, err := q.db.QueryContext(ctx, aliasExpand, id) + rows, err := q.db.QueryContext(ctx, aliasExpandSQL, id) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (q *Queries) AliasExpand(ctx context.Context, id uint64) ([]AliasExpandRow, return items, nil } -const aliasJoin = `-- name: AliasJoin :many +const aliasJoinSQL = `-- name: AliasJoin :many SELECT f.id, b.title FROM foo f JOIN bar b ON b.id = f.id @@ -59,7 +59,7 @@ type AliasJoinRow struct { } func (q *Queries) AliasJoin(ctx context.Context, id uint64) ([]AliasJoinRow, error) { - rows, err := q.db.QueryContext(ctx, aliasJoin, id) + rows, err := q.db.QueryContext(ctx, aliasJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go index 8dc5d8f6d3..4f1c0d9409 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const aliasExpand = `-- name: AliasExpand :many +const aliasExpandSQL = `-- name: AliasExpand :many SELECT f.id, b.id, title FROM foo f JOIN bar b ON b.id = f.id @@ -24,7 +24,7 @@ type AliasExpandRow struct { } func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { - rows, err := q.db.Query(ctx, aliasExpand, id) + rows, err := q.db.Query(ctx, aliasExpandSQL, id) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, return items, nil } -const aliasJoin = `-- name: AliasJoin :many +const aliasJoinSQL = `-- name: AliasJoin :many SELECT f.id, b.title FROM foo f JOIN bar b ON b.id = f.id @@ -56,7 +56,7 @@ type AliasJoinRow struct { } func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { - rows, err := q.db.Query(ctx, aliasJoin, id) + rows, err := q.db.Query(ctx, aliasJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go index 59c0c8a555..8466cb861d 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const aliasExpand = `-- name: AliasExpand :many +const aliasExpandSQL = `-- name: AliasExpand :many SELECT f.id, b.id, title FROM foo f JOIN bar b ON b.id = f.id @@ -25,7 +25,7 @@ type AliasExpandRow struct { } func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { - rows, err := q.db.Query(ctx, aliasExpand, id) + rows, err := q.db.Query(ctx, aliasExpandSQL, id) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, return items, nil } -const aliasJoin = `-- name: AliasJoin :many +const aliasJoinSQL = `-- name: AliasJoin :many SELECT f.id, b.title FROM foo f JOIN bar b ON b.id = f.id @@ -57,7 +57,7 @@ type AliasJoinRow struct { } func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { - rows, err := q.db.Query(ctx, aliasJoin, id) + rows, err := q.db.Query(ctx, aliasJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go index ae1350d799..ae8c7d7576 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const aliasExpand = `-- name: AliasExpand :many +const aliasExpandSQL = `-- name: AliasExpand :many SELECT f.id, b.id, title FROM foo f JOIN bar b ON b.id = f.id @@ -24,7 +24,7 @@ type AliasExpandRow struct { } func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, error) { - rows, err := q.db.QueryContext(ctx, aliasExpand, id) + rows, err := q.db.QueryContext(ctx, aliasExpandSQL, id) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (q *Queries) AliasExpand(ctx context.Context, id int32) ([]AliasExpandRow, return items, nil } -const aliasJoin = `-- name: AliasJoin :many +const aliasJoinSQL = `-- name: AliasJoin :many SELECT f.id, b.title FROM foo f JOIN bar b ON b.id = f.id @@ -59,7 +59,7 @@ type AliasJoinRow struct { } func (q *Queries) AliasJoin(ctx context.Context, id int32) ([]AliasJoinRow, error) { - rows, err := q.db.QueryContext(ctx, aliasJoin, id) + rows, err := q.db.QueryContext(ctx, aliasJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go index c7ef880555..e1e12e697e 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const aliasExpand = `-- name: AliasExpand :many +const aliasExpandSQL = `-- name: AliasExpand :many SELECT f.id, b.id, title FROM foo AS f JOIN bar AS b ON b.id = f.id @@ -24,7 +24,7 @@ type AliasExpandRow struct { } func (q *Queries) AliasExpand(ctx context.Context, id int64) ([]AliasExpandRow, error) { - rows, err := q.db.QueryContext(ctx, aliasExpand, id) + rows, err := q.db.QueryContext(ctx, aliasExpandSQL, id) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (q *Queries) AliasExpand(ctx context.Context, id int64) ([]AliasExpandRow, return items, nil } -const aliasJoin = `-- name: AliasJoin :many +const aliasJoinSQL = `-- name: AliasJoin :many SELECT f.id, b.title FROM foo AS f JOIN bar AS b ON b.id = f.id @@ -59,7 +59,7 @@ type AliasJoinRow struct { } func (q *Queries) AliasJoin(ctx context.Context, id int64) ([]AliasJoinRow, error) { - rows, err := q.db.QueryContext(ctx, aliasJoin, id) + rows, err := q.db.QueryContext(ctx, aliasJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go index e617a64d66..f376eae82d 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const testInnerLeft = `-- name: TestInnerLeft :many +const testInnerLeftSQL = `-- name: TestInnerLeft :many SELECT a.a, b.b, c.c FROM a INNER JOIN b ON b.a_id = a.id @@ -24,7 +24,7 @@ type TestInnerLeftRow struct { } func (q *Queries) TestInnerLeft(ctx context.Context) ([]TestInnerLeftRow, error) { - rows, err := q.db.QueryContext(ctx, testInnerLeft) + rows, err := q.db.QueryContext(ctx, testInnerLeftSQL) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (q *Queries) TestInnerLeft(ctx context.Context) ([]TestInnerLeftRow, error) return items, nil } -const testInnerLeftInnerLeft = `-- name: TestInnerLeftInnerLeft :many +const testInnerLeftInnerLeftSQL = `-- name: TestInnerLeftInnerLeft :many SELECT a.a, b.b, c.c, d.d, e.e FROM a INNER JOIN b ON b.a_id = a.id @@ -64,7 +64,7 @@ type TestInnerLeftInnerLeftRow struct { } func (q *Queries) TestInnerLeftInnerLeft(ctx context.Context) ([]TestInnerLeftInnerLeftRow, error) { - rows, err := q.db.QueryContext(ctx, testInnerLeftInnerLeft) + rows, err := q.db.QueryContext(ctx, testInnerLeftInnerLeftSQL) if err != nil { return nil, err } @@ -92,7 +92,7 @@ func (q *Queries) TestInnerLeftInnerLeft(ctx context.Context) ([]TestInnerLeftIn return items, nil } -const testLeftInner = `-- name: TestLeftInner :many +const testLeftInnerSQL = `-- name: TestLeftInner :many SELECT a.a, b.b, c.c FROM a LEFT JOIN b ON b.a_id = a.id @@ -106,7 +106,7 @@ type TestLeftInnerRow struct { } func (q *Queries) TestLeftInner(ctx context.Context) ([]TestLeftInnerRow, error) { - rows, err := q.db.QueryContext(ctx, testLeftInner) + rows, err := q.db.QueryContext(ctx, testLeftInnerSQL) if err != nil { return nil, err } @@ -128,7 +128,7 @@ func (q *Queries) TestLeftInner(ctx context.Context) ([]TestLeftInnerRow, error) return items, nil } -const testLeftInnerLeftInner = `-- name: TestLeftInnerLeftInner :many +const testLeftInnerLeftInnerSQL = `-- name: TestLeftInnerLeftInner :many SELECT a.a, b.b, c.c, d.d, e.e FROM a LEFT JOIN b ON b.a_id = a.id @@ -146,7 +146,7 @@ type TestLeftInnerLeftInnerRow struct { } func (q *Queries) TestLeftInnerLeftInner(ctx context.Context) ([]TestLeftInnerLeftInnerRow, error) { - rows, err := q.db.QueryContext(ctx, testLeftInnerLeftInner) + rows, err := q.db.QueryContext(ctx, testLeftInnerLeftInnerSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go index 8c391e6662..156518f3b4 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const multiFrom = `-- name: MultiFrom :many +const multiFromSQL = `-- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = ? ` func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, multiFrom, login) + rows, err := q.db.QueryContext(ctx, multiFromSQL, login) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go index ec85e0a92e..c944dec09e 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const multiFrom = `-- name: MultiFrom :many +const multiFromSQL = `-- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1 ` func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.Query(ctx, multiFrom, login) + rows, err := q.db.Query(ctx, multiFromSQL, login) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go index ec85e0a92e..c944dec09e 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const multiFrom = `-- name: MultiFrom :many +const multiFromSQL = `-- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1 ` func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.Query(ctx, multiFrom, login) + rows, err := q.db.Query(ctx, multiFromSQL, login) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go index 9a69c149c6..261a8dccc6 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const multiFrom = `-- name: MultiFrom :many +const multiFromSQL = `-- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = $1 ` func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, multiFrom, login) + rows, err := q.db.QueryContext(ctx, multiFromSQL, login) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go index 8c391e6662..156518f3b4 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const multiFrom = `-- name: MultiFrom :many +const multiFromSQL = `-- name: MultiFrom :many SELECT email FROM bar, foo WHERE login = ? ` func (q *Queries) MultiFrom(ctx context.Context, login string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, multiFrom, login) + rows, err := q.db.QueryContext(ctx, multiFromSQL, login) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go index 9e631ea3cc..c8287ddc2b 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const fullJoin = `-- name: FullJoin :many +const fullJoinSQL = `-- name: FullJoin :many SELECT f.id, f.bar_id, b.id FROM foo f FULL OUTER JOIN bar b ON b.id = f.bar_id @@ -24,7 +24,7 @@ type FullJoinRow struct { } func (q *Queries) FullJoin(ctx context.Context, id int32) ([]FullJoinRow, error) { - rows, err := q.db.QueryContext(ctx, fullJoin, id) + rows, err := q.db.QueryContext(ctx, fullJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go index c9d164f846..ce0ea72419 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const columnAsGroupBy = `-- name: ColumnAsGroupBy :many +const columnAsGroupBySQL = `-- name: ColumnAsGroupBy :many SELECT a.email AS id FROM foo a JOIN foo b ON a.email = b.email GROUP BY id ` func (q *Queries) ColumnAsGroupBy(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAsGroupBy) + rows, err := q.db.QueryContext(ctx, columnAsGroupBySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go index 673053362c..1a4241bce5 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const selectAllJoined = `-- name: SelectAllJoined :many +const selectAllJoinedSQL = `-- name: SelectAllJoined :many select events.id from events inner join handled_events on events.ID > handled_events.last_handled_id @@ -19,7 +19,7 @@ where handled_events.handler = $1 ` func (q *Queries) SelectAllJoined(ctx context.Context, handler sql.NullString) ([]sql.NullInt32, error) { - rows, err := q.db.QueryContext(ctx, selectAllJoined, handler) + rows, err := q.db.QueryContext(ctx, selectAllJoinedSQL, handler) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (q *Queries) SelectAllJoined(ctx context.Context, handler sql.NullString) ( return items, nil } -const selectAllJoinedAlias = `-- name: SelectAllJoinedAlias :many +const selectAllJoinedAliasSQL = `-- name: SelectAllJoinedAlias :many select e.id from events e inner join handled_events he on e.ID > he.last_handled_id @@ -50,7 +50,7 @@ where he.handler = $1 ` func (q *Queries) SelectAllJoinedAlias(ctx context.Context, handler sql.NullString) ([]sql.NullInt32, error) { - rows, err := q.db.QueryContext(ctx, selectAllJoinedAlias, handler) + rows, err := q.db.QueryContext(ctx, selectAllJoinedAliasSQL, handler) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go index 8bf553262d..805837f992 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -28,7 +28,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { return items, nil } -const allAuthorsAliases = `-- name: AllAuthorsAliases :many +const allAuthorsAliasesSQL = `-- name: AllAuthorsAliases :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -74,7 +74,7 @@ type AllAuthorsAliasesRow struct { } func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allAuthorsAliasesSQL) if err != nil { return nil, err } @@ -103,7 +103,7 @@ func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow return items, nil } -const allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many +const allAuthorsAliases2SQL = `-- name: AllAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -120,7 +120,7 @@ type AllAuthorsAliases2Row struct { } func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2SQL) if err != nil { return nil, err } @@ -149,7 +149,7 @@ func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2R return items, nil } -const allSuperAuthors = `-- name: AllSuperAuthors :many +const allSuperAuthorsSQL = `-- name: AllSuperAuthors :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors LEFT JOIN super_authors @@ -166,7 +166,7 @@ type AllSuperAuthorsRow struct { } func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthors) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsSQL) if err != nil { return nil, err } @@ -195,7 +195,7 @@ func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, er return items, nil } -const allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many +const allSuperAuthorsAliasesSQL = `-- name: AllSuperAuthorsAliases :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors a LEFT JOIN super_authors sa @@ -212,7 +212,7 @@ type AllSuperAuthorsAliasesRow struct { } func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliasesSQL) if err != nil { return nil, err } @@ -241,7 +241,7 @@ func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthors return items, nil } -const allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many +const allSuperAuthorsAliases2SQL = `-- name: AllSuperAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id FROM authors a LEFT JOIN super_authors sa @@ -258,7 +258,7 @@ type AllSuperAuthorsAliases2Row struct { } func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2SQL) if err != nil { return nil, err } @@ -287,7 +287,7 @@ func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthor return items, nil } -const getMayors = `-- name: GetMayors :many +const getMayorsSQL = `-- name: GetMayors :many SELECT user_id, mayors.full_name @@ -302,7 +302,7 @@ type GetMayorsRow struct { } func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { - rows, err := q.db.QueryContext(ctx, getMayors) + rows, err := q.db.QueryContext(ctx, getMayorsSQL) if err != nil { return nil, err } @@ -324,7 +324,7 @@ func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { return items, nil } -const getMayorsOptional = `-- name: GetMayorsOptional :many +const getMayorsOptionalSQL = `-- name: GetMayorsOptional :many SELECT user_id, cities.city_id, @@ -341,7 +341,7 @@ type GetMayorsOptionalRow struct { } func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { - rows, err := q.db.QueryContext(ctx, getMayorsOptional) + rows, err := q.db.QueryContext(ctx, getMayorsOptionalSQL) if err != nil { return nil, err } @@ -363,7 +363,7 @@ func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow return items, nil } -const getSuggestedUsersByID = `-- name: GetSuggestedUsersByID :many +const getSuggestedUsersByIDSQL = `-- name: GetSuggestedUsersByID :many SELECT DISTINCT u.user_id, u.user_nickname, u.user_email, u.user_display_name, u.user_password, u.user_google_id, u.user_apple_id, u.user_bio, u.user_created_at, u.user_avatar_id, m.media_id, m.media_created_at, m.media_hash, m.media_directory, m.media_author_id, m.media_width, m.media_height FROM users_2 u LEFT JOIN media m @@ -392,7 +392,7 @@ type GetSuggestedUsersByIDRow struct { } func (q *Queries) GetSuggestedUsersByID(ctx context.Context) ([]GetSuggestedUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID) + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByIDSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go index f8d2316731..f08a2744f9 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go @@ -13,7 +13,7 @@ import ( "github.com/google/uuid" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -30,7 +30,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } @@ -59,7 +59,7 @@ func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { return items, nil } -const allAuthorsAliases = `-- name: AllAuthorsAliases :many +const allAuthorsAliasesSQL = `-- name: AllAuthorsAliases :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -76,7 +76,7 @@ type AllAuthorsAliasesRow struct { } func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allAuthorsAliasesSQL) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow return items, nil } -const allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many +const allAuthorsAliases2SQL = `-- name: AllAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors a LEFT JOIN authors p @@ -122,7 +122,7 @@ type AllAuthorsAliases2Row struct { } func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2SQL) if err != nil { return nil, err } @@ -151,7 +151,7 @@ func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2R return items, nil } -const allSuperAuthors = `-- name: AllSuperAuthors :many +const allSuperAuthorsSQL = `-- name: AllSuperAuthors :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors LEFT JOIN super_authors @@ -168,7 +168,7 @@ type AllSuperAuthorsRow struct { } func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthors) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsSQL) if err != nil { return nil, err } @@ -197,7 +197,7 @@ func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, er return items, nil } -const allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many +const allSuperAuthorsAliasesSQL = `-- name: AllSuperAuthorsAliases :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors a LEFT JOIN super_authors sa @@ -214,7 +214,7 @@ type AllSuperAuthorsAliasesRow struct { } func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliasesSQL) if err != nil { return nil, err } @@ -243,7 +243,7 @@ func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthors return items, nil } -const allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many +const allSuperAuthorsAliases2SQL = `-- name: AllSuperAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id FROM authors a LEFT JOIN super_authors sa @@ -260,7 +260,7 @@ type AllSuperAuthorsAliases2Row struct { } func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2SQL) if err != nil { return nil, err } @@ -289,7 +289,7 @@ func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthor return items, nil } -const getMayors = `-- name: GetMayors :many +const getMayorsSQL = `-- name: GetMayors :many SELECT user_id, mayors.full_name @@ -304,7 +304,7 @@ type GetMayorsRow struct { } func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { - rows, err := q.db.QueryContext(ctx, getMayors) + rows, err := q.db.QueryContext(ctx, getMayorsSQL) if err != nil { return nil, err } @@ -326,7 +326,7 @@ func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { return items, nil } -const getMayorsOptional = `-- name: GetMayorsOptional :many +const getMayorsOptionalSQL = `-- name: GetMayorsOptional :many SELECT user_id, mayors.full_name @@ -341,7 +341,7 @@ type GetMayorsOptionalRow struct { } func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { - rows, err := q.db.QueryContext(ctx, getMayorsOptional) + rows, err := q.db.QueryContext(ctx, getMayorsOptionalSQL) if err != nil { return nil, err } @@ -363,7 +363,7 @@ func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow return items, nil } -const getSuggestedUsersByID = `-- name: GetSuggestedUsersByID :many +const getSuggestedUsersByIDSQL = `-- name: GetSuggestedUsersByID :many SELECT DISTINCT u.user_id, u.user_nickname, u.user_email, u.user_display_name, u.user_password, u.user_google_id, u.user_apple_id, u.user_bio, u.user_created_at, u.user_avatar_id, m.media_id, m.media_created_at, m.media_hash, m.media_directory, m.media_author_id, m.media_width, m.media_height FROM users_2 u LEFT JOIN media m @@ -398,7 +398,7 @@ type GetSuggestedUsersByIDRow struct { } func (q *Queries) GetSuggestedUsersByID(ctx context.Context, arg GetSuggestedUsersByIDParams) ([]GetSuggestedUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID, arg.UserID, arg.UserImit) + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByIDSQL, arg.UserID, arg.UserImit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go index 4037bc4718..d368caa88c 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors AS a LEFT JOIN authors AS p ON a.parent_id = p.id @@ -27,7 +27,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } @@ -56,7 +56,7 @@ func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { return items, nil } -const allAuthorsAliases = `-- name: AllAuthorsAliases :many +const allAuthorsAliasesSQL = `-- name: AllAuthorsAliases :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors AS a LEFT JOIN authors AS p ON a.parent_id = p.id @@ -72,7 +72,7 @@ type AllAuthorsAliasesRow struct { } func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allAuthorsAliasesSQL) if err != nil { return nil, err } @@ -101,7 +101,7 @@ func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow return items, nil } -const allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many +const allAuthorsAliases2SQL = `-- name: AllAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id FROM authors AS a LEFT JOIN authors AS p ON a.parent_id = p.id @@ -117,7 +117,7 @@ type AllAuthorsAliases2Row struct { } func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allAuthorsAliases2SQL) if err != nil { return nil, err } @@ -146,7 +146,7 @@ func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2R return items, nil } -const allSuperAuthors = `-- name: AllSuperAuthors :many +const allSuperAuthorsSQL = `-- name: AllSuperAuthors :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors LEFT JOIN super_authors ON authors.parent_id = super_authors.super_id @@ -162,7 +162,7 @@ type AllSuperAuthorsRow struct { } func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthors) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsSQL) if err != nil { return nil, err } @@ -191,7 +191,7 @@ func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, er return items, nil } -const allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many +const allSuperAuthorsAliasesSQL = `-- name: AllSuperAuthorsAliases :many SELECT id, name, parent_id, super_id, super_name, super_parent_id FROM authors AS a LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id @@ -207,7 +207,7 @@ type AllSuperAuthorsAliasesRow struct { } func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliasesSQL) if err != nil { return nil, err } @@ -236,7 +236,7 @@ func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthors return items, nil } -const allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many +const allSuperAuthorsAliases2SQL = `-- name: AllSuperAuthorsAliases2 :many SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id FROM authors AS a LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id @@ -252,7 +252,7 @@ type AllSuperAuthorsAliases2Row struct { } func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { - rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) + rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2SQL) if err != nil { return nil, err } @@ -281,7 +281,7 @@ func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthor return items, nil } -const getMayors = `-- name: GetMayors :many +const getMayorsSQL = `-- name: GetMayors :many SELECT user_id, mayors.full_name @@ -296,7 +296,7 @@ type GetMayorsRow struct { } func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { - rows, err := q.db.QueryContext(ctx, getMayors) + rows, err := q.db.QueryContext(ctx, getMayorsSQL) if err != nil { return nil, err } @@ -318,7 +318,7 @@ func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { return items, nil } -const getMayorsOptional = `-- name: GetMayorsOptional :many +const getMayorsOptionalSQL = `-- name: GetMayorsOptional :many SELECT user_id, cities.city_id, @@ -335,7 +335,7 @@ type GetMayorsOptionalRow struct { } func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { - rows, err := q.db.QueryContext(ctx, getMayorsOptional) + rows, err := q.db.QueryContext(ctx, getMayorsOptionalSQL) if err != nil { return nil, err } @@ -357,7 +357,7 @@ func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow return items, nil } -const getSuggestedUsersByID = `-- name: GetSuggestedUsersByID :many +const getSuggestedUsersByIDSQL = `-- name: GetSuggestedUsersByID :many SELECT DISTINCT u.user_id, u.user_nickname, u.user_email, u.user_display_name, u.user_password, u.user_google_id, u.user_apple_id, u.user_bio, u.user_created_at, u.user_avatar_id, m.media_id, m.media_created_at, m.media_hash, m.media_directory, m.media_author_id, m.media_width, m.media_height FROM users_2 AS u LEFT JOIN media AS m ON u.user_avatar_id = m.media_id @@ -385,7 +385,7 @@ type GetSuggestedUsersByIDRow struct { } func (q *Queries) GetSuggestedUsersByID(ctx context.Context, userID int64) ([]GetSuggestedUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID, userID) + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByIDSQL, userID) if err != nil { return nil, err } @@ -425,7 +425,7 @@ func (q *Queries) GetSuggestedUsersByID(ctx context.Context, userID int64) ([]Ge return items, nil } -const getSuggestedUsersByID2 = `-- name: GetSuggestedUsersByID2 :many +const getSuggestedUsersByID2SQL = `-- name: GetSuggestedUsersByID2 :many SELECT users_2.user_id FROM users_2 LEFT JOIN media AS m ON user_avatar_id = m.media_id @@ -433,7 +433,7 @@ WHERE user_id != ?1 ` func (q *Queries) GetSuggestedUsersByID2(ctx context.Context, userID int64) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID2, userID) + rows, err := q.db.QueryContext(ctx, getSuggestedUsersByID2SQL, userID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go index 65ee188518..5fd099e02b 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, p.id as alias_id, @@ -28,7 +28,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go index 0afcffc576..6ab0a8b886 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, p.id as alias_id, @@ -27,7 +27,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go index 1e566df2da..a9f0a0d24f 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const allAuthors = `-- name: AllAuthors :many +const allAuthorsSQL = `-- name: AllAuthors :many SELECT a.id, a.name, @@ -28,7 +28,7 @@ type AllAuthorsRow struct { } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, allAuthors) + rows, err := q.db.QueryContext(ctx, allAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go index 4f8dfac1f5..80e711286a 100644 --- a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const joinBar = `-- name: JoinBar :one +const joinBarSQL = `-- name: JoinBar :one SELECT f.id, info FROM foo f LEFT JOIN bar b ON b.foo_id = f.id @@ -23,13 +23,13 @@ type JoinBarRow struct { } func (q *Queries) JoinBar(ctx context.Context) (JoinBarRow, error) { - row := q.db.QueryRow(ctx, joinBar) + row := q.db.QueryRow(ctx, joinBarSQL) var i JoinBarRow err := row.Scan(&i.ID, &i.Info) return i, err } -const joinBarAlias = `-- name: JoinBarAlias :one +const joinBarAliasSQL = `-- name: JoinBarAlias :one SELECT f.id, b.info FROM foo f LEFT JOIN bar b ON b.foo_id = f.id @@ -41,7 +41,7 @@ type JoinBarAliasRow struct { } func (q *Queries) JoinBarAlias(ctx context.Context) (JoinBarAliasRow, error) { - row := q.db.QueryRow(ctx, joinBarAlias) + row := q.db.QueryRow(ctx, joinBarAliasSQL) var i JoinBarAliasRow err := row.Scan(&i.ID, &i.Info) return i, err diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go index 9fe80c0d96..51d6261bd2 100644 --- a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT a.name FROM authors a JOIN authors b ON a.id = b.id ORDER BY name ` func (q *Queries) GetAuthor(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, getAuthor) + row := q.db.QueryRow(ctx, getAuthorSQL) var name string err := row.Scan(&name) return name, err diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go index 2e58db30dc..c8333633fe 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const columnAsOrderBy = `-- name: ColumnAsOrderBy :many +const columnAsOrderBySQL = `-- name: ColumnAsOrderBy :many SELECT a.email AS id FROM foo a JOIN foo b ON a.email = b.email ORDER BY id ` func (q *Queries) ColumnAsOrderBy(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAsOrderBy) + rows, err := q.db.QueryContext(ctx, columnAsOrderBySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go index 182045a543..91fd9045e6 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const rightJoin = `-- name: RightJoin :many +const rightJoinSQL = `-- name: RightJoin :many SELECT f.id, f.bar_id, b.id FROM foo f RIGHT JOIN bar b ON b.id = f.bar_id @@ -24,7 +24,7 @@ type RightJoinRow struct { } func (q *Queries) RightJoin(ctx context.Context, id int32) ([]RightJoinRow, error) { - rows, err := q.db.QueryContext(ctx, rightJoin, id) + rows, err := q.db.QueryContext(ctx, rightJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go index d70da97665..2c8897ede9 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const rightJoin = `-- name: RightJoin :many +const rightJoinSQL = `-- name: RightJoin :many SELECT f.id, f.bar_id, b.id FROM foo f RIGHT JOIN bar b ON b.id = f.bar_id @@ -24,7 +24,7 @@ type RightJoinRow struct { } func (q *Queries) RightJoin(ctx context.Context, id int32) ([]RightJoinRow, error) { - rows, err := q.db.QueryContext(ctx, rightJoin, id) + rows, err := q.db.QueryContext(ctx, rightJoinSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go index ed04160492..376ab6539b 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const tableName = `-- name: TableName :one +const tableNameSQL = `-- name: TableName :one SELECT foo.id FROM foo JOIN bar ON foo.bar = bar.id @@ -22,7 +22,7 @@ type TableNameParams struct { } func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { - row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) + row := q.db.QueryRowContext(ctx, tableNameSQL, arg.ID, arg.ID_2) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go index 975f2be114..45b994bf5d 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const tableName = `-- name: TableName :one +const tableNameSQL = `-- name: TableName :one SELECT foo.id FROM foo JOIN bar ON foo.bar = bar.id @@ -22,7 +22,7 @@ type TableNameParams struct { } func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { - row := q.db.QueryRow(ctx, tableName, arg.ID, arg.ID_2) + row := q.db.QueryRow(ctx, tableNameSQL, arg.ID, arg.ID_2) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go index 975f2be114..45b994bf5d 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const tableName = `-- name: TableName :one +const tableNameSQL = `-- name: TableName :one SELECT foo.id FROM foo JOIN bar ON foo.bar = bar.id @@ -22,7 +22,7 @@ type TableNameParams struct { } func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { - row := q.db.QueryRow(ctx, tableName, arg.ID, arg.ID_2) + row := q.db.QueryRow(ctx, tableNameSQL, arg.ID, arg.ID_2) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go index 6dfba960f7..f744d69744 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const tableName = `-- name: TableName :one +const tableNameSQL = `-- name: TableName :one SELECT foo.id FROM foo JOIN bar ON foo.bar = bar.id @@ -22,7 +22,7 @@ type TableNameParams struct { } func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { - row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) + row := q.db.QueryRowContext(ctx, tableNameSQL, arg.ID, arg.ID_2) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go index 2e3648111d..43cb357944 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const tableName = `-- name: TableName :one +const tableNameSQL = `-- name: TableName :one SELECT foo.id FROM foo JOIN bar ON foo.bar = bar.id @@ -22,7 +22,7 @@ type TableNameParams struct { } func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int64, error) { - row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) + row := q.db.QueryRowContext(ctx, tableNameSQL, arg.ID, arg.ID_2) var id int64 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go index 2176a9179f..aa30704b46 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const twoJoins = `-- name: TwoJoins :many +const twoJoinsSQL = `-- name: TwoJoins :many SELECT foo.bar_id, foo.baz_id FROM foo JOIN bar ON bar.id = bar_id @@ -17,7 +17,7 @@ JOIN baz ON baz.id = baz_id ` func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, twoJoins) + rows, err := q.db.QueryContext(ctx, twoJoinsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go index e8875e15bb..c0d50b3cdd 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const twoJoins = `-- name: TwoJoins :many +const twoJoinsSQL = `-- name: TwoJoins :many SELECT foo.bar_id, foo.baz_id FROM foo JOIN bar ON bar.id = bar_id @@ -17,7 +17,7 @@ JOIN baz ON baz.id = baz_id ` func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, twoJoins) + rows, err := q.db.Query(ctx, twoJoinsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go index e8875e15bb..c0d50b3cdd 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const twoJoins = `-- name: TwoJoins :many +const twoJoinsSQL = `-- name: TwoJoins :many SELECT foo.bar_id, foo.baz_id FROM foo JOIN bar ON bar.id = bar_id @@ -17,7 +17,7 @@ JOIN baz ON baz.id = baz_id ` func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, twoJoins) + rows, err := q.db.Query(ctx, twoJoinsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go index 2176a9179f..aa30704b46 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const twoJoins = `-- name: TwoJoins :many +const twoJoinsSQL = `-- name: TwoJoins :many SELECT foo.bar_id, foo.baz_id FROM foo JOIN bar ON bar.id = bar_id @@ -17,7 +17,7 @@ JOIN baz ON baz.id = baz_id ` func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, twoJoins) + rows, err := q.db.QueryContext(ctx, twoJoinsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go index 2176a9179f..aa30704b46 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const twoJoins = `-- name: TwoJoins :many +const twoJoinsSQL = `-- name: TwoJoins :many SELECT foo.bar_id, foo.baz_id FROM foo JOIN bar ON bar.id = bar_id @@ -17,7 +17,7 @@ JOIN baz ON baz.id = baz_id ` func (q *Queries) TwoJoins(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, twoJoins) + rows, err := q.db.QueryContext(ctx, twoJoinsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go index 1c68a2213c..485d29eaa4 100644 --- a/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const percentile = `-- name: Percentile :exec +const percentileSQL = `-- name: Percentile :exec UPDATE group_calc_totals gct SET npn = nem.npn FROM producer_group_attribute ga @@ -18,6 +18,6 @@ WHERE gct.group_id = ga.group_id ` func (q *Queries) Percentile(ctx context.Context) error { - _, err := q.db.Exec(ctx, percentile) + _, err := q.db.Exec(ctx, percentileSQL) return err } diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go index 132e955d20..5ffac02e04 100644 --- a/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const selectJoinUsing = `-- name: SelectJoinUsing :many +const selectJoinUsingSQL = `-- name: SelectJoinUsing :many select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk ` @@ -21,7 +21,7 @@ type SelectJoinUsingRow struct { } func (q *Queries) SelectJoinUsing(ctx context.Context) ([]SelectJoinUsingRow, error) { - rows, err := q.db.Query(ctx, selectJoinUsing) + rows, err := q.db.Query(ctx, selectJoinUsingSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go index cce2078ec6..207fcb3ad0 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const joinNoConstraints = `-- name: JoinNoConstraints :many +const joinNoConstraintsSQL = `-- name: JoinNoConstraints :many SELECT foo.barid FROM foo CROSS JOIN bar @@ -22,7 +22,7 @@ type JoinNoConstraintsParams struct { } func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + rows, err := q.db.QueryContext(ctx, joinNoConstraintsSQL, arg.ID, arg.Owner) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsPa return items, nil } -const joinParamWhereClause = `-- name: JoinParamWhereClause :many +const joinParamWhereClauseSQL = `-- name: JoinParamWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = ? @@ -57,7 +57,7 @@ type JoinParamWhereClauseParams struct { } func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + rows, err := q.db.QueryContext(ctx, joinParamWhereClauseSQL, arg.ID, arg.Owner) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereCl return items, nil } -const joinWhereClause = `-- name: JoinWhereClause :many +const joinWhereClauseSQL = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = barid @@ -87,7 +87,7 @@ WHERE owner = ? ` func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) + rows, err := q.db.QueryContext(ctx, joinWhereClauseSQL, owner) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go index 9415c40a58..461d927f6d 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const joinNoConstraints = `-- name: JoinNoConstraints :many +const joinNoConstraintsSQL = `-- name: JoinNoConstraints :many SELECT foo.barid FROM foo CROSS JOIN bar @@ -22,7 +22,7 @@ type JoinNoConstraintsParams struct { } func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { - rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + rows, err := q.db.Query(ctx, joinNoConstraintsSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsPa return items, nil } -const joinParamWhereClause = `-- name: JoinParamWhereClause :many +const joinParamWhereClauseSQL = `-- name: JoinParamWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = $2 @@ -54,7 +54,7 @@ type JoinParamWhereClauseParams struct { } func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { - rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + rows, err := q.db.Query(ctx, joinParamWhereClauseSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereCl return items, nil } -const joinWhereClause = `-- name: JoinWhereClause :many +const joinWhereClauseSQL = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = barid @@ -81,7 +81,7 @@ WHERE owner = $1 ` func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { - rows, err := q.db.Query(ctx, joinWhereClause, owner) + rows, err := q.db.Query(ctx, joinWhereClauseSQL, owner) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go index 9415c40a58..461d927f6d 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const joinNoConstraints = `-- name: JoinNoConstraints :many +const joinNoConstraintsSQL = `-- name: JoinNoConstraints :many SELECT foo.barid FROM foo CROSS JOIN bar @@ -22,7 +22,7 @@ type JoinNoConstraintsParams struct { } func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { - rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + rows, err := q.db.Query(ctx, joinNoConstraintsSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsPa return items, nil } -const joinParamWhereClause = `-- name: JoinParamWhereClause :many +const joinParamWhereClauseSQL = `-- name: JoinParamWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = $2 @@ -54,7 +54,7 @@ type JoinParamWhereClauseParams struct { } func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { - rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + rows, err := q.db.Query(ctx, joinParamWhereClauseSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereCl return items, nil } -const joinWhereClause = `-- name: JoinWhereClause :many +const joinWhereClauseSQL = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = barid @@ -81,7 +81,7 @@ WHERE owner = $1 ` func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { - rows, err := q.db.Query(ctx, joinWhereClause, owner) + rows, err := q.db.Query(ctx, joinWhereClauseSQL, owner) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go index a3d3265a65..ba7a452aa1 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const joinNoConstraints = `-- name: JoinNoConstraints :many +const joinNoConstraintsSQL = `-- name: JoinNoConstraints :many SELECT foo.barid FROM foo CROSS JOIN bar @@ -22,7 +22,7 @@ type JoinNoConstraintsParams struct { } func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.Owner, arg.ID) + rows, err := q.db.QueryContext(ctx, joinNoConstraintsSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsPa return items, nil } -const joinParamWhereClause = `-- name: JoinParamWhereClause :many +const joinParamWhereClauseSQL = `-- name: JoinParamWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = $2 @@ -57,7 +57,7 @@ type JoinParamWhereClauseParams struct { } func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.Owner, arg.ID) + rows, err := q.db.QueryContext(ctx, joinParamWhereClauseSQL, arg.Owner, arg.ID) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereCl return items, nil } -const joinWhereClause = `-- name: JoinWhereClause :many +const joinWhereClauseSQL = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = barid @@ -87,7 +87,7 @@ WHERE owner = $1 ` func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) + rows, err := q.db.QueryContext(ctx, joinWhereClauseSQL, owner) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go index 8451dbbd08..c1014730f4 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const joinNoConstraints = `-- name: JoinNoConstraints :many +const joinNoConstraintsSQL = `-- name: JoinNoConstraints :many SELECT foo.barid FROM foo CROSS JOIN bar @@ -22,7 +22,7 @@ type JoinNoConstraintsParams struct { } func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + rows, err := q.db.QueryContext(ctx, joinNoConstraintsSQL, arg.ID, arg.Owner) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsPa return items, nil } -const joinParamWhereClause = `-- name: JoinParamWhereClause :many +const joinParamWhereClauseSQL = `-- name: JoinParamWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = ? @@ -57,7 +57,7 @@ type JoinParamWhereClauseParams struct { } func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + rows, err := q.db.QueryContext(ctx, joinParamWhereClauseSQL, arg.ID, arg.Owner) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereCl return items, nil } -const joinWhereClause = `-- name: JoinWhereClause :many +const joinWhereClauseSQL = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo JOIN bar ON bar.id = barid @@ -87,7 +87,7 @@ WHERE owner = ? ` func (q *Queries) JoinWhereClause(ctx context.Context, owner string) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, joinWhereClause, owner) + rows, err := q.db.QueryContext(ctx, joinWhereClauseSQL, owner) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json/mysql/go/query.sql.go b/internal/endtoend/testdata/json/mysql/go/query.sql.go index f65e680d8f..87e9f6f343 100644 --- a/internal/endtoend/testdata/json/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/json/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "encoding/json" ) -const bulkInsert = `-- name: BulkInsert :copyfrom +const bulkInsertSQL = `-- name: BulkInsert :copyfrom INSERT INTO foo (a, b) VALUES (?, ?) ` @@ -19,11 +19,11 @@ type BulkInsertParams struct { B json.RawMessage } -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, b FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, selectFoo) + _, err := q.db.ExecContext(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go index 76286c2699..c049b34f7a 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, b, c, d FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.Exec(ctx, selectFoo) + _, err := q.db.Exec(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go index 76286c2699..c049b34f7a 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, b, c, d FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.Exec(ctx, selectFoo) + _, err := q.db.Exec(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go index b57ef45b4c..f3ae8264b8 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, b, c, d FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, selectFoo) + _, err := q.db.ExecContext(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go index 7ccbdce8f2..0bbb2fd4b1 100644 --- a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getActionCodeByResource = `-- name: GetActionCodeByResource :one +const getActionCodeByResourceSQL = `-- name: GetActionCodeByResource :one SELECT code, arr.item_object ->> 'code' as resource_code FROM sys_actions, jsonb_array_elements(resources) with ordinality arr(item_object, resource) @@ -25,7 +25,7 @@ type GetActionCodeByResourceRow struct { } func (q *Queries) GetActionCodeByResource(ctx context.Context, resource pgtype.Text) (GetActionCodeByResourceRow, error) { - row := q.db.QueryRow(ctx, getActionCodeByResource, resource) + row := q.db.QueryRow(ctx, getActionCodeByResourceSQL, resource) var i GetActionCodeByResourceRow err := row.Scan(&i.Code, &i.ResourceCode) return i, err diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go index 667f9dee62..290fd554a9 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgtype" ) -const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +const selectJSONBBuildArraySQL = `-- name: SelectJSONBBuildArray :one SELECT jsonb_build_array(), jsonb_build_array(1), @@ -29,7 +29,7 @@ type SelectJSONBBuildArrayRow struct { } func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { - row := q.db.QueryRow(ctx, selectJSONBBuildArray) + row := q.db.QueryRow(ctx, selectJSONBBuildArraySQL) var i SelectJSONBBuildArrayRow err := row.Scan( &i.JsonbBuildArray, @@ -41,7 +41,7 @@ func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildAr return i, err } -const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +const selectJSONBBuildObjectSQL = `-- name: SelectJSONBBuildObject :one SELECT jsonb_build_object(), jsonb_build_object('foo'), @@ -59,7 +59,7 @@ type SelectJSONBBuildObjectRow struct { } func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { - row := q.db.QueryRow(ctx, selectJSONBBuildObject) + row := q.db.QueryRow(ctx, selectJSONBBuildObjectSQL) var i SelectJSONBBuildObjectRow err := row.Scan( &i.JsonbBuildObject, @@ -71,7 +71,7 @@ func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildO return i, err } -const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +const selectJSONBuildArraySQL = `-- name: SelectJSONBuildArray :one SELECT json_build_array(), json_build_array(1), @@ -89,7 +89,7 @@ type SelectJSONBuildArrayRow struct { } func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { - row := q.db.QueryRow(ctx, selectJSONBuildArray) + row := q.db.QueryRow(ctx, selectJSONBuildArraySQL) var i SelectJSONBuildArrayRow err := row.Scan( &i.JsonBuildArray, @@ -101,7 +101,7 @@ func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArra return i, err } -const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +const selectJSONBuildObjectSQL = `-- name: SelectJSONBuildObject :one SELECT json_build_object(), json_build_object('foo'), @@ -119,7 +119,7 @@ type SelectJSONBuildObjectRow struct { } func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { - row := q.db.QueryRow(ctx, selectJSONBuildObject) + row := q.db.QueryRow(ctx, selectJSONBuildObjectSQL) var i SelectJSONBuildObjectRow err := row.Scan( &i.JsonBuildObject, diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go index 02daa76dec..892210e8cd 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +const selectJSONBBuildArraySQL = `-- name: SelectJSONBBuildArray :one SELECT jsonb_build_array(), jsonb_build_array(1), @@ -27,7 +27,7 @@ type SelectJSONBBuildArrayRow struct { } func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { - row := q.db.QueryRow(ctx, selectJSONBBuildArray) + row := q.db.QueryRow(ctx, selectJSONBBuildArraySQL) var i SelectJSONBBuildArrayRow err := row.Scan( &i.JsonbBuildArray, @@ -39,7 +39,7 @@ func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildAr return i, err } -const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +const selectJSONBBuildObjectSQL = `-- name: SelectJSONBBuildObject :one SELECT jsonb_build_object(), jsonb_build_object('foo'), @@ -57,7 +57,7 @@ type SelectJSONBBuildObjectRow struct { } func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { - row := q.db.QueryRow(ctx, selectJSONBBuildObject) + row := q.db.QueryRow(ctx, selectJSONBBuildObjectSQL) var i SelectJSONBBuildObjectRow err := row.Scan( &i.JsonbBuildObject, @@ -69,7 +69,7 @@ func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildO return i, err } -const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +const selectJSONBuildArraySQL = `-- name: SelectJSONBuildArray :one SELECT json_build_array(), json_build_array(1), @@ -87,7 +87,7 @@ type SelectJSONBuildArrayRow struct { } func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { - row := q.db.QueryRow(ctx, selectJSONBuildArray) + row := q.db.QueryRow(ctx, selectJSONBuildArraySQL) var i SelectJSONBuildArrayRow err := row.Scan( &i.JsonBuildArray, @@ -99,7 +99,7 @@ func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArra return i, err } -const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +const selectJSONBuildObjectSQL = `-- name: SelectJSONBuildObject :one SELECT json_build_object(), json_build_object('foo'), @@ -117,7 +117,7 @@ type SelectJSONBuildObjectRow struct { } func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { - row := q.db.QueryRow(ctx, selectJSONBuildObject) + row := q.db.QueryRow(ctx, selectJSONBuildObjectSQL) var i SelectJSONBuildObjectRow err := row.Scan( &i.JsonBuildObject, diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go index 4aba355d68..6178b28e4f 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "encoding/json" ) -const selectJSONBBuildArray = `-- name: SelectJSONBBuildArray :one +const selectJSONBBuildArraySQL = `-- name: SelectJSONBBuildArray :one SELECT jsonb_build_array(), jsonb_build_array(1), @@ -28,7 +28,7 @@ type SelectJSONBBuildArrayRow struct { } func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildArrayRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBBuildArray) + row := q.db.QueryRowContext(ctx, selectJSONBBuildArraySQL) var i SelectJSONBBuildArrayRow err := row.Scan( &i.JsonbBuildArray, @@ -40,7 +40,7 @@ func (q *Queries) SelectJSONBBuildArray(ctx context.Context) (SelectJSONBBuildAr return i, err } -const selectJSONBBuildObject = `-- name: SelectJSONBBuildObject :one +const selectJSONBBuildObjectSQL = `-- name: SelectJSONBBuildObject :one SELECT jsonb_build_object(), jsonb_build_object('foo'), @@ -58,7 +58,7 @@ type SelectJSONBBuildObjectRow struct { } func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildObjectRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBBuildObject) + row := q.db.QueryRowContext(ctx, selectJSONBBuildObjectSQL) var i SelectJSONBBuildObjectRow err := row.Scan( &i.JsonbBuildObject, @@ -70,7 +70,7 @@ func (q *Queries) SelectJSONBBuildObject(ctx context.Context) (SelectJSONBBuildO return i, err } -const selectJSONBuildArray = `-- name: SelectJSONBuildArray :one +const selectJSONBuildArraySQL = `-- name: SelectJSONBuildArray :one SELECT json_build_array(), json_build_array(1), @@ -88,7 +88,7 @@ type SelectJSONBuildArrayRow struct { } func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArrayRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBuildArray) + row := q.db.QueryRowContext(ctx, selectJSONBuildArraySQL) var i SelectJSONBuildArrayRow err := row.Scan( &i.JsonBuildArray, @@ -100,7 +100,7 @@ func (q *Queries) SelectJSONBuildArray(ctx context.Context) (SelectJSONBuildArra return i, err } -const selectJSONBuildObject = `-- name: SelectJSONBuildObject :one +const selectJSONBuildObjectSQL = `-- name: SelectJSONBuildObject :one SELECT json_build_object(), json_build_object('foo'), @@ -118,7 +118,7 @@ type SelectJSONBuildObjectRow struct { } func (q *Queries) SelectJSONBuildObject(ctx context.Context) (SelectJSONBuildObjectRow, error) { - row := q.db.QueryRowContext(ctx, selectJSONBuildObject) + row := q.db.QueryRowContext(ctx, selectJSONBuildObjectSQL) var i SelectJSONBuildObjectRow err := row.Scan( &i.JsonBuildObject, diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go index 99aef6bcc0..feba050392 100644 --- a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const findByAddress = `-- name: FindByAddress :one +const findByAddressSQL = `-- name: FindByAddress :one SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = $1 LIMIT 1 ` func (q *Queries) FindByAddress(ctx context.Context, metadata pgtype.Text) (User, error) { - row := q.db.QueryRow(ctx, findByAddress, metadata) + row := q.db.QueryRow(ctx, findByAddressSQL, metadata) var i User err := row.Scan(&i.ID, &i.Metadata) return i, err diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go index 9433531784..69c9381c4d 100644 --- a/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const findByAddress = `-- name: FindByAddress :one +const findByAddressSQL = `-- name: FindByAddress :one SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = ?1 LIMIT 1 ` func (q *Queries) FindByAddress(ctx context.Context, metadata sql.NullString) (User, error) { - row := q.db.QueryRowContext(ctx, findByAddress, metadata) + row := q.db.QueryRowContext(ctx, findByAddressSQL, metadata) var i User err := row.Scan(&i.ID, &i.Metadata) return i, err diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go index a332798542..51a6280dcb 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go index a332798542..51a6280dcb 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go index 9f094da015..3849001732 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go index a332798542..51a6280dcb 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go index 9e99374a13..a9c4452b96 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, type, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go index 9e99374a13..a9c4452b96 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, type, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go index 9e99374a13..a9c4452b96 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, type, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go index 9e99374a13..a9c4452b96 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, type, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go index 9e99374a13..a9c4452b96 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, type, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go index 9358ffe58e..bd997e031b 100644 --- a/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const insertFoo = `-- name: InsertFoo :exec +const insertFooSQL = `-- name: InsertFoo :exec INSERT INTO foo ( a, b, @@ -31,7 +31,7 @@ type InsertFooParams struct { } func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { - _, err := q.db.Exec(ctx, insertFoo, + _, err := q.db.Exec(ctx, insertFooSQL, arg.A, arg.B, arg.C, @@ -40,11 +40,11 @@ func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { return err } -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, b, c, d FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.Exec(ctx, selectFoo) + _, err := q.db.Exec(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go index 655f57af7f..55bb8ec5d7 100644 --- a/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "encoding/json" ) -const insertFoo = `-- name: InsertFoo :exec +const insertFooSQL = `-- name: InsertFoo :exec INSERT INTO foo ( a, b, @@ -46,7 +46,7 @@ type InsertFooParams struct { } func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { - _, err := q.db.ExecContext(ctx, insertFoo, + _, err := q.db.ExecContext(ctx, insertFooSQL, arg.A, arg.B, arg.C, @@ -59,11 +59,11 @@ func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { return err } -const selectFoo = `-- name: SelectFoo :exec +const selectFooSQL = `-- name: SelectFoo :exec SELECT a, json(b), c, json(d), e, json(f), g, json(h) FROM foo ` func (q *Queries) SelectFoo(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, selectFoo) + _, err := q.db.ExecContext(ctx, selectFooSQL) return err } diff --git a/internal/endtoend/testdata/limit/mysql/go/query.sql.go b/internal/endtoend/testdata/limit/mysql/go/query.sql.go index 37df69d7b1..7548504e61 100644 --- a/internal/endtoend/testdata/limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/limit/mysql/go/query.sql.go @@ -9,20 +9,20 @@ import ( "context" ) -const limitMe = `-- name: LimitMe :exec +const limitMeSQL = `-- name: LimitMe :exec UPDATE foo SET bar='baz' LIMIT ? ` func (q *Queries) LimitMe(ctx context.Context, limit int32) error { - _, err := q.db.ExecContext(ctx, limitMe, limit) + _, err := q.db.ExecContext(ctx, limitMeSQL, limit) return err } -const limitMeToo = `-- name: LimitMeToo :exec +const limitMeTooSQL = `-- name: LimitMeToo :exec DELETE FROM foo LIMIT ? ` func (q *Queries) LimitMeToo(ctx context.Context, limit int32) error { - _, err := q.db.ExecContext(ctx, limitMeToo, limit) + _, err := q.db.ExecContext(ctx, limitMeTooSQL, limit) return err } diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go index d0b0b08545..56bc7d0350 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const limitMe = `-- name: LimitMe :many +const limitMeSQL = `-- name: LimitMe :many SELECT bar FROM foo LIMIT $1 ` func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { - rows, err := q.db.Query(ctx, limitMe, limit) + rows, err := q.db.Query(ctx, limitMeSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go index d0b0b08545..56bc7d0350 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const limitMe = `-- name: LimitMe :many +const limitMeSQL = `-- name: LimitMe :many SELECT bar FROM foo LIMIT $1 ` func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { - rows, err := q.db.Query(ctx, limitMe, limit) + rows, err := q.db.Query(ctx, limitMeSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go index 4800120428..65f5de9007 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const limitMe = `-- name: LimitMe :many +const limitMeSQL = `-- name: LimitMe :many SELECT bar FROM foo LIMIT ? ` func (q *Queries) LimitMe(ctx context.Context, limit int64) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, limitMe, limit) + rows, err := q.db.QueryContext(ctx, limitMeSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go index c2aa02643b..011e9c30be 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const limitMe = `-- name: LimitMe :many +const limitMeSQL = `-- name: LimitMe :many SELECT bar FROM foo LIMIT $1 ` func (q *Queries) LimitMe(ctx context.Context, limit int32) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, limitMe, limit) + rows, err := q.db.QueryContext(ctx, limitMeSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go index 4777bbf5b8..d24018a952 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lower = `-- name: Lower :many +const lowerSQL = `-- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 ` @@ -19,7 +19,7 @@ type LowerParams struct { } func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { - rows, err := q.db.Query(ctx, lower, arg.Bar, arg.Bat) + rows, err := q.db.Query(ctx, lowerSQL, arg.Bar, arg.Bat) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go index 4777bbf5b8..d24018a952 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lower = `-- name: Lower :many +const lowerSQL = `-- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 ` @@ -19,7 +19,7 @@ type LowerParams struct { } func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { - rows, err := q.db.Query(ctx, lower, arg.Bar, arg.Bat) + rows, err := q.db.Query(ctx, lowerSQL, arg.Bar, arg.Bat) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go index 9ee4b584ee..0f0cbbbce3 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lower = `-- name: Lower :many +const lowerSQL = `-- name: Lower :many SELECT bar FROM foo WHERE bar = $1 AND LOWER(bat) = $2 ` @@ -19,7 +19,7 @@ type LowerParams struct { } func (q *Queries) Lower(ctx context.Context, arg LowerParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, lower, arg.Bar, arg.Bat) + rows, err := q.db.QueryContext(ctx, lowerSQL, arg.Bar, arg.Bat) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go index 9203b1c5cf..bbcddf5a3e 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +const lowerSwitchedOrderSQL = `-- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) ` @@ -19,7 +19,7 @@ type LowerSwitchedOrderParams struct { } func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { - rows, err := q.db.Query(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + rows, err := q.db.Query(ctx, lowerSwitchedOrderSQL, arg.Bar, arg.Lower) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go index 9203b1c5cf..bbcddf5a3e 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +const lowerSwitchedOrderSQL = `-- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) ` @@ -19,7 +19,7 @@ type LowerSwitchedOrderParams struct { } func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { - rows, err := q.db.Query(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + rows, err := q.db.Query(ctx, lowerSwitchedOrderSQL, arg.Bar, arg.Lower) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go index b1dff8e371..f2b1ce4da3 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const lowerSwitchedOrder = `-- name: LowerSwitchedOrder :many +const lowerSwitchedOrderSQL = `-- name: LowerSwitchedOrder :many SELECT bar FROM foo WHERE bar = $1 AND bat = LOWER($2) ` @@ -19,7 +19,7 @@ type LowerSwitchedOrderParams struct { } func (q *Queries) LowerSwitchedOrder(ctx context.Context, arg LowerSwitchedOrderParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, lowerSwitchedOrder, arg.Bar, arg.Lower) + rows, err := q.db.QueryContext(ctx, lowerSwitchedOrderSQL, arg.Bar, arg.Lower) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go index 39128f44a6..cbdc95a745 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, gender FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go index 39128f44a6..cbdc95a745 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, gender FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go index 1e62759aab..cc95b57e8f 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, gender FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go index bcc1688c13..e6fe22a2aa 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const math = `-- name: Math :many +const mathSQL = `-- name: Math :many SELECT num, num / 1024 as division FROM foo ` @@ -19,7 +19,7 @@ type MathRow struct { } func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { - rows, err := q.db.Query(ctx, math) + rows, err := q.db.Query(ctx, mathSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go index bcc1688c13..e6fe22a2aa 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const math = `-- name: Math :many +const mathSQL = `-- name: Math :many SELECT num, num / 1024 as division FROM foo ` @@ -19,7 +19,7 @@ type MathRow struct { } func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { - rows, err := q.db.Query(ctx, math) + rows, err := q.db.Query(ctx, mathSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go index 038047c4ff..39d4f3c595 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const math = `-- name: Math :many +const mathSQL = `-- name: Math :many SELECT num, num / 1024 as division FROM foo ` @@ -19,7 +19,7 @@ type MathRow struct { } func (q *Queries) Math(ctx context.Context) ([]MathRow, error) { - rows, err := q.db.QueryContext(ctx, math) + rows, err := q.db.QueryContext(ctx, mathSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go index 49981b4181..f8df6d8acf 100644 --- a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const activityStats = `-- name: ActivityStats :one +const activityStatsSQL = `-- name: ActivityStats :one SELECT COUNT(*) as NumOfActivities, MIN(event_time) as MinDate, MAX(event_time) as MaxDate @@ -26,7 +26,7 @@ type ActivityStatsRow struct { } func (q *Queries) ActivityStats(ctx context.Context, accountID int64) (ActivityStatsRow, error) { - row := q.db.QueryRow(ctx, activityStats, accountID) + row := q.db.QueryRow(ctx, activityStatsSQL, accountID) var i ActivityStatsRow err := row.Scan(&i.Numofactivities, &i.Mindate, &i.Maxdate) return i, err diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go index 9520697d35..2bd64e82a9 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const setAuthor = `-- name: SetAuthor :exec +const setAuthorSQL = `-- name: SetAuthor :exec UPDATE authors SET name = ? WHERE id = ? @@ -21,6 +21,6 @@ type SetAuthorParams struct { } func (q *Queries) SetAuthor(ctx context.Context, arg SetAuthorParams) error { - _, err := q.db.ExecContext(ctx, setAuthor, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, setAuthorSQL, arg.Name, arg.ID) return err } diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go index 75ac6d3b75..e9e8d6eec0 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const countOne = `-- name: CountOne :one +const countOneSQL = `-- name: CountOne :one SELECT count(1) FROM bar WHERE id = ? AND name <> ? ` @@ -19,13 +19,13 @@ type CountOneParams struct { } func (q *Queries) CountOne(ctx context.Context, arg CountOneParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countOne, arg.ID, arg.Name) + row := q.db.QueryRowContext(ctx, countOneSQL, arg.ID, arg.Name) var count int64 err := row.Scan(&count) return count, err } -const countThree = `-- name: CountThree :one +const countThreeSQL = `-- name: CountThree :one SELECT count(1) FROM bar WHERE id > ? AND phone <> ? AND name <> ? ` @@ -36,13 +36,13 @@ type CountThreeParams struct { } func (q *Queries) CountThree(ctx context.Context, arg CountThreeParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countThree, arg.ID, arg.Phone, arg.Name) + row := q.db.QueryRowContext(ctx, countThreeSQL, arg.ID, arg.Phone, arg.Name) var count int64 err := row.Scan(&count) return count, err } -const countTwo = `-- name: CountTwo :one +const countTwoSQL = `-- name: CountTwo :one SELECT count(1) FROM bar WHERE id = ? AND name <> ? ` @@ -52,7 +52,7 @@ type CountTwoParams struct { } func (q *Queries) CountTwo(ctx context.Context, arg CountTwoParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countTwo, arg.ID, arg.Name) + row := q.db.QueryRowContext(ctx, countTwoSQL, arg.ID, arg.Name) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go index c38d8be6fc..f10142826b 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const countOne = `-- name: CountOne :one +const countOneSQL = `-- name: CountOne :one SELECT count(1) FROM bar WHERE id = $2 AND name <> $1 LIMIT $3 ` @@ -20,13 +20,13 @@ type CountOneParams struct { } func (q *Queries) CountOne(ctx context.Context, arg CountOneParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countOne, arg.Name, arg.ID, arg.Limit) + row := q.db.QueryRowContext(ctx, countOneSQL, arg.Name, arg.ID, arg.Limit) var count int64 err := row.Scan(&count) return count, err } -const countThree = `-- name: CountThree :one +const countThreeSQL = `-- name: CountThree :one SELECT count(1) FROM bar WHERE id > $2 AND phone <> $3 AND name <> $1 ` @@ -37,13 +37,13 @@ type CountThreeParams struct { } func (q *Queries) CountThree(ctx context.Context, arg CountThreeParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countThree, arg.Name, arg.ID, arg.Phone) + row := q.db.QueryRowContext(ctx, countThreeSQL, arg.Name, arg.ID, arg.Phone) var count int64 err := row.Scan(&count) return count, err } -const countTwo = `-- name: CountTwo :one +const countTwoSQL = `-- name: CountTwo :one SELECT count(1) FROM bar WHERE id = $1 AND name <> $2 ` @@ -53,7 +53,7 @@ type CountTwoParams struct { } func (q *Queries) CountTwo(ctx context.Context, arg CountTwoParams) (int64, error) { - row := q.db.QueryRowContext(ctx, countTwo, arg.ID, arg.Name) + row := q.db.QueryRowContext(ctx, countTwoSQL, arg.ID, arg.Name) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go index 56dfa62d40..0f0dbf53fe 100644 --- a/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const byName = `-- name: ByName :many +const byNameSQL = `-- name: ByName :many SELECT id FROM authors WHERE name = @Name OR bio = @name; ` func (q *Queries) ByName(ctx context.Context, name string) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, byName, sql.Named("Name", name)) + rows, err := q.db.QueryContext(ctx, byNameSQL, sql.Named("Name", name)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go b/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go index 0ff9f72028..97fe4078ae 100644 --- a/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const createItem = `-- name: CreateItem :exec +const createItemSQL = `-- name: CreateItem :exec INSERT INTO items (name, cap_read) VALUES (?, ?) ` @@ -21,22 +21,22 @@ type CreateItemParams struct { // 当新建条目时,需要写入名称和权限 func (q *Queries) CreateItem(ctx context.Context, arg CreateItemParams) error { - _, err := q.db.ExecContext(ctx, createItem, arg.Name, arg.CapRead) + _, err := q.db.ExecContext(ctx, createItemSQL, arg.Name, arg.CapRead) return err } -const deleteItem = `-- name: DeleteItem :one +const deleteItemSQL = `-- name: DeleteItem :one DELETE FROM items WHERE id = ? RETURNING id, name, cap_read ` func (q *Queries) DeleteItem(ctx context.Context, id int64) (Item, error) { - row := q.db.QueryRowContext(ctx, deleteItem, id) + row := q.db.QueryRowContext(ctx, deleteItemSQL, id) var i Item err := row.Scan(&i.ID, &i.Name, &i.CapRead) return i, err } -const listItems = `-- name: ListItems :many +const listItemsSQL = `-- name: ListItems :many SELECT id, name, cap_read FROM items @@ -48,7 +48,7 @@ ORDER BY name // query text out of the source file (#4523, #4235, #4372). // an em dash right here — must not truncate the ORDER BY below func (q *Queries) ListItems(ctx context.Context) ([]Item, error) { - rows, err := q.db.QueryContext(ctx, listItems) + rows, err := q.db.QueryContext(ctx, listItemsSQL) if err != nil { return nil, err } @@ -70,7 +70,7 @@ func (q *Queries) ListItems(ctx context.Context) ([]Item, error) { return items, nil } -const updateItem = `-- name: UpdateItem :exec +const updateItemSQL = `-- name: UpdateItem :exec UPDATE items SET name = ? WHERE id = ? ` @@ -82,6 +82,6 @@ type UpdateItemParams struct { // section — divider between queries func (q *Queries) UpdateItem(ctx context.Context, arg UpdateItemParams) error { - _, err := q.db.ExecContext(ctx, updateItem, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, updateItemSQL, arg.Name, arg.ID) return err } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go index a61f4e8074..6aa72649e6 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { - rows, err := q.db.Query(ctx, textArray) + rows, err := q.db.Query(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go index a61f4e8074..6aa72649e6 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { - rows, err := q.db.Query(ctx, textArray) + rows, err := q.db.Query(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go index 20104c71f8..ec96ce4f64 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/lib/pq" ) -const textArray = `-- name: TextArray :many +const textArraySQL = `-- name: TextArray :many SELECT tags FROM bar ` func (q *Queries) TextArray(ctx context.Context) ([][][]string, error) { - rows, err := q.db.QueryContext(ctx, textArray) + rows, err := q.db.QueryContext(ctx, textArraySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go index 5f30601012..9e293b3ed1 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id, bar FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go index 5f30601012..9e293b3ed1 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id, bar FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go index 0743124580..48dbf48874 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id FROM bar ` func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id, bar FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go index f23260b2b5..51c792e2ee 100644 --- a/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getCollection = `-- name: GetCollection :one +const getCollectionSQL = `-- name: GetCollection :one SELECT id, updated_at FROM collections WHERE id = ? ` func (q *Queries) GetCollection(ctx context.Context, id int64) (Collection, error) { - row := q.db.QueryRowContext(ctx, getCollection, id) + row := q.db.QueryRowContext(ctx, getCollectionSQL, id) var i Collection err := row.Scan(&i.ID, &i.UpdatedAt) return i, err diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go index 1f73628489..a5f4d4b57a 100644 --- a/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getExpiration = `-- name: GetExpiration :one +const getExpirationSQL = `-- name: GetExpiration :one SELECT id, created_at, expiry FROM expirations WHERE id = ? ` func (q *Queries) GetExpiration(ctx context.Context, id int32) (Expiration, error) { - row := q.db.QueryRowContext(ctx, getExpiration, id) + row := q.db.QueryRowContext(ctx, getExpirationSQL, id) var i Expiration err := row.Scan(&i.ID, &i.CreatedAt, &i.Expiry) return i, err diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go index 5878a5a2e1..d3886a17d6 100644 --- a/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectAuthor = `-- name: SelectAuthor :many +const selectAuthorSQL = `-- name: SelectAuthor :many SELECT id, name, bio, explanation FROM authors ` func (q *Queries) SelectAuthor(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, selectAuthor) + rows, err := q.db.QueryContext(ctx, selectAuthorSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go index 1089efbbea..9921b282ab 100644 --- a/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getEmails = `-- name: GetEmails :many +const getEmailsSQL = `-- name: GetEmails :many SELECT email FROM person_email ` func (q *Queries) GetEmails(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getEmails) + rows, err := q.db.QueryContext(ctx, getEmailsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go index 46febc1e16..3ffef06ed2 100644 --- a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go @@ -10,18 +10,18 @@ import ( "database/sql" ) -const inlineHint = `-- name: InlineHint :one +const inlineHintSQL = `-- name: InlineHint :one SELECT /*+ MAX_EXECUTION_TIME(1000) */ bar FROM foo LIMIT 1 ` func (q *Queries) InlineHint(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, inlineHint) + row := q.db.QueryRowContext(ctx, inlineHintSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err } -const multilineHint = `-- name: MultilineHint :one +const multilineHintSQL = `-- name: MultilineHint :one SELECT /*+ MAX_EXECUTION_TIME(1000) */ bar @@ -30,7 +30,7 @@ LIMIT 1 ` func (q *Queries) MultilineHint(ctx context.Context) (sql.NullString, error) { - row := q.db.QueryRowContext(ctx, multilineHint) + row := q.db.QueryRowContext(ctx, multilineHintSQL) var bar sql.NullString err := row.Scan(&bar) return bar, err diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go index d2e9e77ebc..ac50030e40 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const groupConcat = `-- name: GroupConcat :many +const groupConcatSQL = `-- name: GroupConcat :many SELECT student_name, GROUP_CONCAT(test_score) FROM student GROUP BY student_name @@ -22,7 +22,7 @@ type GroupConcatRow struct { } func (q *Queries) GroupConcat(ctx context.Context) ([]GroupConcatRow, error) { - rows, err := q.db.QueryContext(ctx, groupConcat) + rows, err := q.db.QueryContext(ctx, groupConcatSQL) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) GroupConcat(ctx context.Context) ([]GroupConcatRow, error) { return items, nil } -const groupConcatOrderBy = `-- name: GroupConcatOrderBy :many +const groupConcatOrderBySQL = `-- name: GroupConcatOrderBy :many SELECT student_name, GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ') FROM student @@ -57,7 +57,7 @@ type GroupConcatOrderByRow struct { } func (q *Queries) GroupConcatOrderBy(ctx context.Context) ([]GroupConcatOrderByRow, error) { - rows, err := q.db.QueryContext(ctx, groupConcatOrderBy) + rows, err := q.db.QueryContext(ctx, groupConcatOrderBySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go index 4c1bbdac2f..39a56808ae 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go @@ -10,74 +10,74 @@ import ( "time" ) -const dateAddDayHour = `-- name: DateAddDayHour :one +const dateAddDayHourSQL = `-- name: DateAddDayHour :one SELECT DATE_ADD('1900-01-01 00:00:00', INTERVAL '-1 10' DAY_HOUR) ` func (q *Queries) DateAddDayHour(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddDayHour) + row := q.db.QueryRowContext(ctx, dateAddDayHourSQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err } -const dateAddMinuteSecond = `-- name: DateAddMinuteSecond :one +const dateAddMinuteSecondSQL = `-- name: DateAddMinuteSecond :one SELECT DATE_ADD('2100-12-31 23:59:59', INTERVAL '1:1' MINUTE_SECOND) ` func (q *Queries) DateAddMinuteSecond(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddMinuteSecond) + row := q.db.QueryRowContext(ctx, dateAddMinuteSecondSQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err } -const dateAddOneDay = `-- name: DateAddOneDay :one +const dateAddOneDaySQL = `-- name: DateAddOneDay :one SELECT DATE_ADD('2018-05-01',INTERVAL 1 DAY) ` // https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-add func (q *Queries) DateAddOneDay(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddOneDay) + row := q.db.QueryRowContext(ctx, dateAddOneDaySQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err } -const dateAddOneSecond = `-- name: DateAddOneSecond :one +const dateAddOneSecondSQL = `-- name: DateAddOneSecond :one SELECT DATE_ADD('2020-12-31 23:59:59', INTERVAL 1 SECOND) ` func (q *Queries) DateAddOneSecond(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddOneSecond) + row := q.db.QueryRowContext(ctx, dateAddOneSecondSQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err } -const dateAddSecondMicrosecond = `-- name: DateAddSecondMicrosecond :one +const dateAddSecondMicrosecondSQL = `-- name: DateAddSecondMicrosecond :one SELECT DATE_ADD('1992-12-31 23:59:59.000002', INTERVAL '1.999999' SECOND_MICROSECOND) ` func (q *Queries) DateAddSecondMicrosecond(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddSecondMicrosecond) + row := q.db.QueryRowContext(ctx, dateAddSecondMicrosecondSQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err } -const dateAddTimestampOneSecond = `-- name: DateAddTimestampOneSecond :one +const dateAddTimestampOneSecondSQL = `-- name: DateAddTimestampOneSecond :one SELECT DATE_ADD('2018-12-31 23:59:59', INTERVAL 1 DAY) ` func (q *Queries) DateAddTimestampOneSecond(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateAddTimestampOneSecond) + row := q.db.QueryRowContext(ctx, dateAddTimestampOneSecondSQL) var date_add time.Time err := row.Scan(&date_add) return date_add, err diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go index 66f91de495..0568eb256b 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go @@ -10,35 +10,35 @@ import ( "time" ) -const dateSub31Days = `-- name: DateSub31Days :one +const dateSub31DaysSQL = `-- name: DateSub31Days :one SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY) ` func (q *Queries) DateSub31Days(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateSub31Days) + row := q.db.QueryRowContext(ctx, dateSub31DaysSQL) var date_sub time.Time err := row.Scan(&date_sub) return date_sub, err } -const dateSubDaySecond = `-- name: DateSubDaySecond :one +const dateSubDaySecondSQL = `-- name: DateSubDaySecond :one SELECT DATE_SUB('2025-01-01 00:00:00', INTERVAL '1 1:1:1' DAY_SECOND) ` func (q *Queries) DateSubDaySecond(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateSubDaySecond) + row := q.db.QueryRowContext(ctx, dateSubDaySecondSQL) var date_sub time.Time err := row.Scan(&date_sub) return date_sub, err } -const dateSubOneYear = `-- name: DateSubOneYear :one +const dateSubOneYearSQL = `-- name: DateSubOneYear :one SELECT DATE_SUB('2018-05-01',INTERVAL 1 YEAR) ` func (q *Queries) DateSubOneYear(ctx context.Context) (time.Time, error) { - row := q.db.QueryRowContext(ctx, dateSubOneYear) + row := q.db.QueryRowContext(ctx, dateSubOneYearSQL) var date_sub time.Time err := row.Scan(&date_sub) return date_sub, err diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go index 4c6e880c7e..b17927f35b 100644 --- a/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go @@ -9,23 +9,23 @@ import ( "context" ) -const insertVector = `-- name: InsertVector :exec +const insertVectorSQL = `-- name: InsertVector :exec INSERT INTO foo(embedding) VALUES (STRING_TO_VECTOR('[0.1, 0.2, 0.3, 0.4]')) ` func (q *Queries) InsertVector(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, insertVector) + _, err := q.db.ExecContext(ctx, insertVectorSQL) return err } -const selectVector = `-- name: SelectVector :many +const selectVectorSQL = `-- name: SelectVector :many SELECT id FROM foo ORDER BY DISTANCE(STRING_TO_VECTOR('[1.2, 3.4, 5.6]'), embedding, 'L2_squared') LIMIT 10 ` func (q *Queries) SelectVector(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, selectVector) + rows, err := q.db.QueryContext(ctx, selectVectorSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go index 6bdbc78eba..4ca4ca5ac4 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const atParams = `-- name: AtParams :many +const atParamsSQL = `-- name: AtParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -19,7 +19,7 @@ type AtParamsParams struct { } func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { - rows, err := q.db.Query(ctx, atParams, arg.Slug, arg.Filter) + rows, err := q.db.Query(ctx, atParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, e return items, nil } -const funcParams = `-- name: FuncParams :many +const funcParamsSQL = `-- name: FuncParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -48,7 +48,7 @@ type FuncParamsParams struct { } func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { - rows, err := q.db.Query(ctx, funcParams, arg.Slug, arg.Filter) + rows, err := q.db.Query(ctx, funcParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]strin return items, nil } -const insertAtParams = `-- name: InsertAtParams :one +const insertAtParamsSQL = `-- name: InsertAtParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -77,13 +77,13 @@ type InsertAtParamsParams struct { } func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { - row := q.db.QueryRow(ctx, insertAtParams, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, insertAtParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const insertFuncParams = `-- name: InsertFuncParams :one +const insertFuncParamsSQL = `-- name: InsertFuncParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -93,13 +93,13 @@ type InsertFuncParamsParams struct { } func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { - row := q.db.QueryRow(ctx, insertFuncParams, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, insertFuncParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const update = `-- name: Update :one +const updateSQL = `-- name: Update :one UPDATE foo SET name = CASE WHEN $1::bool @@ -115,7 +115,7 @@ type UpdateParams struct { } func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { - row := q.db.QueryRow(ctx, update, arg.SetName, arg.Name) + row := q.db.QueryRow(ctx, updateSQL, arg.SetName, arg.Name) var i Foo err := row.Scan(&i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go index 6bdbc78eba..4ca4ca5ac4 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const atParams = `-- name: AtParams :many +const atParamsSQL = `-- name: AtParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -19,7 +19,7 @@ type AtParamsParams struct { } func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { - rows, err := q.db.Query(ctx, atParams, arg.Slug, arg.Filter) + rows, err := q.db.Query(ctx, atParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, e return items, nil } -const funcParams = `-- name: FuncParams :many +const funcParamsSQL = `-- name: FuncParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -48,7 +48,7 @@ type FuncParamsParams struct { } func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { - rows, err := q.db.Query(ctx, funcParams, arg.Slug, arg.Filter) + rows, err := q.db.Query(ctx, funcParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]strin return items, nil } -const insertAtParams = `-- name: InsertAtParams :one +const insertAtParamsSQL = `-- name: InsertAtParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -77,13 +77,13 @@ type InsertAtParamsParams struct { } func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { - row := q.db.QueryRow(ctx, insertAtParams, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, insertAtParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const insertFuncParams = `-- name: InsertFuncParams :one +const insertFuncParamsSQL = `-- name: InsertFuncParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -93,13 +93,13 @@ type InsertFuncParamsParams struct { } func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { - row := q.db.QueryRow(ctx, insertFuncParams, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, insertFuncParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const update = `-- name: Update :one +const updateSQL = `-- name: Update :one UPDATE foo SET name = CASE WHEN $1::bool @@ -115,7 +115,7 @@ type UpdateParams struct { } func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { - row := q.db.QueryRow(ctx, update, arg.SetName, arg.Name) + row := q.db.QueryRow(ctx, updateSQL, arg.SetName, arg.Name) var i Foo err := row.Scan(&i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go index 625e79abdc..c8569d0ca2 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const atParams = `-- name: AtParams :many +const atParamsSQL = `-- name: AtParams :many SELECT name FROM foo WHERE name = ?1 ` func (q *Queries) AtParams(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, atParams, slug) + rows, err := q.db.QueryContext(ctx, atParamsSQL, slug) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) AtParams(ctx context.Context, slug string) ([]string, error) { return items, nil } -const funcParams = `-- name: FuncParams :many +const funcParamsSQL = `-- name: FuncParams :many SELECT name FROM foo WHERE name = ?1 ` func (q *Queries) FuncParams(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParams, slug) + rows, err := q.db.QueryContext(ctx, funcParamsSQL, slug) if err != nil { return nil, err } @@ -63,7 +63,7 @@ func (q *Queries) FuncParams(ctx context.Context, slug string) ([]string, error) return items, nil } -const insertAtParams = `-- name: InsertAtParams :one +const insertAtParamsSQL = `-- name: InsertAtParams :one INSERT INTO foo(name, bio) values (?1, ?2) returning name ` @@ -73,13 +73,13 @@ type InsertAtParamsParams struct { } func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertAtParams, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, insertAtParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const insertFuncParams = `-- name: InsertFuncParams :one +const insertFuncParamsSQL = `-- name: InsertFuncParams :one INSERT INTO foo(name, bio) values (?1, ?2) returning name ` @@ -89,7 +89,7 @@ type InsertFuncParamsParams struct { } func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertFuncParams, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, insertFuncParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err diff --git a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go index 017f5be962..217436c0a7 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const atParams = `-- name: AtParams :many +const atParamsSQL = `-- name: AtParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -19,7 +19,7 @@ type AtParamsParams struct { } func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, atParams, arg.Slug, arg.Filter) + rows, err := q.db.QueryContext(ctx, atParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (q *Queries) AtParams(ctx context.Context, arg AtParamsParams) ([]string, e return items, nil } -const funcParams = `-- name: FuncParams :many +const funcParamsSQL = `-- name: FuncParams :many SELECT name FROM foo WHERE name = $1 AND $2::bool ` @@ -51,7 +51,7 @@ type FuncParamsParams struct { } func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParams, arg.Slug, arg.Filter) + rows, err := q.db.QueryContext(ctx, funcParamsSQL, arg.Slug, arg.Filter) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func (q *Queries) FuncParams(ctx context.Context, arg FuncParamsParams) ([]strin return items, nil } -const insertAtParams = `-- name: InsertAtParams :one +const insertAtParamsSQL = `-- name: InsertAtParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -83,13 +83,13 @@ type InsertAtParamsParams struct { } func (q *Queries) InsertAtParams(ctx context.Context, arg InsertAtParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertAtParams, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, insertAtParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const insertFuncParams = `-- name: InsertFuncParams :one +const insertFuncParamsSQL = `-- name: InsertFuncParams :one INSERT INTO foo(name, bio) values ($1, $2) returning name ` @@ -99,13 +99,13 @@ type InsertFuncParamsParams struct { } func (q *Queries) InsertFuncParams(ctx context.Context, arg InsertFuncParamsParams) (string, error) { - row := q.db.QueryRowContext(ctx, insertFuncParams, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, insertFuncParamsSQL, arg.Name, arg.Bio) var name string err := row.Scan(&name) return name, err } -const update = `-- name: Update :one +const updateSQL = `-- name: Update :one UPDATE foo SET name = CASE WHEN $1::bool @@ -121,7 +121,7 @@ type UpdateParams struct { } func (q *Queries) Update(ctx context.Context, arg UpdateParams) (Foo, error) { - row := q.db.QueryRowContext(ctx, update, arg.SetName, arg.Name) + row := q.db.QueryRowContext(ctx, updateSQL, arg.SetName, arg.Name) var i Foo err := row.Scan(&i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go index 19e1864a4a..94a51f9c60 100644 --- a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const nestedSelect = `-- name: NestedSelect :one +const nestedSelectSQL = `-- name: NestedSelect :one SELECT latest.id, t.count FROM ( SELECT id, max(update_time) AS update_time @@ -35,7 +35,7 @@ type NestedSelectRow struct { } func (q *Queries) NestedSelect(ctx context.Context, arg NestedSelectParams) (NestedSelectRow, error) { - row := q.db.QueryRow(ctx, nestedSelect, arg.IDs, arg.StartTime) + row := q.db.QueryRow(ctx, nestedSelectSQL, arg.IDs, arg.StartTime) var i NestedSelectRow err := row.Scan(&i.ID, &i.Count) return i, err diff --git a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go index d6c7e29f48..813b670b8a 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getNextID = `-- name: GetNextID :one +const getNextIDSQL = `-- name: GetNextID :one SELECT pk, pk FROM (SELECT nextval('authors_id_seq') as pk) AS alias ` @@ -20,7 +20,7 @@ type GetNextIDRow struct { } func (q *Queries) GetNextID(ctx context.Context) (GetNextIDRow, error) { - row := q.db.QueryRowContext(ctx, getNextID) + row := q.db.QueryRowContext(ctx, getNextIDSQL) var i GetNextIDRow err := row.Scan(&i.Pk, &i.Pk_2) return i, err diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go index 28ee1f135e..7f0c940fdc 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go @@ -9,29 +9,29 @@ import ( "context" ) -const listenTest = `-- name: ListenTest :exec +const listenTestSQL = `-- name: ListenTest :exec LISTEN test ` func (q *Queries) ListenTest(ctx context.Context) error { - _, err := q.db.Exec(ctx, listenTest) + _, err := q.db.Exec(ctx, listenTestSQL) return err } -const notifyTest = `-- name: NotifyTest :exec +const notifyTestSQL = `-- name: NotifyTest :exec NOTIFY test ` func (q *Queries) NotifyTest(ctx context.Context) error { - _, err := q.db.Exec(ctx, notifyTest) + _, err := q.db.Exec(ctx, notifyTestSQL) return err } -const notifyWithMessage = `-- name: NotifyWithMessage :exec +const notifyWithMessageSQL = `-- name: NotifyWithMessage :exec NOTIFY test, 'msg' ` func (q *Queries) NotifyWithMessage(ctx context.Context) error { - _, err := q.db.Exec(ctx, notifyWithMessage) + _, err := q.db.Exec(ctx, notifyWithMessageSQL) return err } diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go index c10fa3470f..565d0595db 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getRestrictedId = `-- name: GetRestrictedId :one +const getRestrictedIdSQL = `-- name: GetRestrictedId :one SELECT NULLIF(id, $1) restricted_id FROM @@ -17,7 +17,7 @@ FROM ` func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, getRestrictedId, id) + row := q.db.QueryRowContext(ctx, getRestrictedIdSQL, id) var restricted_id int64 err := row.Scan(&restricted_id) return restricted_id, err diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go index 46ab5047eb..6aed767ef6 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getRestrictedId = `-- name: GetRestrictedId :one +const getRestrictedIdSQL = `-- name: GetRestrictedId :one SELECT NULLIF(id, $1) restricted_id FROM @@ -17,7 +17,7 @@ FROM ` func (q *Queries) GetRestrictedId(ctx context.Context, id int64) (bool, error) { - row := q.db.QueryRowContext(ctx, getRestrictedId, id) + row := q.db.QueryRowContext(ctx, getRestrictedIdSQL, id) var restricted_id bool err := row.Scan(&restricted_id) return restricted_id, err diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go index 147cb4b15c..2533678369 100644 --- a/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go +++ b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go @@ -8,7 +8,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -23,41 +23,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go index 91b4cefcff..ec83de891c 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go @@ -12,12 +12,12 @@ import ( "github.com/lib/pq" ) -const query_enum_array_table = `-- name: query_enum_array_table :many +const query_enum_array_tableSQL = `-- name: query_enum_array_table :many SELECT id, value FROM array_enum_table ` func (q *Queries) query_enum_array_table(ctx context.Context) ([]ArrayEnumTable, error) { - rows, err := q.db.QueryContext(ctx, query_enum_array_table) + rows, err := q.db.QueryContext(ctx, query_enum_array_tableSQL) if err != nil { return nil, err } @@ -39,18 +39,18 @@ func (q *Queries) query_enum_array_table(ctx context.Context) ([]ArrayEnumTable, return items, nil } -const query_param_enum_table = `-- name: query_param_enum_table :one +const query_param_enum_tableSQL = `-- name: query_param_enum_table :one SELECT id, other, value FROM query_param_enum_table WHERE value = $1 ` func (q *Queries) query_param_enum_table(ctx context.Context, value NullQueryParamEnumTableEnum) (QueryParamEnumTable, error) { - row := q.db.QueryRowContext(ctx, query_param_enum_table, value) + row := q.db.QueryRowContext(ctx, query_param_enum_tableSQL, value) var i QueryParamEnumTable err := row.Scan(&i.ID, &i.Other, &i.Value) return i, err } -const query_param_struct_enum_table = `-- name: query_param_struct_enum_table :one +const query_param_struct_enum_tableSQL = `-- name: query_param_struct_enum_table :one SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2 ` @@ -60,29 +60,29 @@ type query_param_struct_enum_tableParams struct { } func (q *Queries) query_param_struct_enum_table(ctx context.Context, arg query_param_struct_enum_tableParams) (int32, error) { - row := q.db.QueryRowContext(ctx, query_param_struct_enum_table, arg.ID, arg.Value) + row := q.db.QueryRowContext(ctx, query_param_struct_enum_tableSQL, arg.ID, arg.Value) var id int32 err := row.Scan(&id) return id, err } -const query_return_enum_table = `-- name: query_return_enum_table :one +const query_return_enum_tableSQL = `-- name: query_return_enum_table :one SELECT value FROM query_return_enum_table WHERE id = $1 ` func (q *Queries) query_return_enum_table(ctx context.Context, id int32) (NullQueryReturnEnumTableEnum, error) { - row := q.db.QueryRowContext(ctx, query_return_enum_table, id) + row := q.db.QueryRowContext(ctx, query_return_enum_tableSQL, id) var value NullQueryReturnEnumTableEnum err := row.Scan(&value) return value, err } -const query_return_full_table = `-- name: query_return_full_table :many +const query_return_full_tableSQL = `-- name: query_return_full_table :many SELECT id, value FROM query_return_full_table ` func (q *Queries) query_return_full_table(ctx context.Context) ([]QueryReturnFullTable, error) { - rows, err := q.db.QueryContext(ctx, query_return_full_table) + rows, err := q.db.QueryContext(ctx, query_return_full_tableSQL) if err != nil { return nil, err } @@ -104,7 +104,7 @@ func (q *Queries) query_return_full_table(ctx context.Context) ([]QueryReturnFul return items, nil } -const query_return_struct_enum_table = `-- name: query_return_struct_enum_table :one +const query_return_struct_enum_tableSQL = `-- name: query_return_struct_enum_table :one SELECT value, another FROM query_return_struct_enum_table WHERE id = $1 ` @@ -114,13 +114,13 @@ type query_return_struct_enum_tableRow struct { } func (q *Queries) query_return_struct_enum_table(ctx context.Context, id int32) (query_return_struct_enum_tableRow, error) { - row := q.db.QueryRowContext(ctx, query_return_struct_enum_table, id) + row := q.db.QueryRowContext(ctx, query_return_struct_enum_tableSQL, id) var i query_return_struct_enum_tableRow err := row.Scan(&i.Value, &i.Another) return i, err } -const query_sqlc_embed_table = `-- name: query_sqlc_embed_table :one +const query_sqlc_embed_tableSQL = `-- name: query_sqlc_embed_table :one SELECT query_sqlc_embed_table.id, query_sqlc_embed_table.value FROM query_sqlc_embed_table WHERE id = $1 ` @@ -129,7 +129,7 @@ type query_sqlc_embed_tableRow struct { } func (q *Queries) query_sqlc_embed_table(ctx context.Context, id int32) (query_sqlc_embed_tableRow, error) { - row := q.db.QueryRowContext(ctx, query_sqlc_embed_table, id) + row := q.db.QueryRowContext(ctx, query_sqlc_embed_tableSQL, id) var i query_sqlc_embed_tableRow err := row.Scan(&i.QuerySqlcEmbedTable.ID, &i.QuerySqlcEmbedTable.Value) return i, err diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go index de3f8b4c44..102a445ae4 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const upsertAuthor = `-- name: UpsertAuthor :exec +const upsertAuthorSQL = `-- name: UpsertAuthor :exec INSERT INTO authors (name, bio) VALUES (?, ?) ON DUPLICATE KEY @@ -24,11 +24,11 @@ type UpsertAuthorParams struct { } func (q *Queries) UpsertAuthor(ctx context.Context, arg UpsertAuthorParams) error { - _, err := q.db.ExecContext(ctx, upsertAuthor, arg.Name, arg.Bio, arg.Bio_2) + _, err := q.db.ExecContext(ctx, upsertAuthorSQL, arg.Name, arg.Bio, arg.Bio_2) return err } -const upsertAuthorNamed = `-- name: UpsertAuthorNamed :exec +const upsertAuthorNamedSQL = `-- name: UpsertAuthorNamed :exec INSERT INTO authors (name, bio) VALUES (?, ?) ON DUPLICATE KEY @@ -41,6 +41,6 @@ type UpsertAuthorNamedParams struct { } func (q *Queries) UpsertAuthorNamed(ctx context.Context, arg UpsertAuthorNamedParams) error { - _, err := q.db.ExecContext(ctx, upsertAuthorNamed, arg.Name, arg.Bio, arg.Bio) + _, err := q.db.ExecContext(ctx, upsertAuthorNamedSQL, arg.Name, arg.Bio, arg.Bio) return err } diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go index cb3aa32467..0b5bdec765 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const upsertAuthor = `-- name: UpsertAuthor :exec +const upsertAuthorSQL = `-- name: UpsertAuthor :exec INSERT INTO authors (name, bio) VALUES ($1, $2) ON CONFLICT (name) DO UPDATE @@ -23,11 +23,11 @@ type UpsertAuthorParams struct { } func (q *Queries) UpsertAuthor(ctx context.Context, arg UpsertAuthorParams) error { - _, err := q.db.ExecContext(ctx, upsertAuthor, arg.Name, arg.Bio) + _, err := q.db.ExecContext(ctx, upsertAuthorSQL, arg.Name, arg.Bio) return err } -const upsertAuthorNamed = `-- name: UpsertAuthorNamed :exec +const upsertAuthorNamedSQL = `-- name: UpsertAuthorNamed :exec INSERT INTO authors (name, bio) VALUES ($1, $2) ON CONFLICT (name) DO UPDATE @@ -40,6 +40,6 @@ type UpsertAuthorNamedParams struct { } func (q *Queries) UpsertAuthorNamed(ctx context.Context, arg UpsertAuthorNamedParams) error { - _, err := q.db.ExecContext(ctx, upsertAuthorNamed, arg.Name, arg.Bio) + _, err := q.db.ExecContext(ctx, upsertAuthorNamedSQL, arg.Name, arg.Bio) return err } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go index 7641d29b99..116bd80b49 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go @@ -9,25 +9,25 @@ import ( "context" ) -const test2 = `-- name: Test2 :one +const test2SQL = `-- name: Test2 :one select txt from Demo where txt like '%' || $1::text || '%' ` func (q *Queries) Test2(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test2, val) + row := q.db.QueryRow(ctx, test2SQL, val) var txt string err := row.Scan(&txt) return txt, err } -const test3 = `-- name: Test3 :one +const test3SQL = `-- name: Test3 :one select txt from Demo where txt like concat('%', $1::text, '%') ` func (q *Queries) Test3(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test3, val) + row := q.db.QueryRow(ctx, test3SQL, val) var txt string err := row.Scan(&txt) return txt, err diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go index 7641d29b99..116bd80b49 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go @@ -9,25 +9,25 @@ import ( "context" ) -const test2 = `-- name: Test2 :one +const test2SQL = `-- name: Test2 :one select txt from Demo where txt like '%' || $1::text || '%' ` func (q *Queries) Test2(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test2, val) + row := q.db.QueryRow(ctx, test2SQL, val) var txt string err := row.Scan(&txt) return txt, err } -const test3 = `-- name: Test3 :one +const test3SQL = `-- name: Test3 :one select txt from Demo where txt like concat('%', $1::text, '%') ` func (q *Queries) Test3(ctx context.Context, val string) (string, error) { - row := q.db.QueryRow(ctx, test3, val) + row := q.db.QueryRow(ctx, test3SQL, val) var txt string err := row.Scan(&txt) return txt, err diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go index 624aeefb99..4b480b9962 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go @@ -9,25 +9,25 @@ import ( "context" ) -const test2 = `-- name: Test2 :one +const test2SQL = `-- name: Test2 :one select txt from Demo where txt like '%' || $1::text || '%' ` func (q *Queries) Test2(ctx context.Context, val string) (string, error) { - row := q.db.QueryRowContext(ctx, test2, val) + row := q.db.QueryRowContext(ctx, test2SQL, val) var txt string err := row.Scan(&txt) return txt, err } -const test3 = `-- name: Test3 :one +const test3SQL = `-- name: Test3 :one select txt from Demo where txt like concat('%', $1::text, '%') ` func (q *Queries) Test3(ctx context.Context, val string) (string, error) { - row := q.db.QueryRowContext(ctx, test3, val) + row := q.db.QueryRowContext(ctx, test3SQL, val) var txt string err := row.Scan(&txt) return txt, err diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go index e135adee15..f18e181c80 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +const listAuthorsColumnSortSQL = `-- name: ListAuthorsColumnSort :many SELECT id, name, bio FROM authors WHERE id > ? ORDER BY CASE WHEN ? = 'name' THEN name END @@ -21,7 +21,7 @@ type ListAuthorsColumnSortParams struct { } func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortSQL, arg.MinID, arg.SortColumn) if err != nil { return nil, err } @@ -43,13 +43,13 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } -const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +const listAuthorsColumnSortFnWtihArgSQL = `-- name: ListAuthorsColumnSortFnWtihArg :many SELECT id, name, bio FROM authors ORDER BY MOD(id, ?) ` func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, modArg int64) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, modArg) + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArgSQL, modArg) if err != nil { return nil, err } @@ -71,14 +71,14 @@ func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, modArg int return items, nil } -const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many +const listAuthorsNameSortSQL = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > ? ORDER BY name ASC ` func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + rows, err := q.db.QueryContext(ctx, listAuthorsNameSortSQL, minID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go index 01b9d2f52f..0ce8b05646 100644 --- a/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +const listAuthorsColumnSortSQL = `-- name: ListAuthorsColumnSort :many SELECT id, name, bio FROM authors WHERE id > $1 ORDER BY CASE WHEN $2 = 'name' THEN name END @@ -22,7 +22,7 @@ type ListAuthorsColumnSortParams struct { } func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortSQL, arg.MinID, arg.SortColumn) if err != nil { return nil, err } @@ -44,14 +44,14 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } -const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many +const listAuthorsNameSortSQL = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > $1 ORDER BY name ASC ` func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + rows, err := q.db.QueryContext(ctx, listAuthorsNameSortSQL, minID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go index 317e548090..bc9bb291d3 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthorsColumnSort = `-- name: ListAuthorsColumnSort :many +const listAuthorsColumnSortSQL = `-- name: ListAuthorsColumnSort :many SELECT id, name, bio FROM authors WHERE id > $1 ORDER BY CASE WHEN $2 = 'name' THEN name END @@ -21,7 +21,7 @@ type ListAuthorsColumnSortParams struct { } func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsColumnSort, arg.MinID, arg.SortColumn) + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortSQL, arg.MinID, arg.SortColumn) if err != nil { return nil, err } @@ -43,13 +43,13 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } -const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +const listAuthorsColumnSortFnWtihArgSQL = `-- name: ListAuthorsColumnSortFnWtihArg :many SELECT id, name, bio FROM authors ORDER BY MOD(id, $1) ` func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, mod int64) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, mod) + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArgSQL, mod) if err != nil { return nil, err } @@ -71,14 +71,14 @@ func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, mod int64) return items, nil } -const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many +const listAuthorsNameSortSQL = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > $1 ORDER BY name ASC ` func (q *Queries) ListAuthorsNameSort(ctx context.Context, minID int64) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsNameSort, minID) + rows, err := q.db.QueryContext(ctx, listAuthorsNameSortSQL, minID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go index be47780e78..6233dbe216 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthorsUnion = `-- name: ListAuthorsUnion :many +const listAuthorsUnionSQL = `-- name: ListAuthorsUnion :many SELECT name as foo FROM authors UNION SELECT first_name as foo FROM people @@ -17,7 +17,7 @@ ORDER BY foo ` func (q *Queries) ListAuthorsUnion(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsUnion) + rows, err := q.db.QueryContext(ctx, listAuthorsUnionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go index be47780e78..6233dbe216 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthorsUnion = `-- name: ListAuthorsUnion :many +const listAuthorsUnionSQL = `-- name: ListAuthorsUnion :many SELECT name as foo FROM authors UNION SELECT first_name as foo FROM people @@ -17,7 +17,7 @@ ORDER BY foo ` func (q *Queries) ListAuthorsUnion(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsUnion) + rows, err := q.db.QueryContext(ctx, listAuthorsUnionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go index 81bdf96b3f..6a28625361 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go @@ -16,7 +16,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const usersB = `-- name: UsersB :batchmany +const usersBSQL = `-- name: UsersB :batchmany SELECT id FROM "user" WHERE id = $1 ` @@ -33,7 +33,7 @@ func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { vals := []any{ a, } - batch.Queue(usersB, vals...) + batch.Queue(usersBSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &UsersBBatchResults{br, len(id), false} diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go index 569eee29c8..b43b5723c7 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go @@ -16,7 +16,7 @@ var ( ErrBatchAlreadyClosed = errors.New("batch already closed") ) -const usersB = `-- name: UsersB :batchmany +const usersBSQL = `-- name: UsersB :batchmany SELECT id FROM "user" WHERE id = $1 ` @@ -33,7 +33,7 @@ func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { vals := []any{ a, } - batch.Queue(usersB, vals...) + batch.Queue(usersBSQL, vals...) } br := q.db.SendBatch(ctx, batch) return &UsersBBatchResults{br, len(id), false} diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go index 7cd0ecd450..59e59ce3b5 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, user) + rows, err := q.db.QueryContext(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go index 7cd0ecd450..59e59ce3b5 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, user) + rows, err := q.db.QueryContext(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go b/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go index 2e2561375c..8f1821caa7 100644 --- a/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go @@ -12,7 +12,7 @@ import ( models "github.com/sqlc-dev/sqlc/endtoend/output_models_path/postgresql/model" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (name, bio, status) VALUES ($1, $2, $3) RETURNING id, name, bio, status ` @@ -23,7 +23,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (models.Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio, arg.Status) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio, arg.Status) var i models.Author err := row.Scan( &i.ID, @@ -34,12 +34,12 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (mod return i, err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, status FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (models.Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i models.Author err := row.Scan( &i.ID, @@ -50,23 +50,23 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (models.Author, error return i, err } -const getBook = `-- name: GetBook :one +const getBookSQL = `-- name: GetBook :one SELECT id, author_id, title FROM books WHERE id = $1 LIMIT 1 ` func (q *Queries) GetBook(ctx context.Context, id int64) (models.Book, error) { - row := q.db.QueryRowContext(ctx, getBook, id) + row := q.db.QueryRowContext(ctx, getBookSQL, id) var i models.Book err := row.Scan(&i.ID, &i.AuthorID, &i.Title) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, status FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -93,12 +93,12 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { return items, nil } -const listAuthorsByStatus = `-- name: ListAuthorsByStatus :many +const listAuthorsByStatusSQL = `-- name: ListAuthorsByStatus :many SELECT id, name, bio, status FROM authors WHERE status = $1 ORDER BY name ` func (q *Queries) ListAuthorsByStatus(ctx context.Context, status models.Status) ([]models.Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsByStatus, status) + rows, err := q.db.QueryContext(ctx, listAuthorsByStatusSQL, status) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go b/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go index 555d40522e..155012ccdf 100644 --- a/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go +++ b/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go @@ -11,7 +11,7 @@ import ( models "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors (name, status) VALUES ($1, $2) RETURNING id, name, status ` @@ -21,18 +21,18 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (models.Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Status) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Status) var i models.Author err := row.Scan(&i.ID, &i.Name, &i.Status) return i, err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, status FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (models.Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i models.Author err := row.Scan(&i.ID, &i.Name, &i.Status) return i, err diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go b/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go index 4831f5cd0a..816de62dd9 100644 --- a/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go +++ b/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go @@ -11,12 +11,12 @@ import ( models "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, status FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -38,12 +38,12 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { return items, nil } -const listAuthorsByStatus = `-- name: ListAuthorsByStatus :many +const listAuthorsByStatusSQL = `-- name: ListAuthorsByStatus :many SELECT id, name, status FROM authors WHERE status = $1 ORDER BY name ` func (q *Queries) ListAuthorsByStatus(ctx context.Context, status models.Status) ([]models.Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsByStatus, status) + rows, err := q.db.QueryContext(ctx, listAuthorsByStatusSQL, status) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go index 0a94a438a6..fc61877415 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go index 422e04ae9b..6b6637008c 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go index 422e04ae9b..6b6637008c 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go index 0a94a438a6..fc61877415 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go index 185ff73624..90435cd876 100644 --- a/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int64 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go index b054454d7c..3c9cf982b7 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, tags FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go index b054454d7c..3c9cf982b7 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, tags FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go index d86dd18966..397f3328d8 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go @@ -11,13 +11,13 @@ import ( "github.com/lib/pq" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, tags FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go index 5b09ecbea4..158daad2ed 100644 --- a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go index 5b09ecbea4..158daad2ed 100644 --- a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go index 5b09ecbea4..158daad2ed 100644 --- a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go index 6b6cdba685..a8e4c9944c 100644 --- a/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getPrice = `-- name: GetPrice :one +const getPriceSQL = `-- name: GetPrice :one SELECT id, amount FROM prices WHERE id = $1 ` func (q *Queries) GetPrice(ctx context.Context, id int64) (Price, error) { - row := q.db.QueryRowContext(ctx, getPrice, id) + row := q.db.QueryRowContext(ctx, getPriceSQL, id) var i Price err := row.Scan(&i.ID, &i.Amount) return i, err diff --git a/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go index 8325e7d1fe..1b06599589 100644 --- a/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go +++ b/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const findEntry = `-- name: FindEntry :one +const findEntrySQL = `-- name: FindEntry :one SELECT id, value, code FROM entries WHERE value = ? AND code = ? ` @@ -21,7 +21,7 @@ type FindEntryParams struct { } func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { - row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + row := q.db.QueryRowContext(ctx, findEntrySQL, arg.Value, arg.Code) var i Entry err := row.Scan(&i.ID, &i.Value, &i.Code) return i, err diff --git a/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go index b186bff3e3..62f43f1101 100644 --- a/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go +++ b/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go @@ -10,7 +10,7 @@ import ( "encoding/json" ) -const findEntry = `-- name: FindEntry :one +const findEntrySQL = `-- name: FindEntry :one SELECT id, value, code FROM entries WHERE value = $1 AND code = $2 ` @@ -21,7 +21,7 @@ type FindEntryParams struct { } func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { - row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + row := q.db.QueryRowContext(ctx, findEntrySQL, arg.Value, arg.Code) var i Entry err := row.Scan(&i.ID, &i.Value, &i.Code) return i, err diff --git a/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go index fb70006c88..32c18c1e99 100644 --- a/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go +++ b/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const findEntry = `-- name: FindEntry :one +const findEntrySQL = `-- name: FindEntry :one SELECT id, value, code FROM entries WHERE value = ?1 AND code = ?2 ` @@ -20,7 +20,7 @@ type FindEntryParams struct { } func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { - row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + row := q.db.QueryRowContext(ctx, findEntrySQL, arg.Value, arg.Code) var i Entry err := row.Scan(&i.ID, &i.Value, &i.Code) return i, err diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go index 0a94a438a6..fc61877415 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go index 422e04ae9b..6b6637008c 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go index 422e04ae9b..6b6637008c 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRow(ctx, test) + row := q.db.QueryRow(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go index 0a94a438a6..fc61877415 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go index 185ff73624..90435cd876 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int64 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go index 570aca62af..1a5ce821b7 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go @@ -12,12 +12,12 @@ import ( "github.com/sqlc-dev/sqlc-testdata/pkg" ) -const testIN = `-- name: TestIN :many +const testINSQL = `-- name: TestIN :many SELECT other, total, retyped FROM foo WHERE retyped IN (/*SLICE:paramname*/?) ` func (q *Queries) TestIN(ctx context.Context, paramname []pkg.CustomType) ([]Foo, error) { - query := testIN + query := testINSQL var queryParams []any if len(paramname) > 0 { for _, v := range paramname { diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go index 951c4c4cd2..01a589d79b 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go @@ -15,12 +15,12 @@ import ( null_v4 "gopkg.in/guregu/null.v4" ) -const loadFoo = `-- name: LoadFoo :many +const loadFooSQL = `-- name: LoadFoo :many SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 ` func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { - rows, err := q.db.Query(ctx, loadFoo, id) + rows, err := q.db.Query(ctx, loadFooSQL, id) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { return items, nil } -const loadFooWithAliases = `-- name: LoadFooWithAliases :many +const loadFooWithAliasesSQL = `-- name: LoadFooWithAliases :many SELECT id AS aliased_id, other_id AS aliased_other_id, @@ -68,7 +68,7 @@ type LoadFooWithAliasesRow struct { } func (q *Queries) LoadFooWithAliases(ctx context.Context, namedParameterID uuid.UUID) ([]LoadFooWithAliasesRow, error) { - rows, err := q.db.Query(ctx, loadFooWithAliases, namedParameterID) + rows, err := q.db.Query(ctx, loadFooWithAliasesSQL, namedParameterID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go index 332661efd8..30211ba616 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( uuid "github.com/gofrs/uuid" ) -const loadFoo = `-- name: LoadFoo :many +const loadFooSQL = `-- name: LoadFoo :many SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 ` func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { - rows, err := q.db.Query(ctx, loadFoo, id) + rows, err := q.db.Query(ctx, loadFooSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go index de6dbef96c..3e1f01b914 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/gofrs/uuid" ) -const loadFoo = `-- name: LoadFoo :many +const loadFooSQL = `-- name: LoadFoo :many SELECT id, other_id, age, balance, bio, about FROM foo WHERE id = $1 ` func (q *Queries) LoadFoo(ctx context.Context, id uuid.UUID) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, loadFoo, id) + rows, err := q.db.QueryContext(ctx, loadFooSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go index 185ff73624..90435cd876 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int64 err := row.Scan(&column_1) return column_1, err diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go index 4a2a7d1c9e..c3b18fd9b3 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT bar, bam, baz FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go index 4a2a7d1c9e..c3b18fd9b3 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT bar, bam, baz FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go index bd82726320..c906fb99b9 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT bar, bam, baz FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go index 3e0d5a64c9..525bdb2f0d 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go @@ -11,7 +11,7 @@ import ( t "github.com/jackc/pgtype" ) -const test = `-- name: test :exec +const testSQL = `-- name: test :exec SELECT other, total, retyped FROM foo WHERE other = ? and retyped = ? ` @@ -21,6 +21,6 @@ type testParams struct { } func (q *Queries) test(ctx context.Context, arg testParams) error { - _, err := q.db.ExecContext(ctx, test, arg.Other, arg.Retyped) + _, err := q.db.ExecContext(ctx, testSQL, arg.Other, arg.Retyped) return err } diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go index 6e328f6440..88758e646c 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go @@ -11,11 +11,11 @@ import ( t "github.com/jackc/pgtype" ) -const test = `-- name: test :exec +const testSQL = `-- name: test :exec UPDATE foo SET langs = $1 ` func (q *Queries) test(ctx context.Context, langs *t.Text) error { - _, err := q.db.Exec(ctx, test, langs) + _, err := q.db.Exec(ctx, testSQL, langs) return err } diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go index 6e328f6440..88758e646c 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go @@ -11,11 +11,11 @@ import ( t "github.com/jackc/pgtype" ) -const test = `-- name: test :exec +const testSQL = `-- name: test :exec UPDATE foo SET langs = $1 ` func (q *Queries) test(ctx context.Context, langs *t.Text) error { - _, err := q.db.Exec(ctx, test, langs) + _, err := q.db.Exec(ctx, testSQL, langs) return err } diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go index 25d47d9c29..07d39dcd31 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go @@ -11,11 +11,11 @@ import ( t "github.com/jackc/pgtype" ) -const test = `-- name: test :exec +const testSQL = `-- name: test :exec UPDATE foo SET langs = $1 ` func (q *Queries) test(ctx context.Context, langs *t.Text) error { - _, err := q.db.ExecContext(ctx, test, langs) + _, err := q.db.ExecContext(ctx, testSQL, langs) return err } diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go index 3c41c7f5c1..c1f75cfba8 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" ) -const findAccount = `-- name: FindAccount :one +const findAccountSQL = `-- name: FindAccount :one SELECT a.id, a.state, ua.name @@ -31,7 +31,7 @@ type FindAccountRow struct { } func (q *Queries) FindAccount(ctx context.Context, accountID uuid.UUID) (FindAccountRow, error) { - row := q.db.QueryRowContext(ctx, findAccount, accountID) + row := q.db.QueryRowContext(ctx, findAccountSQL, accountID) var i FindAccountRow err := row.Scan(&i.ID, &i.State, &i.Name) return i, err diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go index 626c64e582..456c9ee7e9 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :exec +const createAuthorSQL = `-- name: CreateAuthor :exec INSERT INTO authors ( name, bio ) VALUES ( @@ -24,27 +24,27 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) error { - _, err := q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + _, err := q.db.ExecContext(ctx, createAuthorSQL, arg.Name, arg.Bio) return err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, rating, score, bio FROM authors WHERE id = ? LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan( &i.ID, @@ -56,13 +56,13 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, rating, score, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go index 562981cc80..5d1684e210 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const selectUserByAgeCast = `-- name: SelectUserByAgeCast :many +const selectUserByAgeCastSQL = `-- name: SelectUserByAgeCast :many SELECT first_name FROM users WHERE age > CAST(? AS SIGNED) OR age < CAST(? AS SIGNED) @@ -21,7 +21,7 @@ type SelectUserByAgeCastParams struct { } func (q *Queries) SelectUserByAgeCast(ctx context.Context, arg SelectUserByAgeCastParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByAgeCast, arg.Threshold, arg.Threshold) + rows, err := q.db.QueryContext(ctx, selectUserByAgeCastSQL, arg.Threshold, arg.Threshold) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func (q *Queries) SelectUserByAgeCast(ctx context.Context, arg SelectUserByAgeCa return items, nil } -const selectUserByID = `-- name: SelectUserByID :many +const selectUserByIDSQL = `-- name: SelectUserByID :many SELECT first_name from users where (? = id OR ? = 0) ` @@ -53,7 +53,7 @@ type SelectUserByIDParams struct { } func (q *Queries) SelectUserByID(ctx context.Context, arg SelectUserByIDParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByID, arg.ID, arg.ID) + rows, err := q.db.QueryContext(ctx, selectUserByIDSQL, arg.ID, arg.ID) if err != nil { return nil, err } @@ -75,7 +75,7 @@ func (q *Queries) SelectUserByID(ctx context.Context, arg SelectUserByIDParams) return items, nil } -const selectUserByName = `-- name: SelectUserByName :many +const selectUserByNameSQL = `-- name: SelectUserByName :many SELECT first_name FROM users WHERE first_name = ? @@ -87,7 +87,7 @@ type SelectUserByNameParams struct { } func (q *Queries) SelectUserByName(ctx context.Context, arg SelectUserByNameParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByName, arg.Name, arg.Name) + rows, err := q.db.QueryContext(ctx, selectUserByNameSQL, arg.Name, arg.Name) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func (q *Queries) SelectUserByName(ctx context.Context, arg SelectUserByNamePara return items, nil } -const selectUserQuestion = `-- name: SelectUserQuestion :many +const selectUserQuestionSQL = `-- name: SelectUserQuestion :many SELECT first_name from users where (? = id OR ? = 0) ` @@ -120,7 +120,7 @@ type SelectUserQuestionParams struct { } func (q *Queries) SelectUserQuestion(ctx context.Context, arg SelectUserQuestionParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserQuestion, arg.ID, arg.Column2) + rows, err := q.db.QueryContext(ctx, selectUserQuestionSQL, arg.ID, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go index 56fc2d3690..92130d0503 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const selectUserByID = `-- name: SelectUserByID :many +const selectUserByIDSQL = `-- name: SelectUserByID :many SELECT first_name from users where ($1 = id OR $1 = 0) ` func (q *Queries) SelectUserByID(ctx context.Context, id int32) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByID, id) + rows, err := q.db.QueryContext(ctx, selectUserByIDSQL, id) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) SelectUserByID(ctx context.Context, id int32) ([]sql.NullStrin return items, nil } -const selectUserByName = `-- name: SelectUserByName :many +const selectUserByNameSQL = `-- name: SelectUserByName :many SELECT first_name FROM users WHERE first_name = $1 @@ -46,7 +46,7 @@ WHERE first_name = $1 ` func (q *Queries) SelectUserByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserByName, name) + rows, err := q.db.QueryContext(ctx, selectUserByNameSQL, name) if err != nil { return nil, err } @@ -68,13 +68,13 @@ func (q *Queries) SelectUserByName(ctx context.Context, name sql.NullString) ([] return items, nil } -const selectUserQuestion = `-- name: SelectUserQuestion :many +const selectUserQuestionSQL = `-- name: SelectUserQuestion :many SELECT first_name from users where ($1 = id OR $1 = 0) ` func (q *Queries) SelectUserQuestion(ctx context.Context, id int32) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, selectUserQuestion, id) + rows, err := q.db.QueryContext(ctx, selectUserQuestionSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go index d659225944..7c7ba279e6 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go @@ -11,521 +11,521 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const keywordBreak = `-- name: KeywordBreak :exec +const keywordBreakSQL = `-- name: KeywordBreak :exec SELECT $1::text ` func (q *Queries) KeywordBreak(ctx context.Context, break_ string) error { - _, err := q.db.Exec(ctx, keywordBreak, break_) + _, err := q.db.Exec(ctx, keywordBreakSQL, break_) return err } -const keywordCase = `-- name: KeywordCase :exec +const keywordCaseSQL = `-- name: KeywordCase :exec SELECT $1::text ` func (q *Queries) KeywordCase(ctx context.Context, case_ string) error { - _, err := q.db.Exec(ctx, keywordCase, case_) + _, err := q.db.Exec(ctx, keywordCaseSQL, case_) return err } -const keywordChan = `-- name: KeywordChan :exec +const keywordChanSQL = `-- name: KeywordChan :exec SELECT $1::text ` func (q *Queries) KeywordChan(ctx context.Context, chan_ string) error { - _, err := q.db.Exec(ctx, keywordChan, chan_) + _, err := q.db.Exec(ctx, keywordChanSQL, chan_) return err } -const keywordConst = `-- name: KeywordConst :exec +const keywordConstSQL = `-- name: KeywordConst :exec SELECT $1::text ` func (q *Queries) KeywordConst(ctx context.Context, const_ string) error { - _, err := q.db.Exec(ctx, keywordConst, const_) + _, err := q.db.Exec(ctx, keywordConstSQL, const_) return err } -const keywordContinue = `-- name: KeywordContinue :exec +const keywordContinueSQL = `-- name: KeywordContinue :exec SELECT $1::text ` func (q *Queries) KeywordContinue(ctx context.Context, continue_ string) error { - _, err := q.db.Exec(ctx, keywordContinue, continue_) + _, err := q.db.Exec(ctx, keywordContinueSQL, continue_) return err } -const keywordDefault = `-- name: KeywordDefault :exec +const keywordDefaultSQL = `-- name: KeywordDefault :exec SELECT $1::text ` func (q *Queries) KeywordDefault(ctx context.Context, default_ string) error { - _, err := q.db.Exec(ctx, keywordDefault, default_) + _, err := q.db.Exec(ctx, keywordDefaultSQL, default_) return err } -const keywordDefer = `-- name: KeywordDefer :exec +const keywordDeferSQL = `-- name: KeywordDefer :exec SELECT $1::text ` func (q *Queries) KeywordDefer(ctx context.Context, defer_ string) error { - _, err := q.db.Exec(ctx, keywordDefer, defer_) + _, err := q.db.Exec(ctx, keywordDeferSQL, defer_) return err } -const keywordElse = `-- name: KeywordElse :exec +const keywordElseSQL = `-- name: KeywordElse :exec SELECT $1::text ` func (q *Queries) KeywordElse(ctx context.Context, else_ string) error { - _, err := q.db.Exec(ctx, keywordElse, else_) + _, err := q.db.Exec(ctx, keywordElseSQL, else_) return err } -const keywordFallthrough = `-- name: KeywordFallthrough :exec +const keywordFallthroughSQL = `-- name: KeywordFallthrough :exec SELECT $1::text ` func (q *Queries) KeywordFallthrough(ctx context.Context, fallthrough_ string) error { - _, err := q.db.Exec(ctx, keywordFallthrough, fallthrough_) + _, err := q.db.Exec(ctx, keywordFallthroughSQL, fallthrough_) return err } -const keywordFor = `-- name: KeywordFor :exec +const keywordForSQL = `-- name: KeywordFor :exec SELECT $1::text ` func (q *Queries) KeywordFor(ctx context.Context, for_ string) error { - _, err := q.db.Exec(ctx, keywordFor, for_) + _, err := q.db.Exec(ctx, keywordForSQL, for_) return err } -const keywordFunc = `-- name: KeywordFunc :exec +const keywordFuncSQL = `-- name: KeywordFunc :exec SELECT $1::text ` func (q *Queries) KeywordFunc(ctx context.Context, func_ string) error { - _, err := q.db.Exec(ctx, keywordFunc, func_) + _, err := q.db.Exec(ctx, keywordFuncSQL, func_) return err } -const keywordGo = `-- name: KeywordGo :exec +const keywordGoSQL = `-- name: KeywordGo :exec SELECT $1::text ` func (q *Queries) KeywordGo(ctx context.Context, go_ string) error { - _, err := q.db.Exec(ctx, keywordGo, go_) + _, err := q.db.Exec(ctx, keywordGoSQL, go_) return err } -const keywordGoto = `-- name: KeywordGoto :exec +const keywordGotoSQL = `-- name: KeywordGoto :exec SELECT $1::text ` func (q *Queries) KeywordGoto(ctx context.Context, goto_ string) error { - _, err := q.db.Exec(ctx, keywordGoto, goto_) + _, err := q.db.Exec(ctx, keywordGotoSQL, goto_) return err } -const keywordIf = `-- name: KeywordIf :exec +const keywordIfSQL = `-- name: KeywordIf :exec SELECT $1::text ` func (q *Queries) KeywordIf(ctx context.Context, if_ string) error { - _, err := q.db.Exec(ctx, keywordIf, if_) + _, err := q.db.Exec(ctx, keywordIfSQL, if_) return err } -const keywordImport = `-- name: KeywordImport :exec +const keywordImportSQL = `-- name: KeywordImport :exec SELECT $1::text ` func (q *Queries) KeywordImport(ctx context.Context, import_ string) error { - _, err := q.db.Exec(ctx, keywordImport, import_) + _, err := q.db.Exec(ctx, keywordImportSQL, import_) return err } -const keywordInterface = `-- name: KeywordInterface :exec +const keywordInterfaceSQL = `-- name: KeywordInterface :exec SELECT $1::text ` func (q *Queries) KeywordInterface(ctx context.Context, interface_ string) error { - _, err := q.db.Exec(ctx, keywordInterface, interface_) + _, err := q.db.Exec(ctx, keywordInterfaceSQL, interface_) return err } -const keywordMap = `-- name: KeywordMap :exec +const keywordMapSQL = `-- name: KeywordMap :exec SELECT $1::text ` func (q *Queries) KeywordMap(ctx context.Context, map_ string) error { - _, err := q.db.Exec(ctx, keywordMap, map_) + _, err := q.db.Exec(ctx, keywordMapSQL, map_) return err } -const keywordPackage = `-- name: KeywordPackage :exec +const keywordPackageSQL = `-- name: KeywordPackage :exec SELECT $1::text ` func (q *Queries) KeywordPackage(ctx context.Context, package_ string) error { - _, err := q.db.Exec(ctx, keywordPackage, package_) + _, err := q.db.Exec(ctx, keywordPackageSQL, package_) return err } -const keywordQ = `-- name: KeywordQ :exec +const keywordQSQL = `-- name: KeywordQ :exec SELECT $1::text ` func (q *Queries) KeywordQ(ctx context.Context, q_ string) error { - _, err := q.db.Exec(ctx, keywordQ, q_) + _, err := q.db.Exec(ctx, keywordQSQL, q_) return err } -const keywordRange = `-- name: KeywordRange :exec +const keywordRangeSQL = `-- name: KeywordRange :exec SELECT $1::text ` func (q *Queries) KeywordRange(ctx context.Context, range_ string) error { - _, err := q.db.Exec(ctx, keywordRange, range_) + _, err := q.db.Exec(ctx, keywordRangeSQL, range_) return err } -const keywordReturn = `-- name: KeywordReturn :exec +const keywordReturnSQL = `-- name: KeywordReturn :exec SELECT $1::text ` func (q *Queries) KeywordReturn(ctx context.Context, return_ string) error { - _, err := q.db.Exec(ctx, keywordReturn, return_) + _, err := q.db.Exec(ctx, keywordReturnSQL, return_) return err } -const keywordSelect = `-- name: KeywordSelect :exec +const keywordSelectSQL = `-- name: KeywordSelect :exec SELECT $1::text ` func (q *Queries) KeywordSelect(ctx context.Context, select_ string) error { - _, err := q.db.Exec(ctx, keywordSelect, select_) + _, err := q.db.Exec(ctx, keywordSelectSQL, select_) return err } -const keywordStruct = `-- name: KeywordStruct :exec +const keywordStructSQL = `-- name: KeywordStruct :exec SELECT $1::text ` func (q *Queries) KeywordStruct(ctx context.Context, struct_ string) error { - _, err := q.db.Exec(ctx, keywordStruct, struct_) + _, err := q.db.Exec(ctx, keywordStructSQL, struct_) return err } -const keywordSwitch = `-- name: KeywordSwitch :exec +const keywordSwitchSQL = `-- name: KeywordSwitch :exec SELECT $1::text ` func (q *Queries) KeywordSwitch(ctx context.Context, switch_ string) error { - _, err := q.db.Exec(ctx, keywordSwitch, switch_) + _, err := q.db.Exec(ctx, keywordSwitchSQL, switch_) return err } -const keywordType = `-- name: KeywordType :exec +const keywordTypeSQL = `-- name: KeywordType :exec SELECT $1::text ` func (q *Queries) KeywordType(ctx context.Context, type_ string) error { - _, err := q.db.Exec(ctx, keywordType, type_) + _, err := q.db.Exec(ctx, keywordTypeSQL, type_) return err } -const keywordVar = `-- name: KeywordVar :exec +const keywordVarSQL = `-- name: KeywordVar :exec SELECT $1::text ` func (q *Queries) KeywordVar(ctx context.Context, var_ string) error { - _, err := q.db.Exec(ctx, keywordVar, var_) + _, err := q.db.Exec(ctx, keywordVarSQL, var_) return err } -const selectBreak = `-- name: SelectBreak :one +const selectBreakSQL = `-- name: SelectBreak :one SELECT "break" FROM go_keywords ` func (q *Queries) SelectBreak(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectBreak) + row := q.db.QueryRow(ctx, selectBreakSQL) var break_ pgtype.Text err := row.Scan(&break_) return break_, err } -const selectCase = `-- name: SelectCase :one +const selectCaseSQL = `-- name: SelectCase :one SELECT "case" FROM go_keywords ` func (q *Queries) SelectCase(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectCase) + row := q.db.QueryRow(ctx, selectCaseSQL) var case_ pgtype.Text err := row.Scan(&case_) return case_, err } -const selectChan = `-- name: SelectChan :one +const selectChanSQL = `-- name: SelectChan :one SELECT "chan" FROM go_keywords ` func (q *Queries) SelectChan(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectChan) + row := q.db.QueryRow(ctx, selectChanSQL) var chan_ pgtype.Text err := row.Scan(&chan_) return chan_, err } -const selectConst = `-- name: SelectConst :one +const selectConstSQL = `-- name: SelectConst :one SELECT "const" FROM go_keywords ` func (q *Queries) SelectConst(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectConst) + row := q.db.QueryRow(ctx, selectConstSQL) var const_ pgtype.Text err := row.Scan(&const_) return const_, err } -const selectContinue = `-- name: SelectContinue :one +const selectContinueSQL = `-- name: SelectContinue :one SELECT "continue" FROM go_keywords ` func (q *Queries) SelectContinue(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectContinue) + row := q.db.QueryRow(ctx, selectContinueSQL) var continue_ pgtype.Text err := row.Scan(&continue_) return continue_, err } -const selectDefault = `-- name: SelectDefault :one +const selectDefaultSQL = `-- name: SelectDefault :one SELECT "default" FROM go_keywords ` func (q *Queries) SelectDefault(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectDefault) + row := q.db.QueryRow(ctx, selectDefaultSQL) var default_ pgtype.Text err := row.Scan(&default_) return default_, err } -const selectDefer = `-- name: SelectDefer :one +const selectDeferSQL = `-- name: SelectDefer :one SELECT "defer" FROM go_keywords ` func (q *Queries) SelectDefer(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectDefer) + row := q.db.QueryRow(ctx, selectDeferSQL) var defer_ pgtype.Text err := row.Scan(&defer_) return defer_, err } -const selectElse = `-- name: SelectElse :one +const selectElseSQL = `-- name: SelectElse :one SELECT "else" FROM go_keywords ` func (q *Queries) SelectElse(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectElse) + row := q.db.QueryRow(ctx, selectElseSQL) var else_ pgtype.Text err := row.Scan(&else_) return else_, err } -const selectFallthrough = `-- name: SelectFallthrough :one +const selectFallthroughSQL = `-- name: SelectFallthrough :one SELECT "fallthrough" FROM go_keywords ` func (q *Queries) SelectFallthrough(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectFallthrough) + row := q.db.QueryRow(ctx, selectFallthroughSQL) var fallthrough_ pgtype.Text err := row.Scan(&fallthrough_) return fallthrough_, err } -const selectFor = `-- name: SelectFor :one +const selectForSQL = `-- name: SelectFor :one SELECT "for" FROM go_keywords ` func (q *Queries) SelectFor(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectFor) + row := q.db.QueryRow(ctx, selectForSQL) var for_ pgtype.Text err := row.Scan(&for_) return for_, err } -const selectFunc = `-- name: SelectFunc :one +const selectFuncSQL = `-- name: SelectFunc :one SELECT "func" FROM go_keywords ` func (q *Queries) SelectFunc(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectFunc) + row := q.db.QueryRow(ctx, selectFuncSQL) var func_ pgtype.Text err := row.Scan(&func_) return func_, err } -const selectGo = `-- name: SelectGo :one +const selectGoSQL = `-- name: SelectGo :one SELECT "go" FROM go_keywords ` func (q *Queries) SelectGo(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectGo) + row := q.db.QueryRow(ctx, selectGoSQL) var go_ pgtype.Text err := row.Scan(&go_) return go_, err } -const selectGoto = `-- name: SelectGoto :one +const selectGotoSQL = `-- name: SelectGoto :one SELECT "goto" FROM go_keywords ` func (q *Queries) SelectGoto(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectGoto) + row := q.db.QueryRow(ctx, selectGotoSQL) var goto_ pgtype.Text err := row.Scan(&goto_) return goto_, err } -const selectIf = `-- name: SelectIf :one +const selectIfSQL = `-- name: SelectIf :one SELECT "if" FROM go_keywords ` func (q *Queries) SelectIf(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectIf) + row := q.db.QueryRow(ctx, selectIfSQL) var if_ pgtype.Text err := row.Scan(&if_) return if_, err } -const selectImport = `-- name: SelectImport :one +const selectImportSQL = `-- name: SelectImport :one SELECT "import" FROM go_keywords ` func (q *Queries) SelectImport(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectImport) + row := q.db.QueryRow(ctx, selectImportSQL) var import_ pgtype.Text err := row.Scan(&import_) return import_, err } -const selectInterface = `-- name: SelectInterface :one +const selectInterfaceSQL = `-- name: SelectInterface :one SELECT "interface" FROM go_keywords ` func (q *Queries) SelectInterface(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectInterface) + row := q.db.QueryRow(ctx, selectInterfaceSQL) var interface_ pgtype.Text err := row.Scan(&interface_) return interface_, err } -const selectMap = `-- name: SelectMap :one +const selectMapSQL = `-- name: SelectMap :one SELECT "map" FROM go_keywords ` func (q *Queries) SelectMap(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectMap) + row := q.db.QueryRow(ctx, selectMapSQL) var map_ pgtype.Text err := row.Scan(&map_) return map_, err } -const selectPackage = `-- name: SelectPackage :one +const selectPackageSQL = `-- name: SelectPackage :one SELECT "package" FROM go_keywords ` func (q *Queries) SelectPackage(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectPackage) + row := q.db.QueryRow(ctx, selectPackageSQL) var package_ pgtype.Text err := row.Scan(&package_) return package_, err } -const selectQ = `-- name: SelectQ :one +const selectQSQL = `-- name: SelectQ :one SELECT "q" FROM go_keywords ` func (q *Queries) SelectQ(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectQ) + row := q.db.QueryRow(ctx, selectQSQL) var q_ pgtype.Text err := row.Scan(&q_) return q_, err } -const selectRange = `-- name: SelectRange :one +const selectRangeSQL = `-- name: SelectRange :one SELECT "range" FROM go_keywords ` func (q *Queries) SelectRange(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectRange) + row := q.db.QueryRow(ctx, selectRangeSQL) var range_ pgtype.Text err := row.Scan(&range_) return range_, err } -const selectReturn = `-- name: SelectReturn :one +const selectReturnSQL = `-- name: SelectReturn :one SELECT "return" FROM go_keywords ` func (q *Queries) SelectReturn(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectReturn) + row := q.db.QueryRow(ctx, selectReturnSQL) var return_ pgtype.Text err := row.Scan(&return_) return return_, err } -const selectSelect = `-- name: SelectSelect :one +const selectSelectSQL = `-- name: SelectSelect :one SELECT "select" FROM go_keywords ` func (q *Queries) SelectSelect(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectSelect) + row := q.db.QueryRow(ctx, selectSelectSQL) var select_ pgtype.Text err := row.Scan(&select_) return select_, err } -const selectStruct = `-- name: SelectStruct :one +const selectStructSQL = `-- name: SelectStruct :one SELECT "struct" FROM go_keywords ` func (q *Queries) SelectStruct(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectStruct) + row := q.db.QueryRow(ctx, selectStructSQL) var struct_ pgtype.Text err := row.Scan(&struct_) return struct_, err } -const selectSwitch = `-- name: SelectSwitch :one +const selectSwitchSQL = `-- name: SelectSwitch :one SELECT "switch" FROM go_keywords ` func (q *Queries) SelectSwitch(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectSwitch) + row := q.db.QueryRow(ctx, selectSwitchSQL) var switch_ pgtype.Text err := row.Scan(&switch_) return switch_, err } -const selectType = `-- name: SelectType :one +const selectTypeSQL = `-- name: SelectType :one SELECT "type" FROM go_keywords ` func (q *Queries) SelectType(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectType) + row := q.db.QueryRow(ctx, selectTypeSQL) var type_ pgtype.Text err := row.Scan(&type_) return type_, err } -const selectVar = `-- name: SelectVar :one +const selectVarSQL = `-- name: SelectVar :one SELECT "var" FROM go_keywords ` func (q *Queries) SelectVar(ctx context.Context) (pgtype.Text, error) { - row := q.db.QueryRow(ctx, selectVar) + row := q.db.QueryRow(ctx, selectVarSQL) var var_ pgtype.Text err := row.Scan(&var_) return var_, err diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go index 9cdd1a58a3..0148f071fd 100644 --- a/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getGroups = `-- name: GetGroups :many +const getGroupsSQL = `-- name: GetGroups :many SELECT rg.groupId, rg.groupName @@ -32,7 +32,7 @@ type GetGroupsRow struct { } func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { - rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + rows, err := q.db.QueryContext(ctx, getGroupsSQL, arg.GroupName, arg.GroupId) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go index 695d59f2f0..5f005ba942 100644 --- a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getGroups = `-- name: GetGroups :many +const getGroupsSQL = `-- name: GetGroups :many SELECT rg.groupId, rg.groupName @@ -32,7 +32,7 @@ type GetGroupsRow struct { } func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { - rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + rows, err := q.db.QueryContext(ctx, getGroupsSQL, arg.GroupName, arg.GroupId) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go index 9449c9d090..2d6985d347 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = ? ` @@ -21,13 +21,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.db.QueryRowContext(ctx, getUserByID, targetID) + row := q.db.QueryRowContext(ctx, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES (?, ?) ` @@ -37,11 +37,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.db.ExecContext(ctx, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.db.ExecContext(ctx, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const limitSQLCArg = `-- name: LimitSQLCArg :many +const limitSQLCArgSQL = `-- name: LimitSQLCArg :many select first_name, id FROM users LIMIT ? ` @@ -51,7 +51,7 @@ type LimitSQLCArgRow struct { } func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { - rows, err := q.db.QueryContext(ctx, limitSQLCArg, limit) + rows, err := q.db.QueryContext(ctx, limitSQLCArgSQL, limit) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArg return items, nil } -const listUserOrders = `-- name: ListUserOrders :many +const listUserOrdersSQL = `-- name: ListUserOrders :many SELECT users.id, users.first_name, @@ -91,7 +91,7 @@ type ListUserOrdersRow struct { } func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUserOrdersRow, error) { - rows, err := q.db.QueryContext(ctx, listUserOrders, minPrice) + rows, err := q.db.QueryContext(ctx, listUserOrdersSQL, minPrice) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUs return items, nil } -const listUserParenExpr = `-- name: ListUserParenExpr :many +const listUserParenExprSQL = `-- name: ListUserParenExpr :many SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') AND id > ? ORDER BY id @@ -126,7 +126,7 @@ type ListUserParenExprParams struct { } func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { - rows, err := q.db.QueryContext(ctx, listUserParenExpr, arg.ID, arg.Limit) + rows, err := q.db.QueryContext(ctx, listUserParenExprSQL, arg.ID, arg.Limit) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprPa return items, nil } -const listUsersByFamily = `-- name: ListUsersByFamily :many +const listUsersByFamilySQL = `-- name: ListUsersByFamily :many SELECT first_name, last_name FROM users WHERE age < ? AND last_name = ? ` @@ -169,7 +169,7 @@ type ListUsersByFamilyRow struct { } func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + rows, err := q.db.QueryContext(ctx, listUsersByFamilySQL, arg.MaxAge, arg.InFamily) if err != nil { return nil, err } @@ -191,7 +191,7 @@ func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyPa return items, nil } -const listUsersByID = `-- name: ListUsersByID :many +const listUsersByIDSQL = `-- name: ListUsersByID :many SELECT first_name, id, last_name FROM users WHERE id < ? ` @@ -202,7 +202,7 @@ type ListUsersByIDRow struct { } func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByID, id) + rows, err := q.db.QueryContext(ctx, listUsersByIDSQL, id) if err != nil { return nil, err } @@ -224,7 +224,7 @@ func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDR return items, nil } -const listUsersWithLimit = `-- name: ListUsersWithLimit :many +const listUsersWithLimitSQL = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT ? ` @@ -234,7 +234,7 @@ type ListUsersWithLimitRow struct { } func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) + rows, err := q.db.QueryContext(ctx, listUsersWithLimitSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go index 01addb87ca..98a8131713 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go @@ -12,7 +12,7 @@ import ( "github.com/jackc/pgtype" ) -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` @@ -23,13 +23,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.db.QueryRow(ctx, getUserByID, targetID) + row := q.db.QueryRow(ctx, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES ($1, $2) ` @@ -39,11 +39,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.db.Exec(ctx, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.db.Exec(ctx, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const limitSQLCArg = `-- name: LimitSQLCArg :many +const limitSQLCArgSQL = `-- name: LimitSQLCArg :many select first_name, id FROM users LIMIT $1 ` @@ -53,7 +53,7 @@ type LimitSQLCArgRow struct { } func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { - rows, err := q.db.Query(ctx, limitSQLCArg, limit) + rows, err := q.db.Query(ctx, limitSQLCArgSQL, limit) if err != nil { return nil, err } @@ -72,7 +72,7 @@ func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArg return items, nil } -const listUserOrders = `-- name: ListUserOrders :many +const listUserOrdersSQL = `-- name: ListUserOrders :many SELECT users.id, users.first_name, @@ -90,7 +90,7 @@ type ListUserOrdersRow struct { } func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ([]ListUserOrdersRow, error) { - rows, err := q.db.Query(ctx, listUserOrders, minPrice) + rows, err := q.db.Query(ctx, listUserOrdersSQL, minPrice) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ( return items, nil } -const listUserParenExpr = `-- name: ListUserParenExpr :many +const listUserParenExprSQL = `-- name: ListUserParenExpr :many SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') AND id > $1 ORDER BY id @@ -122,7 +122,7 @@ type ListUserParenExprParams struct { } func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { - rows, err := q.db.Query(ctx, listUserParenExpr, arg.ID, arg.Limit) + rows, err := q.db.Query(ctx, listUserParenExprSQL, arg.ID, arg.Limit) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprPa return items, nil } -const listUsersByFamily = `-- name: ListUsersByFamily :many +const listUsersByFamilySQL = `-- name: ListUsersByFamily :many SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 ` @@ -162,7 +162,7 @@ type ListUsersByFamilyRow struct { } func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { - rows, err := q.db.Query(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + rows, err := q.db.Query(ctx, listUsersByFamilySQL, arg.MaxAge, arg.InFamily) if err != nil { return nil, err } @@ -181,7 +181,7 @@ func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyPa return items, nil } -const listUsersByID = `-- name: ListUsersByID :many +const listUsersByIDSQL = `-- name: ListUsersByID :many SELECT first_name, id, last_name FROM users WHERE id < $1 ` @@ -192,7 +192,7 @@ type ListUsersByIDRow struct { } func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { - rows, err := q.db.Query(ctx, listUsersByID, id) + rows, err := q.db.Query(ctx, listUsersByIDSQL, id) if err != nil { return nil, err } @@ -211,7 +211,7 @@ func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDR return items, nil } -const listUsersWithLimit = `-- name: ListUsersWithLimit :many +const listUsersWithLimitSQL = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` @@ -221,7 +221,7 @@ type ListUsersWithLimitRow struct { } func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { - rows, err := q.db.Query(ctx, listUsersWithLimit, limit) + rows, err := q.db.Query(ctx, listUsersWithLimitSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go index 7eeb1ff1ea..6be1e5b3ab 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` @@ -22,13 +22,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.db.QueryRow(ctx, getUserByID, targetID) + row := q.db.QueryRow(ctx, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES ($1, $2) ` @@ -38,11 +38,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.db.Exec(ctx, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.db.Exec(ctx, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const limitSQLCArg = `-- name: LimitSQLCArg :many +const limitSQLCArgSQL = `-- name: LimitSQLCArg :many select first_name, id FROM users LIMIT $1 ` @@ -52,7 +52,7 @@ type LimitSQLCArgRow struct { } func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { - rows, err := q.db.Query(ctx, limitSQLCArg, limit) + rows, err := q.db.Query(ctx, limitSQLCArgSQL, limit) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArg return items, nil } -const listUserOrders = `-- name: ListUserOrders :many +const listUserOrdersSQL = `-- name: ListUserOrders :many SELECT users.id, users.first_name, @@ -89,7 +89,7 @@ type ListUserOrdersRow struct { } func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ([]ListUserOrdersRow, error) { - rows, err := q.db.Query(ctx, listUserOrders, minPrice) + rows, err := q.db.Query(ctx, listUserOrdersSQL, minPrice) if err != nil { return nil, err } @@ -108,7 +108,7 @@ func (q *Queries) ListUserOrders(ctx context.Context, minPrice pgtype.Numeric) ( return items, nil } -const listUserParenExpr = `-- name: ListUserParenExpr :many +const listUserParenExprSQL = `-- name: ListUserParenExpr :many SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') AND id > $1 ORDER BY id @@ -121,7 +121,7 @@ type ListUserParenExprParams struct { } func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { - rows, err := q.db.Query(ctx, listUserParenExpr, arg.ID, arg.Limit) + rows, err := q.db.Query(ctx, listUserParenExprSQL, arg.ID, arg.Limit) if err != nil { return nil, err } @@ -146,7 +146,7 @@ func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprPa return items, nil } -const listUsersByFamily = `-- name: ListUsersByFamily :many +const listUsersByFamilySQL = `-- name: ListUsersByFamily :many SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 ` @@ -161,7 +161,7 @@ type ListUsersByFamilyRow struct { } func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { - rows, err := q.db.Query(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + rows, err := q.db.Query(ctx, listUsersByFamilySQL, arg.MaxAge, arg.InFamily) if err != nil { return nil, err } @@ -180,7 +180,7 @@ func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyPa return items, nil } -const listUsersByID = `-- name: ListUsersByID :many +const listUsersByIDSQL = `-- name: ListUsersByID :many SELECT first_name, id, last_name FROM users WHERE id < $1 ` @@ -191,7 +191,7 @@ type ListUsersByIDRow struct { } func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { - rows, err := q.db.Query(ctx, listUsersByID, id) + rows, err := q.db.Query(ctx, listUsersByIDSQL, id) if err != nil { return nil, err } @@ -210,7 +210,7 @@ func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDR return items, nil } -const listUsersWithLimit = `-- name: ListUsersWithLimit :many +const listUsersWithLimitSQL = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` @@ -220,7 +220,7 @@ type ListUsersWithLimitRow struct { } func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { - rows, err := q.db.Query(ctx, listUsersWithLimit, limit) + rows, err := q.db.Query(ctx, listUsersWithLimitSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go index d532e304b3..79bf80b856 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` @@ -21,13 +21,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.db.QueryRowContext(ctx, getUserByID, targetID) + row := q.db.QueryRowContext(ctx, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES ($1, $2) ` @@ -37,11 +37,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.db.ExecContext(ctx, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.db.ExecContext(ctx, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const limitSQLCArg = `-- name: LimitSQLCArg :many +const limitSQLCArgSQL = `-- name: LimitSQLCArg :many select first_name, id FROM users LIMIT $1 ` @@ -51,7 +51,7 @@ type LimitSQLCArgRow struct { } func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArgRow, error) { - rows, err := q.db.QueryContext(ctx, limitSQLCArg, limit) + rows, err := q.db.QueryContext(ctx, limitSQLCArgSQL, limit) if err != nil { return nil, err } @@ -73,7 +73,7 @@ func (q *Queries) LimitSQLCArg(ctx context.Context, limit int32) ([]LimitSQLCArg return items, nil } -const listUserOrders = `-- name: ListUserOrders :many +const listUserOrdersSQL = `-- name: ListUserOrders :many SELECT users.id, users.first_name, @@ -91,7 +91,7 @@ type ListUserOrdersRow struct { } func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUserOrdersRow, error) { - rows, err := q.db.QueryContext(ctx, listUserOrders, minPrice) + rows, err := q.db.QueryContext(ctx, listUserOrdersSQL, minPrice) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (q *Queries) ListUserOrders(ctx context.Context, minPrice string) ([]ListUs return items, nil } -const listUserParenExpr = `-- name: ListUserParenExpr :many +const listUserParenExprSQL = `-- name: ListUserParenExpr :many SELECT id, first_name, last_name, age, job_status FROM users WHERE (job_status = 'APPLIED' OR job_status = 'PENDING') AND id > $1 ORDER BY id @@ -126,7 +126,7 @@ type ListUserParenExprParams struct { } func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprParams) ([]User, error) { - rows, err := q.db.QueryContext(ctx, listUserParenExpr, arg.ID, arg.Limit) + rows, err := q.db.QueryContext(ctx, listUserParenExprSQL, arg.ID, arg.Limit) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (q *Queries) ListUserParenExpr(ctx context.Context, arg ListUserParenExprPa return items, nil } -const listUsersByFamily = `-- name: ListUsersByFamily :many +const listUsersByFamilySQL = `-- name: ListUsersByFamily :many SELECT first_name, last_name FROM users WHERE age < $1 AND last_name = $2 ` @@ -169,7 +169,7 @@ type ListUsersByFamilyRow struct { } func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyParams) ([]ListUsersByFamilyRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByFamily, arg.MaxAge, arg.InFamily) + rows, err := q.db.QueryContext(ctx, listUsersByFamilySQL, arg.MaxAge, arg.InFamily) if err != nil { return nil, err } @@ -191,7 +191,7 @@ func (q *Queries) ListUsersByFamily(ctx context.Context, arg ListUsersByFamilyPa return items, nil } -const listUsersByID = `-- name: ListUsersByID :many +const listUsersByIDSQL = `-- name: ListUsersByID :many SELECT first_name, id, last_name FROM users WHERE id < $1 ` @@ -202,7 +202,7 @@ type ListUsersByIDRow struct { } func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersByID, id) + rows, err := q.db.QueryContext(ctx, listUsersByIDSQL, id) if err != nil { return nil, err } @@ -224,7 +224,7 @@ func (q *Queries) ListUsersByID(ctx context.Context, id int32) ([]ListUsersByIDR return items, nil } -const listUsersWithLimit = `-- name: ListUsersWithLimit :many +const listUsersWithLimitSQL = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` @@ -234,7 +234,7 @@ type ListUsersWithLimitRow struct { } func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { - rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) + rows, err := q.db.QueryContext(ctx, listUsersWithLimitSQL, limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go index 76436e31d4..4ec0909a2a 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const findByID = `-- name: FindByID :many +const findByIDSQL = `-- name: FindByID :many SELECT id, name FROM users WHERE ? = id ` func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { - rows, err := q.db.QueryContext(ctx, findByID, id) + rows, err := q.db.QueryContext(ctx, findByIDSQL, id) if err != nil { return nil, err } @@ -37,7 +37,7 @@ func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { return items, nil } -const findByIDAndName = `-- name: FindByIDAndName :many +const findByIDAndNameSQL = `-- name: FindByIDAndName :many SELECT id, name FROM users WHERE ? = id AND ? = name ` @@ -47,7 +47,7 @@ type FindByIDAndNameParams struct { } func (q *Queries) FindByIDAndName(ctx context.Context, arg FindByIDAndNameParams) ([]User, error) { - rows, err := q.db.QueryContext(ctx, findByIDAndName, arg.ID, arg.Name) + rows, err := q.db.QueryContext(ctx, findByIDAndNameSQL, arg.ID, arg.Name) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go index f117fc96f3..ce068fe6cd 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const findByID = `-- name: FindByID :many +const findByIDSQL = `-- name: FindByID :many SELECT id, name FROM users WHERE $1 = id ` func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { - rows, err := q.db.QueryContext(ctx, findByID, id) + rows, err := q.db.QueryContext(ctx, findByIDSQL, id) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) FindByID(ctx context.Context, id int32) ([]User, error) { return items, nil } -const findByIDAndName = `-- name: FindByIDAndName :many +const findByIDAndNameSQL = `-- name: FindByIDAndName :many SELECT id, name FROM users WHERE $1 = id AND $1 = name ` func (q *Queries) FindByIDAndName(ctx context.Context, id int32) ([]User, error) { - rows, err := q.db.QueryContext(ctx, findByIDAndName, id) + rows, err := q.db.QueryContext(ctx, findByIDAndNameSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go index 72a99915c5..d1c55b801d 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const fooByAandB = `-- name: FooByAandB :many +const fooByAandBSQL = `-- name: FooByAandB :many SELECT a, b FROM foo WHERE a = ? and b = ? ` @@ -21,7 +21,7 @@ type FooByAandBParams struct { } func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByAandB, arg.A, arg.B) + rows, err := q.db.QueryContext(ctx, fooByAandBSQL, arg.A, arg.B) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go index 8294904aad..b31dcb85f8 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const fooByAandB = `-- name: FooByAandB :many +const fooByAandBSQL = `-- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2 ` @@ -21,7 +21,7 @@ type FooByAandBParams struct { } func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { - rows, err := q.db.Query(ctx, fooByAandB, arg.A, arg.B) + rows, err := q.db.Query(ctx, fooByAandBSQL, arg.A, arg.B) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go index 870986a0fc..8945733a9f 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const fooByAandB = `-- name: FooByAandB :many +const fooByAandBSQL = `-- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2 ` @@ -22,7 +22,7 @@ type FooByAandBParams struct { } func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { - rows, err := q.db.Query(ctx, fooByAandB, arg.A, arg.B) + rows, err := q.db.Query(ctx, fooByAandBSQL, arg.A, arg.B) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go index 0db559a542..547a98ee69 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const fooByAandB = `-- name: FooByAandB :many +const fooByAandBSQL = `-- name: FooByAandB :many SELECT a, b FROM foo WHERE a = $1 and b = $2 ` @@ -21,7 +21,7 @@ type FooByAandBParams struct { } func (q *Queries) FooByAandB(ctx context.Context, arg FooByAandBParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByAandB, arg.A, arg.B) + rows, err := q.db.QueryContext(ctx, fooByAandBSQL, arg.A, arg.B) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go index 5fc53b346c..9d65ecef25 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const fooByBarB = `-- name: FooByBarB :many +const fooByBarBSQL = `-- name: FooByBarB :many SELECT a, b from foo where foo.a in (select a from bar where bar.b = ?) ` func (q *Queries) FooByBarB(ctx context.Context, b sql.NullString) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByBarB, b) + rows, err := q.db.QueryContext(ctx, fooByBarBSQL, b) if err != nil { return nil, err } @@ -37,7 +37,7 @@ func (q *Queries) FooByBarB(ctx context.Context, b sql.NullString) ([]Foo, error return items, nil } -const fooByList = `-- name: FooByList :many +const fooByListSQL = `-- name: FooByList :many SELECT a, b from foo where foo.a in (?, ?) ` @@ -47,7 +47,7 @@ type FooByListParams struct { } func (q *Queries) FooByList(ctx context.Context, arg FooByListParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByList, arg.A, arg.A_2) + rows, err := q.db.QueryContext(ctx, fooByListSQL, arg.A, arg.A_2) if err != nil { return nil, err } @@ -69,7 +69,7 @@ func (q *Queries) FooByList(ctx context.Context, arg FooByListParams) ([]Foo, er return items, nil } -const fooByNotList = `-- name: FooByNotList :many +const fooByNotListSQL = `-- name: FooByNotList :many SELECT a, b from foo where foo.a not in (?, ?) ` @@ -79,7 +79,7 @@ type FooByNotListParams struct { } func (q *Queries) FooByNotList(ctx context.Context, arg FooByNotListParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByNotList, arg.A, arg.A_2) + rows, err := q.db.QueryContext(ctx, fooByNotListSQL, arg.A, arg.A_2) if err != nil { return nil, err } @@ -101,12 +101,12 @@ func (q *Queries) FooByNotList(ctx context.Context, arg FooByNotListParams) ([]F return items, nil } -const fooByParamList = `-- name: FooByParamList :many +const fooByParamListSQL = `-- name: FooByParamList :many SELECT a, b from foo where ? in (foo.a, foo.b) ` func (q *Queries) FooByParamList(ctx context.Context, a sql.NullString) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, fooByParamList, a) + rows, err := q.db.QueryContext(ctx, fooByParamListSQL, a) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go index d0314c8403..6fa15e0878 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const petsByName = `-- name: PetsByName :many +const petsByNameSQL = `-- name: PetsByName :many SELECT name FROM pet WHERE name LIKE ? ` func (q *Queries) PetsByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, petsByName, name) + rows, err := q.db.QueryContext(ctx, petsByNameSQL, name) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go index c7e0223107..93adc8ba7a 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const petsByName = `-- name: PetsByName :many +const petsByNameSQL = `-- name: PetsByName :many SELECT name FROM pet WHERE name LIKE $1 ` func (q *Queries) PetsByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, petsByName, name) + rows, err := q.db.QueryContext(ctx, petsByNameSQL, name) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go index c0e470e1b5..ab453b25a0 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go @@ -9,21 +9,21 @@ import ( "context" ) -const advisoryLockExec = `-- name: AdvisoryLockExec :exec +const advisoryLockExecSQL = `-- name: AdvisoryLockExec :exec SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { - _, err := q.db.Exec(ctx, advisoryLockExec, pgAdvisoryLock) + _, err := q.db.Exec(ctx, advisoryLockExecSQL, pgAdvisoryLock) return err } -const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +const advisoryLockExecRowsSQL = `-- name: AdvisoryLockExecRows :execrows SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { - result, err := q.db.Exec(ctx, advisoryLockExecRows, pgAdvisoryLock) + result, err := q.db.Exec(ctx, advisoryLockExecRowsSQL, pgAdvisoryLock) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go index 774c62f590..bd159834a7 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go @@ -11,31 +11,31 @@ import ( "github.com/jackc/pgconn" ) -const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +const advisoryLockExecResultSQL = `-- name: AdvisoryLockExecResult :execresult SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, advisoryLockExecResult, pgAdvisoryLock) + return q.db.Exec(ctx, advisoryLockExecResultSQL, pgAdvisoryLock) } -const advisoryLockOne = `-- name: AdvisoryLockOne :one +const advisoryLockOneSQL = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { - row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) + row := q.db.QueryRow(ctx, advisoryLockOneSQL, pgAdvisoryLock) var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } -const advisoryUnlock = `-- name: AdvisoryUnlock :many +const advisoryUnlockSQL = `-- name: AdvisoryUnlock :many SELECT pg_advisory_unlock($1) ` func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { - rows, err := q.db.Query(ctx, advisoryUnlock, pgAdvisoryUnlock) + rows, err := q.db.Query(ctx, advisoryUnlockSQL, pgAdvisoryUnlock) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go index c0e470e1b5..ab453b25a0 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go @@ -9,21 +9,21 @@ import ( "context" ) -const advisoryLockExec = `-- name: AdvisoryLockExec :exec +const advisoryLockExecSQL = `-- name: AdvisoryLockExec :exec SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { - _, err := q.db.Exec(ctx, advisoryLockExec, pgAdvisoryLock) + _, err := q.db.Exec(ctx, advisoryLockExecSQL, pgAdvisoryLock) return err } -const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +const advisoryLockExecRowsSQL = `-- name: AdvisoryLockExecRows :execrows SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { - result, err := q.db.Exec(ctx, advisoryLockExecRows, pgAdvisoryLock) + result, err := q.db.Exec(ctx, advisoryLockExecRowsSQL, pgAdvisoryLock) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go index a8d448b989..6a09412b10 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go @@ -11,31 +11,31 @@ import ( "github.com/jackc/pgx/v5/pgconn" ) -const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +const advisoryLockExecResultSQL = `-- name: AdvisoryLockExecResult :execresult SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, advisoryLockExecResult, pgAdvisoryLock) + return q.db.Exec(ctx, advisoryLockExecResultSQL, pgAdvisoryLock) } -const advisoryLockOne = `-- name: AdvisoryLockOne :one +const advisoryLockOneSQL = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { - row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) + row := q.db.QueryRow(ctx, advisoryLockOneSQL, pgAdvisoryLock) var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } -const advisoryUnlock = `-- name: AdvisoryUnlock :many +const advisoryUnlockSQL = `-- name: AdvisoryUnlock :many SELECT pg_advisory_unlock($1) ` func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { - rows, err := q.db.Query(ctx, advisoryUnlock, pgAdvisoryUnlock) + rows, err := q.db.Query(ctx, advisoryUnlockSQL, pgAdvisoryUnlock) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go index 77bc72e688..1e0fb93739 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go @@ -9,21 +9,21 @@ import ( "context" ) -const advisoryLockExec = `-- name: AdvisoryLockExec :exec +const advisoryLockExecSQL = `-- name: AdvisoryLockExec :exec SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExec(ctx context.Context, pgAdvisoryLock int64) error { - _, err := q.db.ExecContext(ctx, advisoryLockExec, pgAdvisoryLock) + _, err := q.db.ExecContext(ctx, advisoryLockExecSQL, pgAdvisoryLock) return err } -const advisoryLockExecRows = `-- name: AdvisoryLockExecRows :execrows +const advisoryLockExecRowsSQL = `-- name: AdvisoryLockExecRows :execrows SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecRows(ctx context.Context, pgAdvisoryLock int64) (int64, error) { - result, err := q.db.ExecContext(ctx, advisoryLockExecRows, pgAdvisoryLock) + result, err := q.db.ExecContext(ctx, advisoryLockExecRowsSQL, pgAdvisoryLock) if err != nil { return 0, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go index 76cb08e005..e782c57f15 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go @@ -10,31 +10,31 @@ import ( "database/sql" ) -const advisoryLockExecResult = `-- name: AdvisoryLockExecResult :execresult +const advisoryLockExecResultSQL = `-- name: AdvisoryLockExecResult :execresult SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockExecResult(ctx context.Context, pgAdvisoryLock int64) (sql.Result, error) { - return q.db.ExecContext(ctx, advisoryLockExecResult, pgAdvisoryLock) + return q.db.ExecContext(ctx, advisoryLockExecResultSQL, pgAdvisoryLock) } -const advisoryLockOne = `-- name: AdvisoryLockOne :one +const advisoryLockOneSQL = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { - row := q.db.QueryRowContext(ctx, advisoryLockOne, pgAdvisoryLock) + row := q.db.QueryRowContext(ctx, advisoryLockOneSQL, pgAdvisoryLock) var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } -const advisoryUnlock = `-- name: AdvisoryUnlock :many +const advisoryUnlockSQL = `-- name: AdvisoryUnlock :many SELECT pg_advisory_unlock($1) ` func (q *Queries) AdvisoryUnlock(ctx context.Context, pgAdvisoryUnlock int64) ([]bool, error) { - rows, err := q.db.QueryContext(ctx, advisoryUnlock, pgAdvisoryUnlock) + rows, err := q.db.QueryContext(ctx, advisoryUnlockSQL, pgAdvisoryUnlock) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_dump/db/query.sql.go b/internal/endtoend/testdata/pg_dump/db/query.sql.go index 703f7512a1..db6de228e4 100644 --- a/internal/endtoend/testdata/pg_dump/db/query.sql.go +++ b/internal/endtoend/testdata/pg_dump/db/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -25,41 +25,41 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go index 7fd7c3aa48..9289def2d3 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT qualified_name, name_query, fts_name_query FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go index 7fd7c3aa48..9289def2d3 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT qualified_name, name_query, fts_name_query FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, listFoo) + rows, err := q.db.Query(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go index efc1920bd7..ee9f87db20 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT qualified_name, name_query, fts_name_query FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go index ba7b612936..63fcee1c16 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const wordSimilarity = `-- name: WordSimilarity :one +const wordSimilaritySQL = `-- name: WordSimilarity :one SELECT word_similarity('word', 'two words') ` func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { - row := q.db.QueryRow(ctx, wordSimilarity) + row := q.db.QueryRow(ctx, wordSimilaritySQL) var word_similarity float32 err := row.Scan(&word_similarity) return word_similarity, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go index 5dbd345a82..535f614efa 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const encodeDigest = `-- name: EncodeDigest :one +const encodeDigestSQL = `-- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex') ` func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { - row := q.db.QueryRow(ctx, encodeDigest, digest) + row := q.db.QueryRow(ctx, encodeDigestSQL, digest) var encode string err := row.Scan(&encode) return encode, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go index 448810e85f..6400127b77 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go @@ -11,12 +11,12 @@ import ( "github.com/google/uuid" ) -const generateUUID = `-- name: GenerateUUID :one +const generateUUIDSQL = `-- name: GenerateUUID :one SELECT uuid_generate_v4() ` func (q *Queries) GenerateUUID(ctx context.Context) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, generateUUID) + row := q.db.QueryRow(ctx, generateUUIDSQL) var uuid_generate_v4 uuid.UUID err := row.Scan(&uuid_generate_v4) return uuid_generate_v4, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go index ba7b612936..63fcee1c16 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const wordSimilarity = `-- name: WordSimilarity :one +const wordSimilaritySQL = `-- name: WordSimilarity :one SELECT word_similarity('word', 'two words') ` func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { - row := q.db.QueryRow(ctx, wordSimilarity) + row := q.db.QueryRow(ctx, wordSimilaritySQL) var word_similarity float32 err := row.Scan(&word_similarity) return word_similarity, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go index 5dbd345a82..535f614efa 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const encodeDigest = `-- name: EncodeDigest :one +const encodeDigestSQL = `-- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex') ` func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { - row := q.db.QueryRow(ctx, encodeDigest, digest) + row := q.db.QueryRow(ctx, encodeDigestSQL, digest) var encode string err := row.Scan(&encode) return encode, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go index 836f0d29a6..dc68370feb 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const generateUUID = `-- name: GenerateUUID :one +const generateUUIDSQL = `-- name: GenerateUUID :one SELECT uuid_generate_v4() ` func (q *Queries) GenerateUUID(ctx context.Context) (pgtype.UUID, error) { - row := q.db.QueryRow(ctx, generateUUID) + row := q.db.QueryRow(ctx, generateUUIDSQL) var uuid_generate_v4 pgtype.UUID err := row.Scan(&uuid_generate_v4) return uuid_generate_v4, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go index 564b9ebe0a..3ed44a379c 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const wordSimilarity = `-- name: WordSimilarity :one +const wordSimilaritySQL = `-- name: WordSimilarity :one SELECT word_similarity('word', 'two words') ` func (q *Queries) WordSimilarity(ctx context.Context) (float32, error) { - row := q.db.QueryRowContext(ctx, wordSimilarity) + row := q.db.QueryRowContext(ctx, wordSimilaritySQL) var word_similarity float32 err := row.Scan(&word_similarity) return word_similarity, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go index 4676430bb5..72fffa598c 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const encodeDigest = `-- name: EncodeDigest :one +const encodeDigestSQL = `-- name: EncodeDigest :one SELECT encode(digest($1, 'sha1'), 'hex') ` func (q *Queries) EncodeDigest(ctx context.Context, digest string) (string, error) { - row := q.db.QueryRowContext(ctx, encodeDigest, digest) + row := q.db.QueryRowContext(ctx, encodeDigestSQL, digest) var encode string err := row.Scan(&encode) return encode, err diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go index 0bd737e6f1..f3c428a01a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go @@ -11,12 +11,12 @@ import ( "github.com/google/uuid" ) -const generateUUID = `-- name: GenerateUUID :one +const generateUUIDSQL = `-- name: GenerateUUID :one SELECT uuid_generate_v4() ` func (q *Queries) GenerateUUID(ctx context.Context) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, generateUUID) + row := q.db.QueryRowContext(ctx, generateUUIDSQL) var uuid_generate_v4 uuid.UUID err := row.Scan(&uuid_generate_v4) return uuid_generate_v4, err diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go index 4502d2acb5..c0de784486 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "time" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` @@ -20,7 +20,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go index d0f1c56ac4..cbe4b3f18f 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` @@ -21,7 +21,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { - rows, err := q.db.Query(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go index a386f76137..caa1b30e76 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "time" ) -const generateSeries = `-- name: GenerateSeries :many +const generateSeriesSQL = `-- name: GenerateSeries :many SELECT generate_series($1::timestamp, $2::timestamp, '10 hours') ` @@ -20,7 +20,7 @@ type GenerateSeriesParams struct { } func (q *Queries) GenerateSeries(ctx context.Context, arg GenerateSeriesParams) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, generateSeries, arg.Column1, arg.Column2) + rows, err := q.db.QueryContext(ctx, generateSeriesSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go index f263950652..17cc428c11 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getColumns = `-- name: GetColumns :many +const getColumnsSQL = `-- name: GetColumns :many SELECT table_name::text, column_name::text from information_schema.columns ` @@ -20,7 +20,7 @@ type GetColumnsRow struct { } func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { - rows, err := q.db.Query(ctx, getColumns) + rows, err := q.db.Query(ctx, getColumnsSQL) if err != nil { return nil, err } @@ -39,12 +39,12 @@ func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { return items, nil } -const getTables = `-- name: GetTables :many +const getTablesSQL = `-- name: GetTables :many SELECT table_name::text from information_schema.tables ` func (q *Queries) GetTables(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, getTables) + rows, err := q.db.Query(ctx, getTablesSQL) if err != nil { return nil, err } @@ -63,7 +63,7 @@ func (q *Queries) GetTables(ctx context.Context) ([]string, error) { return items, nil } -const getTimezones = `-- name: GetTimezones :many +const getTimezonesSQL = `-- name: GetTimezones :many SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names ` @@ -75,7 +75,7 @@ type GetTimezonesRow struct { } func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { - rows, err := q.db.Query(ctx, getTimezones) + rows, err := q.db.Query(ctx, getTimezonesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go index 0eb1011162..c0b391f5bc 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getColumns = `-- name: GetColumns :many +const getColumnsSQL = `-- name: GetColumns :many SELECT table_name::text, column_name::text from information_schema.columns ` @@ -21,7 +21,7 @@ type GetColumnsRow struct { } func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { - rows, err := q.db.Query(ctx, getColumns) + rows, err := q.db.Query(ctx, getColumnsSQL) if err != nil { return nil, err } @@ -40,12 +40,12 @@ func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { return items, nil } -const getTables = `-- name: GetTables :many +const getTablesSQL = `-- name: GetTables :many SELECT table_name::text from information_schema.tables ` func (q *Queries) GetTables(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, getTables) + rows, err := q.db.Query(ctx, getTablesSQL) if err != nil { return nil, err } @@ -64,7 +64,7 @@ func (q *Queries) GetTables(ctx context.Context) ([]string, error) { return items, nil } -const getTimezones = `-- name: GetTimezones :many +const getTimezonesSQL = `-- name: GetTimezones :many SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names ` @@ -76,7 +76,7 @@ type GetTimezonesRow struct { } func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { - rows, err := q.db.Query(ctx, getTimezones) + rows, err := q.db.Query(ctx, getTimezonesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go index 5579308f8a..0f6ede89c7 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getColumns = `-- name: GetColumns :many +const getColumnsSQL = `-- name: GetColumns :many SELECT table_name::text, column_name::text from information_schema.columns ` @@ -20,7 +20,7 @@ type GetColumnsRow struct { } func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { - rows, err := q.db.QueryContext(ctx, getColumns) + rows, err := q.db.QueryContext(ctx, getColumnsSQL) if err != nil { return nil, err } @@ -42,12 +42,12 @@ func (q *Queries) GetColumns(ctx context.Context) ([]GetColumnsRow, error) { return items, nil } -const getTables = `-- name: GetTables :many +const getTablesSQL = `-- name: GetTables :many SELECT table_name::text from information_schema.tables ` func (q *Queries) GetTables(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, getTables) + rows, err := q.db.QueryContext(ctx, getTablesSQL) if err != nil { return nil, err } @@ -69,7 +69,7 @@ func (q *Queries) GetTables(ctx context.Context) ([]string, error) { return items, nil } -const getTimezones = `-- name: GetTimezones :many +const getTimezonesSQL = `-- name: GetTimezones :many SELECT name, abbrev, utc_offset, is_dst from pg_catalog.pg_timezone_names ` @@ -81,7 +81,7 @@ type GetTimezonesRow struct { } func (q *Queries) GetTimezones(ctx context.Context) ([]GetTimezonesRow, error) { - rows, err := q.db.QueryContext(ctx, getTimezones) + rows, err := q.db.QueryContext(ctx, getTimezonesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go index 34274a0f9d..584197b912 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.Query(ctx, user) + rows, err := q.db.Query(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go index 7cd0ecd450..59e59ce3b5 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const user = `-- name: User :many +const userSQL = `-- name: User :many SELECT "user".id FROM "user" ` func (q *Queries) User(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, user) + rows, err := q.db.QueryContext(ctx, userSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go index d7c54c17a0..cb79619e57 100644 --- a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go @@ -11,16 +11,16 @@ import ( "github.com/pgvector/pgvector-go" ) -const insertVector = `-- name: InsertVector :exec +const insertVectorSQL = `-- name: InsertVector :exec INSERT INTO items (embedding) VALUES ($1) ` func (q *Queries) InsertVector(ctx context.Context, embedding pgvector.Vector) error { - _, err := q.db.Exec(ctx, insertVector, embedding) + _, err := q.db.Exec(ctx, insertVectorSQL, embedding) return err } -const nearestNeighbor = `-- name: NearestNeighbor :many +const nearestNeighborSQL = `-- name: NearestNeighbor :many SELECT id, embedding FROM items ORDER BY embedding <-> $1 @@ -28,7 +28,7 @@ LIMIT 5 ` func (q *Queries) NearestNeighbor(ctx context.Context, embedding pgvector.Vector) ([]Item, error) { - rows, err := q.db.Query(ctx, nearestNeighbor, embedding) + rows, err := q.db.Query(ctx, nearestNeighborSQL, embedding) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go index 9565609b93..dd61c862c9 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go @@ -12,23 +12,23 @@ import ( "github.com/google/uuid" ) -const find = `-- name: Find :one +const findSQL = `-- name: Find :one SELECT bar FROM foo WHERE baz = $1 ` func (q *Queries) Find(ctx context.Context, baz *uuid.UUID) (*time.Time, error) { - row := q.db.QueryRow(ctx, find, baz) + row := q.db.QueryRow(ctx, findSQL, baz) var bar *time.Time err := row.Scan(&bar) return bar, err } -const list = `-- name: List :many +const listSQL = `-- name: List :many SELECT bar, baz FROM foo ` func (q *Queries) List(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, list) + rows, err := q.db.Query(ctx, listSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go index 76c1c5f2ae..d38b3a842a 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go @@ -10,23 +10,23 @@ import ( "net/netip" ) -const find = `-- name: Find :one +const findSQL = `-- name: Find :one SELECT bar FROM foo WHERE baz = $1 ` func (q *Queries) Find(ctx context.Context, baz *netip.Prefix) (*netip.Addr, error) { - row := q.db.QueryRow(ctx, find, baz) + row := q.db.QueryRow(ctx, findSQL, baz) var bar *netip.Addr err := row.Scan(&bar) return bar, err } -const list = `-- name: List :many +const listSQL = `-- name: List :many SELECT bar, baz FROM foo ` func (q *Queries) List(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, list) + rows, err := q.db.Query(ctx, listSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go index 9c72c93be7..71fce229e2 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go @@ -24,19 +24,19 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByName); err != nil { + if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByNameSQL); err != nil { return nil, fmt.Errorf("error preparing query DeleteUsersByName: %w", err) } - if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByID); err != nil { + if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByIDSQL); err != nil { return nil, fmt.Errorf("error preparing query GetUserByID: %w", err) } - if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUser); err != nil { + if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUserSQL); err != nil { return nil, fmt.Errorf("error preparing query InsertNewUser: %w", err) } - if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResult); err != nil { + if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResultSQL); err != nil { return nil, fmt.Errorf("error preparing query InsertNewUserWithResult: %w", err) } - if q.listUsersStmt, err = db.PrepareContext(ctx, listUsers); err != nil { + if q.listUsersStmt, err = db.PrepareContext(ctx, listUsersSQL); err != nil { return nil, fmt.Errorf("error preparing query ListUsers: %w", err) } return &q, nil diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go index f2021cb4fb..89b4cbcf8d 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteUsersByName = `-- name: DeleteUsersByName :execrows +const deleteUsersByNameSQL = `-- name: DeleteUsersByName :execrows DELETE FROM users WHERE first_name = ? AND last_name = ? ` @@ -20,14 +20,14 @@ type DeleteUsersByNameParams struct { } func (q *Queries) DeleteUsersByName(ctx context.Context, arg DeleteUsersByNameParams) (int64, error) { - result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByName, arg.FirstName, arg.LastName) + result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByNameSQL, arg.FirstName, arg.LastName) if err != nil { return 0, err } return result.RowsAffected() } -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = ? ` @@ -38,13 +38,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID uint64) (GetUserByIDRow, error) { - row := q.queryRow(ctx, q.getUserByIDStmt, getUserByID, targetID) + row := q.queryRow(ctx, q.getUserByIDStmt, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES (?, ?) ` @@ -54,11 +54,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const insertNewUserWithResult = `-- name: InsertNewUserWithResult :execresult +const insertNewUserWithResultSQL = `-- name: InsertNewUserWithResult :execresult INSERT INTO users (first_name, last_name) VALUES (?, ?) ` @@ -68,10 +68,10 @@ type InsertNewUserWithResultParams struct { } func (q *Queries) InsertNewUserWithResult(ctx context.Context, arg InsertNewUserWithResultParams) (sql.Result, error) { - return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResult, arg.FirstName, arg.LastName) + return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResultSQL, arg.FirstName, arg.LastName) } -const listUsers = `-- name: ListUsers :many +const listUsersSQL = `-- name: ListUsers :many SELECT first_name, last_name FROM users ` @@ -81,7 +81,7 @@ type ListUsersRow struct { } func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) { - rows, err := q.query(ctx, q.listUsersStmt, listUsers) + rows, err := q.query(ctx, q.listUsersStmt, listUsersSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go index 9c72c93be7..71fce229e2 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go @@ -24,19 +24,19 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByName); err != nil { + if q.deleteUsersByNameStmt, err = db.PrepareContext(ctx, deleteUsersByNameSQL); err != nil { return nil, fmt.Errorf("error preparing query DeleteUsersByName: %w", err) } - if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByID); err != nil { + if q.getUserByIDStmt, err = db.PrepareContext(ctx, getUserByIDSQL); err != nil { return nil, fmt.Errorf("error preparing query GetUserByID: %w", err) } - if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUser); err != nil { + if q.insertNewUserStmt, err = db.PrepareContext(ctx, insertNewUserSQL); err != nil { return nil, fmt.Errorf("error preparing query InsertNewUser: %w", err) } - if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResult); err != nil { + if q.insertNewUserWithResultStmt, err = db.PrepareContext(ctx, insertNewUserWithResultSQL); err != nil { return nil, fmt.Errorf("error preparing query InsertNewUserWithResult: %w", err) } - if q.listUsersStmt, err = db.PrepareContext(ctx, listUsers); err != nil { + if q.listUsersStmt, err = db.PrepareContext(ctx, listUsersSQL); err != nil { return nil, fmt.Errorf("error preparing query ListUsers: %w", err) } return &q, nil diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go index f4c96a4b70..816816d3e1 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteUsersByName = `-- name: DeleteUsersByName :execrows +const deleteUsersByNameSQL = `-- name: DeleteUsersByName :execrows DELETE FROM users WHERE first_name = $1 AND last_name = $2 ` @@ -20,14 +20,14 @@ type DeleteUsersByNameParams struct { } func (q *Queries) DeleteUsersByName(ctx context.Context, arg DeleteUsersByNameParams) (int64, error) { - result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByName, arg.FirstName, arg.LastName) + result, err := q.exec(ctx, q.deleteUsersByNameStmt, deleteUsersByNameSQL, arg.FirstName, arg.LastName) if err != nil { return 0, err } return result.RowsAffected() } -const getUserByID = `-- name: GetUserByID :one +const getUserByIDSQL = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` @@ -38,13 +38,13 @@ type GetUserByIDRow struct { } func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { - row := q.queryRow(ctx, q.getUserByIDStmt, getUserByID, targetID) + row := q.queryRow(ctx, q.getUserByIDStmt, getUserByIDSQL, targetID) var i GetUserByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } -const insertNewUser = `-- name: InsertNewUser :exec +const insertNewUserSQL = `-- name: InsertNewUser :exec INSERT INTO users (first_name, last_name) VALUES ($1, $2) ` @@ -54,11 +54,11 @@ type InsertNewUserParams struct { } func (q *Queries) InsertNewUser(ctx context.Context, arg InsertNewUserParams) error { - _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUser, arg.FirstName, arg.LastName) + _, err := q.exec(ctx, q.insertNewUserStmt, insertNewUserSQL, arg.FirstName, arg.LastName) return err } -const insertNewUserWithResult = `-- name: InsertNewUserWithResult :execresult +const insertNewUserWithResultSQL = `-- name: InsertNewUserWithResult :execresult INSERT INTO users (first_name, last_name) VALUES ($1, $2) ` @@ -68,10 +68,10 @@ type InsertNewUserWithResultParams struct { } func (q *Queries) InsertNewUserWithResult(ctx context.Context, arg InsertNewUserWithResultParams) (sql.Result, error) { - return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResult, arg.FirstName, arg.LastName) + return q.exec(ctx, q.insertNewUserWithResultStmt, insertNewUserWithResultSQL, arg.FirstName, arg.LastName) } -const listUsers = `-- name: ListUsers :many +const listUsersSQL = `-- name: ListUsers :many SELECT first_name, last_name FROM users ` @@ -81,7 +81,7 @@ type ListUsersRow struct { } func (q *Queries) ListUsers(ctx context.Context) ([]ListUsersRow, error) { - rows, err := q.query(ctx, q.listUsersStmt, listUsers) + rows, err := q.query(ctx, q.listUsersStmt, listUsersSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go index 469dcfaf98..59a4a8da4e 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM @@ -20,7 +20,7 @@ LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go index 469dcfaf98..59a4a8da4e 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM @@ -20,7 +20,7 @@ LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go index 2a6b8ee52b..df57f67a17 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM @@ -20,7 +20,7 @@ LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go index 44287c0642..b48f9c5ab1 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go @@ -11,23 +11,23 @@ import ( "time" ) -const createNotice = `-- name: CreateNotice :exec +const createNoticeSQL = `-- name: CreateNotice :exec INSERT INTO notice (cnt, created_at) VALUES ($1, $2) ` func (q *Queries) CreateNotice(ctx context.Context, cnt int32, createdAt time.Time) error { - _, err := q.db.ExecContext(ctx, createNotice, cnt, createdAt) + _, err := q.db.ExecContext(ctx, createNoticeSQL, cnt, createdAt) return err } -const markNoticeDone = `-- name: MarkNoticeDone :exec +const markNoticeDoneSQL = `-- name: MarkNoticeDone :exec UPDATE notice SET status='done', notice_at=$1 WHERE id=$2 ` func (q *Queries) MarkNoticeDone(ctx context.Context, noticeAt sql.NullTime, iD int32) error { - _, err := q.db.ExecContext(ctx, markNoticeDone, noticeAt, iD) + _, err := q.db.ExecContext(ctx, markNoticeDoneSQL, noticeAt, iD) return err } diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go index 971b1efa3a..305ae69998 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go @@ -13,7 +13,7 @@ import ( "github.com/lib/pq" ) -const addNewClient = `-- name: AddNewClient :one +const addNewClientSQL = `-- name: AddNewClient :one INSERT INTO clients ( id, name ) VALUES ( @@ -23,13 +23,13 @@ RETURNING id, name ` func (q *Queries) AddNewClient(ctx context.Context, iD int32, name string) (Client, error) { - row := q.db.QueryRowContext(ctx, addNewClient, iD, name) + row := q.db.QueryRowContext(ctx, addNewClientSQL, iD, name) var i Client err := row.Scan(&i.ID, &i.Name) return i, err } -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio, country_code, titles ) VALUES ( @@ -46,7 +46,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio, arg.CountryCode, @@ -63,12 +63,12 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut return i, err } -const createAuthorOnlyTitles = `-- name: CreateAuthorOnlyTitles :one +const createAuthorOnlyTitlesSQL = `-- name: CreateAuthorOnlyTitles :one INSERT INTO authors (name, titles) VALUES ($1, $2) RETURNING id, name, bio, country_code, titles ` func (q *Queries) CreateAuthorOnlyTitles(ctx context.Context, name string, titles []string) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthorOnlyTitles, name, pq.Array(titles)) + row := q.db.QueryRowContext(ctx, createAuthorOnlyTitlesSQL, name, pq.Array(titles)) var i Author err := row.Scan( &i.ID, @@ -80,23 +80,23 @@ func (q *Queries) CreateAuthorOnlyTitles(ctx context.Context, name string, title return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const deleteAuthors = `-- name: DeleteAuthors :exec +const deleteAuthorsSQL = `-- name: DeleteAuthors :exec DELETE FROM authors WHERE id IN ($2) AND name = $1 ` func (q *Queries) DeleteAuthors(ctx context.Context, name string, ids []int64) error { - query := deleteAuthors + query := deleteAuthorsSQL var queryParams []any queryParams = append(queryParams, name) if len(ids) > 0 { @@ -111,13 +111,13 @@ func (q *Queries) DeleteAuthors(ctx context.Context, name string, ids []int64) e return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, country_code, titles FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, name string, countryCode string) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, name, countryCode) + row := q.db.QueryRowContext(ctx, getAuthorSQL, name, countryCode) var i Author err := row.Scan( &i.ID, @@ -129,13 +129,13 @@ func (q *Queries) GetAuthor(ctx context.Context, name string, countryCode string return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, country_code, titles FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go index 471b1163c7..08edeae182 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio, country_code ) VALUES ( @@ -26,7 +26,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio, arg.CountryCode) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio, arg.CountryCode) var i Author err := row.Scan( &i.ID, @@ -37,7 +37,7 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut return i, err } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` @@ -47,11 +47,11 @@ type DeleteAuthorParams struct { } func (q *Queries) DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, arg.ID) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, arg.ID) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio, country_code FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1 ` @@ -62,7 +62,7 @@ type GetAuthorParams struct { } func (q *Queries) GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, arg.Name, arg.CountryCode) + row := q.db.QueryRowContext(ctx, getAuthorSQL, arg.Name, arg.CountryCode) var i Author err := row.Scan( &i.ID, @@ -73,13 +73,13 @@ func (q *Queries) GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, e return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio, country_code FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go index 1e5ad1ed36..c0938bbfe0 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const testList = `-- name: TestList :many +const testListSQL = `-- name: TestList :many SELECT id FROM test ` func (q *Queries) TestList(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, testList) + rows, err := q.db.QueryContext(ctx, testListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go index 80e5d9bd3f..834d04db67 100644 --- a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const placeholder = `-- name: Placeholder :exec +const placeholderSQL = `-- name: Placeholder :exec SELECT 1 ` func (q *Queries) Placeholder(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, placeholder) + _, err := q.db.ExecContext(ctx, placeholderSQL) return err } diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go index 6743358ec6..06185368c3 100644 --- a/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const testList = `-- name: TestList :many +const testListSQL = `-- name: TestList :many SELECT id FROM users ` func (q *Queries) TestList(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, testList) + rows, err := q.db.QueryContext(ctx, testListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go index e04465f181..dea3910dd8 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectTest = `-- name: SelectTest :many +const selectTestSQL = `-- name: SelectTest :many SELECT v_daterange_null, v_datemultirange_null, v_tsrange_null, v_tsmultirange_null, v_tstzrange_null, v_tstzmultirange_null, v_numrange_null, v_nummultirange_null, v_int4range_null, v_int4multirange_null, v_int8range_null, v_int8multirange_null, v_daterange, v_datemultirange, v_tsrange, v_tsmultirange, v_tstzrange, v_tstzmultirange, v_numrange, v_nummultirange, v_int4range, v_int4multirange, v_int8range, v_int8multirange from test_table ` func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { - rows, err := q.db.Query(ctx, selectTest) + rows, err := q.db.Query(ctx, selectTestSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go index d899ee8d86..28a8465396 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const refresh = `-- name: Refresh :exec +const refreshSQL = `-- name: Refresh :exec REFRESH MATERIALIZED VIEW myview ` func (q *Queries) Refresh(ctx context.Context) error { - _, err := q.db.Exec(ctx, refresh) + _, err := q.db.Exec(ctx, refreshSQL) return err } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go index d899ee8d86..28a8465396 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const refresh = `-- name: Refresh :exec +const refreshSQL = `-- name: Refresh :exec REFRESH MATERIALIZED VIEW myview ` func (q *Queries) Refresh(ctx context.Context) error { - _, err := q.db.Exec(ctx, refresh) + _, err := q.db.Exec(ctx, refreshSQL) return err } diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go index 98787cd712..40a90d807e 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -50,7 +50,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.Query(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go index 98787cd712..40a90d807e 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -50,7 +50,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.Query(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go index cdc74673e2..923c40ece4 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,7 +36,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -53,7 +53,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.QueryContext(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.QueryContext(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go index 98787cd712..40a90d807e 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -50,7 +50,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.Query(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go index 98787cd712..40a90d807e 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.Query(ctx, listBar) + rows, err := q.db.Query(ctx, listBarSQL) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -50,7 +50,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.Query(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.Query(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go index cdc74673e2..923c40ece4 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listBar = `-- name: ListBar :many +const listBarSQL = `-- name: ListBar :many SELECT id_old, ip_old FROM bar_old ` func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { - rows, err := q.db.QueryContext(ctx, listBar) + rows, err := q.db.QueryContext(ctx, listBarSQL) if err != nil { return nil, err } @@ -36,7 +36,7 @@ func (q *Queries) ListBar(ctx context.Context) ([]BarNew, error) { return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT id_old as foo_old, id_old as baz_old FROM bar_old WHERE ip_old = $1 AND id_old = $2 @@ -53,7 +53,7 @@ type ListFooRow struct { } func (q *Queries) ListFoo(ctx context.Context, arg ListFooParams) ([]ListFooRow, error) { - rows, err := q.db.QueryContext(ctx, listFoo, arg.IpOld, arg.IDNew) + rows, err := q.db.QueryContext(ctx, listFooSQL, arg.IpOld, arg.IDNew) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go index 780396dec1..ce8605e69b 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go @@ -10,57 +10,57 @@ import ( "database/sql" ) -const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +const deleteUserAndReturnIDSQL = `-- name: DeleteUserAndReturnID :one DELETE FROM users WHERE name = $1 RETURNING id ` func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { - row := q.db.QueryRow(ctx, deleteUserAndReturnID, name) + row := q.db.QueryRow(ctx, deleteUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +const deleteUserAndReturnUserSQL = `-- name: DeleteUserAndReturnUser :one DELETE FROM users WHERE name = $1 RETURNING name, id ` func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRow(ctx, deleteUserAndReturnUser, name) + row := q.db.QueryRow(ctx, deleteUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +const insertUserAndReturnIDSQL = `-- name: InsertUserAndReturnID :one INSERT INTO users (name) VALUES ($1) RETURNING id ` func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { - row := q.db.QueryRow(ctx, insertUserAndReturnID, name) + row := q.db.QueryRow(ctx, insertUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +const insertUserAndReturnUserSQL = `-- name: InsertUserAndReturnUser :one INSERT INTO users (name) VALUES ($1) RETURNING name, id ` func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRow(ctx, insertUserAndReturnUser, name) + row := q.db.QueryRow(ctx, insertUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +const updateUserAndReturnIDSQL = `-- name: UpdateUserAndReturnID :one UPDATE users SET name = $1 WHERE name = $2 RETURNING id @@ -72,13 +72,13 @@ type UpdateUserAndReturnIDParams struct { } func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { - row := q.db.QueryRow(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + row := q.db.QueryRow(ctx, updateUserAndReturnIDSQL, arg.Name, arg.Name_2) var id int32 err := row.Scan(&id) return id, err } -const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +const updateUserAndReturnUserSQL = `-- name: UpdateUserAndReturnUser :one UPDATE users SET name = $1 WHERE name = $2 RETURNING name, id @@ -90,7 +90,7 @@ type UpdateUserAndReturnUserParams struct { } func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { - row := q.db.QueryRow(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + row := q.db.QueryRow(ctx, updateUserAndReturnUserSQL, arg.Name, arg.Name_2) var i User err := row.Scan(&i.Name, &i.ID) return i, err diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go index b11556f827..fa1f403b48 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go @@ -11,57 +11,57 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +const deleteUserAndReturnIDSQL = `-- name: DeleteUserAndReturnID :one DELETE FROM users WHERE name = $1 RETURNING id ` func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name pgtype.Text) (int32, error) { - row := q.db.QueryRow(ctx, deleteUserAndReturnID, name) + row := q.db.QueryRow(ctx, deleteUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +const deleteUserAndReturnUserSQL = `-- name: DeleteUserAndReturnUser :one DELETE FROM users WHERE name = $1 RETURNING name, id ` func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name pgtype.Text) (User, error) { - row := q.db.QueryRow(ctx, deleteUserAndReturnUser, name) + row := q.db.QueryRow(ctx, deleteUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +const insertUserAndReturnIDSQL = `-- name: InsertUserAndReturnID :one INSERT INTO users (name) VALUES ($1) RETURNING id ` func (q *Queries) InsertUserAndReturnID(ctx context.Context, name pgtype.Text) (int32, error) { - row := q.db.QueryRow(ctx, insertUserAndReturnID, name) + row := q.db.QueryRow(ctx, insertUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +const insertUserAndReturnUserSQL = `-- name: InsertUserAndReturnUser :one INSERT INTO users (name) VALUES ($1) RETURNING name, id ` func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name pgtype.Text) (User, error) { - row := q.db.QueryRow(ctx, insertUserAndReturnUser, name) + row := q.db.QueryRow(ctx, insertUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +const updateUserAndReturnIDSQL = `-- name: UpdateUserAndReturnID :one UPDATE users SET name = $1 WHERE name = $2 RETURNING id @@ -73,13 +73,13 @@ type UpdateUserAndReturnIDParams struct { } func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { - row := q.db.QueryRow(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + row := q.db.QueryRow(ctx, updateUserAndReturnIDSQL, arg.Name, arg.Name_2) var id int32 err := row.Scan(&id) return id, err } -const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +const updateUserAndReturnUserSQL = `-- name: UpdateUserAndReturnUser :one UPDATE users SET name = $1 WHERE name = $2 RETURNING name, id @@ -91,7 +91,7 @@ type UpdateUserAndReturnUserParams struct { } func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { - row := q.db.QueryRow(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + row := q.db.QueryRow(ctx, updateUserAndReturnUserSQL, arg.Name, arg.Name_2) var i User err := row.Scan(&i.Name, &i.ID) return i, err diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go index a955d47fc5..cc7df1a679 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go @@ -10,57 +10,57 @@ import ( "database/sql" ) -const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +const deleteUserAndReturnIDSQL = `-- name: DeleteUserAndReturnID :one DELETE FROM users WHERE name = $1 RETURNING id ` func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { - row := q.db.QueryRowContext(ctx, deleteUserAndReturnID, name) + row := q.db.QueryRowContext(ctx, deleteUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +const deleteUserAndReturnUserSQL = `-- name: DeleteUserAndReturnUser :one DELETE FROM users WHERE name = $1 RETURNING name, id ` func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRowContext(ctx, deleteUserAndReturnUser, name) + row := q.db.QueryRowContext(ctx, deleteUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +const insertUserAndReturnIDSQL = `-- name: InsertUserAndReturnID :one INSERT INTO users (name) VALUES ($1) RETURNING id ` func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int32, error) { - row := q.db.QueryRowContext(ctx, insertUserAndReturnID, name) + row := q.db.QueryRowContext(ctx, insertUserAndReturnIDSQL, name) var id int32 err := row.Scan(&id) return id, err } -const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +const insertUserAndReturnUserSQL = `-- name: InsertUserAndReturnUser :one INSERT INTO users (name) VALUES ($1) RETURNING name, id ` func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRowContext(ctx, insertUserAndReturnUser, name) + row := q.db.QueryRowContext(ctx, insertUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +const updateUserAndReturnIDSQL = `-- name: UpdateUserAndReturnID :one UPDATE users SET name = $1 WHERE name = $2 RETURNING id @@ -72,13 +72,13 @@ type UpdateUserAndReturnIDParams struct { } func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int32, error) { - row := q.db.QueryRowContext(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + row := q.db.QueryRowContext(ctx, updateUserAndReturnIDSQL, arg.Name, arg.Name_2) var id int32 err := row.Scan(&id) return id, err } -const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +const updateUserAndReturnUserSQL = `-- name: UpdateUserAndReturnUser :one UPDATE users SET name = $1 WHERE name = $2 RETURNING name, id @@ -90,7 +90,7 @@ type UpdateUserAndReturnUserParams struct { } func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { - row := q.db.QueryRowContext(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + row := q.db.QueryRowContext(ctx, updateUserAndReturnUserSQL, arg.Name, arg.Name_2) var i User err := row.Scan(&i.Name, &i.ID) return i, err diff --git a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go index c081f1c29f..ce5a2524e4 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go @@ -10,59 +10,59 @@ import ( "database/sql" ) -const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one +const deleteUserAndReturnIDSQL = `-- name: DeleteUserAndReturnID :one DELETE FROM users WHERE name = ?1 RETURNING id ` func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { - row := q.db.QueryRowContext(ctx, deleteUserAndReturnID, name) + row := q.db.QueryRowContext(ctx, deleteUserAndReturnIDSQL, name) var id int64 err := row.Scan(&id) return id, err } -const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one +const deleteUserAndReturnUserSQL = `-- name: DeleteUserAndReturnUser :one DELETE FROM users WHERE name = ?1 RETURNING name, id ` func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRowContext(ctx, deleteUserAndReturnUser, name) + row := q.db.QueryRowContext(ctx, deleteUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one +const insertUserAndReturnIDSQL = `-- name: InsertUserAndReturnID :one INSERT INTO users (name) VALUES (?1) RETURNING id ` func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { - row := q.db.QueryRowContext(ctx, insertUserAndReturnID, name) + row := q.db.QueryRowContext(ctx, insertUserAndReturnIDSQL, name) var id int64 err := row.Scan(&id) return id, err } -const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one +const insertUserAndReturnUserSQL = `-- name: InsertUserAndReturnUser :one INSERT INTO users (name) VALUES (?1) RETURNING name, id ` func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { - row := q.db.QueryRowContext(ctx, insertUserAndReturnUser, name) + row := q.db.QueryRowContext(ctx, insertUserAndReturnUserSQL, name) var i User err := row.Scan(&i.Name, &i.ID) return i, err } -const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one +const updateUserAndReturnIDSQL = `-- name: UpdateUserAndReturnID :one UPDATE users SET name = ?1 WHERE name = ?2 @@ -75,13 +75,13 @@ type UpdateUserAndReturnIDParams struct { } func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndReturnIDParams) (int64, error) { - row := q.db.QueryRowContext(ctx, updateUserAndReturnID, arg.Name, arg.Name_2) + row := q.db.QueryRowContext(ctx, updateUserAndReturnIDSQL, arg.Name, arg.Name_2) var id int64 err := row.Scan(&id) return id, err } -const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one +const updateUserAndReturnUserSQL = `-- name: UpdateUserAndReturnUser :one UPDATE users SET name = ?1 WHERE name = ?2 @@ -94,7 +94,7 @@ type UpdateUserAndReturnUserParams struct { } func (q *Queries) UpdateUserAndReturnUser(ctx context.Context, arg UpdateUserAndReturnUserParams) (User, error) { - row := q.db.QueryRowContext(ctx, updateUserAndReturnUser, arg.Name, arg.Name_2) + row := q.db.QueryRowContext(ctx, updateUserAndReturnUserSQL, arg.Name, arg.Name_2) var i User err := row.Scan(&i.Name, &i.ID) return i, err diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go index 1ef5f230f1..bc27457b2b 100644 --- a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const deleteReturningOldNew = `-- name: DeleteReturningOldNew :one +const deleteReturningOldNewSQL = `-- name: DeleteReturningOldNew :one DELETE FROM users WHERE id = $1 RETURNING old.name, new.name ` @@ -22,13 +22,13 @@ type DeleteReturningOldNewRow struct { } func (q *Queries) DeleteReturningOldNew(ctx context.Context, id int64) (DeleteReturningOldNewRow, error) { - row := q.db.QueryRow(ctx, deleteReturningOldNew, id) + row := q.db.QueryRow(ctx, deleteReturningOldNewSQL, id) var i DeleteReturningOldNewRow err := row.Scan(&i.Name, &i.Name_2) return i, err } -const insertReturningOldNew = `-- name: InsertReturningOldNew :one +const insertReturningOldNewSQL = `-- name: InsertReturningOldNew :one INSERT INTO users (name) VALUES ($1) RETURNING old.id, new.id ` @@ -39,13 +39,13 @@ type InsertReturningOldNewRow struct { } func (q *Queries) InsertReturningOldNew(ctx context.Context, name string) (InsertReturningOldNewRow, error) { - row := q.db.QueryRow(ctx, insertReturningOldNew, name) + row := q.db.QueryRow(ctx, insertReturningOldNewSQL, name) var i InsertReturningOldNewRow err := row.Scan(&i.ID, &i.ID_2) return i, err } -const updateReturningOld = `-- name: UpdateReturningOld :one +const updateReturningOldSQL = `-- name: UpdateReturningOld :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.name ` @@ -56,13 +56,13 @@ type UpdateReturningOldParams struct { } func (q *Queries) UpdateReturningOld(ctx context.Context, arg UpdateReturningOldParams) (string, error) { - row := q.db.QueryRow(ctx, updateReturningOld, arg.Name, arg.ID) + row := q.db.QueryRow(ctx, updateReturningOldSQL, arg.Name, arg.ID) var name string err := row.Scan(&name) return name, err } -const updateReturningOldNew = `-- name: UpdateReturningOldNew :one +const updateReturningOldNewSQL = `-- name: UpdateReturningOldNew :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.name, new.name ` @@ -78,13 +78,13 @@ type UpdateReturningOldNewRow struct { } func (q *Queries) UpdateReturningOldNew(ctx context.Context, arg UpdateReturningOldNewParams) (UpdateReturningOldNewRow, error) { - row := q.db.QueryRow(ctx, updateReturningOldNew, arg.Name, arg.ID) + row := q.db.QueryRow(ctx, updateReturningOldNewSQL, arg.Name, arg.ID) var i UpdateReturningOldNewRow err := row.Scan(&i.Name, &i.Name_2) return i, err } -const updateReturningOldStar = `-- name: UpdateReturningOldStar :one +const updateReturningOldStarSQL = `-- name: UpdateReturningOldStar :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.id, old.name, old.bio ` @@ -95,13 +95,13 @@ type UpdateReturningOldStarParams struct { } func (q *Queries) UpdateReturningOldStar(ctx context.Context, arg UpdateReturningOldStarParams) (User, error) { - row := q.db.QueryRow(ctx, updateReturningOldStar, arg.Name, arg.ID) + row := q.db.QueryRow(ctx, updateReturningOldStarSQL, arg.Name, arg.ID) var i User err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const updateReturningWithAliases = `-- name: UpdateReturningWithAliases :one +const updateReturningWithAliasesSQL = `-- name: UpdateReturningWithAliases :one UPDATE users SET name = $1 WHERE id = $2 RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name ` @@ -117,7 +117,7 @@ type UpdateReturningWithAliasesRow struct { } func (q *Queries) UpdateReturningWithAliases(ctx context.Context, arg UpdateReturningWithAliasesParams) (UpdateReturningWithAliasesRow, error) { - row := q.db.QueryRow(ctx, updateReturningWithAliases, arg.Name, arg.ID) + row := q.db.QueryRow(ctx, updateReturningWithAliasesSQL, arg.Name, arg.ID) var i UpdateReturningWithAliasesRow err := row.Scan(&i.Name, &i.Name_2) return i, err diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go index ba3139ee00..f1abd768be 100644 --- a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteReturningOldNew = `-- name: DeleteReturningOldNew :one +const deleteReturningOldNewSQL = `-- name: DeleteReturningOldNew :one DELETE FROM users WHERE id = $1 RETURNING old.name, new.name ` @@ -21,13 +21,13 @@ type DeleteReturningOldNewRow struct { } func (q *Queries) DeleteReturningOldNew(ctx context.Context, id int64) (DeleteReturningOldNewRow, error) { - row := q.db.QueryRowContext(ctx, deleteReturningOldNew, id) + row := q.db.QueryRowContext(ctx, deleteReturningOldNewSQL, id) var i DeleteReturningOldNewRow err := row.Scan(&i.Name, &i.Name_2) return i, err } -const insertReturningOldNew = `-- name: InsertReturningOldNew :one +const insertReturningOldNewSQL = `-- name: InsertReturningOldNew :one INSERT INTO users (name) VALUES ($1) RETURNING old.id, new.id ` @@ -38,13 +38,13 @@ type InsertReturningOldNewRow struct { } func (q *Queries) InsertReturningOldNew(ctx context.Context, name string) (InsertReturningOldNewRow, error) { - row := q.db.QueryRowContext(ctx, insertReturningOldNew, name) + row := q.db.QueryRowContext(ctx, insertReturningOldNewSQL, name) var i InsertReturningOldNewRow err := row.Scan(&i.ID, &i.ID_2) return i, err } -const updateReturningOld = `-- name: UpdateReturningOld :one +const updateReturningOldSQL = `-- name: UpdateReturningOld :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.name ` @@ -55,13 +55,13 @@ type UpdateReturningOldParams struct { } func (q *Queries) UpdateReturningOld(ctx context.Context, arg UpdateReturningOldParams) (string, error) { - row := q.db.QueryRowContext(ctx, updateReturningOld, arg.Name, arg.ID) + row := q.db.QueryRowContext(ctx, updateReturningOldSQL, arg.Name, arg.ID) var name string err := row.Scan(&name) return name, err } -const updateReturningOldNew = `-- name: UpdateReturningOldNew :one +const updateReturningOldNewSQL = `-- name: UpdateReturningOldNew :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.name, new.name ` @@ -77,13 +77,13 @@ type UpdateReturningOldNewRow struct { } func (q *Queries) UpdateReturningOldNew(ctx context.Context, arg UpdateReturningOldNewParams) (UpdateReturningOldNewRow, error) { - row := q.db.QueryRowContext(ctx, updateReturningOldNew, arg.Name, arg.ID) + row := q.db.QueryRowContext(ctx, updateReturningOldNewSQL, arg.Name, arg.ID) var i UpdateReturningOldNewRow err := row.Scan(&i.Name, &i.Name_2) return i, err } -const updateReturningOldStar = `-- name: UpdateReturningOldStar :one +const updateReturningOldStarSQL = `-- name: UpdateReturningOldStar :one UPDATE users SET name = $1 WHERE id = $2 RETURNING old.id, old.name, old.bio ` @@ -94,13 +94,13 @@ type UpdateReturningOldStarParams struct { } func (q *Queries) UpdateReturningOldStar(ctx context.Context, arg UpdateReturningOldStarParams) (User, error) { - row := q.db.QueryRowContext(ctx, updateReturningOldStar, arg.Name, arg.ID) + row := q.db.QueryRowContext(ctx, updateReturningOldStarSQL, arg.Name, arg.ID) var i User err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const updateReturningWithAliases = `-- name: UpdateReturningWithAliases :one +const updateReturningWithAliasesSQL = `-- name: UpdateReturningWithAliases :one UPDATE users SET name = $1 WHERE id = $2 RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name ` @@ -116,7 +116,7 @@ type UpdateReturningWithAliasesRow struct { } func (q *Queries) UpdateReturningWithAliases(ctx context.Context, arg UpdateReturningWithAliasesParams) (UpdateReturningWithAliasesRow, error) { - row := q.db.QueryRowContext(ctx, updateReturningWithAliases, arg.Name, arg.ID) + row := q.db.QueryRowContext(ctx, updateReturningWithAliasesSQL, arg.Name, arg.ID) var i UpdateReturningWithAliasesRow err := row.Scan(&i.Name, &i.Name_2) return i, err diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go index ff8227e84a..bc5cbc70e1 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const schemaScopedCreate = `-- name: SchemaScopedCreate :execresult +const schemaScopedCreateSQL = `-- name: SchemaScopedCreate :execresult INSERT INTO foo.bar (id, name) VALUES (?, ?) ` @@ -20,5 +20,5 @@ type SchemaScopedCreateParams struct { } func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (sql.Result, error) { - return q.db.ExecContext(ctx, schemaScopedCreate, arg.ID, arg.Name) + return q.db.ExecContext(ctx, schemaScopedCreateSQL, arg.ID, arg.Name) } diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go index a6a3bbe38a..48fa7c1046 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedCreate = `-- name: SchemaScopedCreate :one +const schemaScopedCreateSQL = `-- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id ` @@ -19,7 +19,7 @@ type SchemaScopedCreateParams struct { } func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { - row := q.db.QueryRow(ctx, schemaScopedCreate, arg.ID, arg.Name) + row := q.db.QueryRow(ctx, schemaScopedCreateSQL, arg.ID, arg.Name) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go index a6a3bbe38a..48fa7c1046 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedCreate = `-- name: SchemaScopedCreate :one +const schemaScopedCreateSQL = `-- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id ` @@ -19,7 +19,7 @@ type SchemaScopedCreateParams struct { } func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { - row := q.db.QueryRow(ctx, schemaScopedCreate, arg.ID, arg.Name) + row := q.db.QueryRow(ctx, schemaScopedCreateSQL, arg.ID, arg.Name) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go index 3fb8671e53..b68adbc36b 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedCreate = `-- name: SchemaScopedCreate :one +const schemaScopedCreateSQL = `-- name: SchemaScopedCreate :one INSERT INTO foo.bar (id, name) VALUES ($1, $2) RETURNING id ` @@ -19,7 +19,7 @@ type SchemaScopedCreateParams struct { } func (q *Queries) SchemaScopedCreate(ctx context.Context, arg SchemaScopedCreateParams) (int32, error) { - row := q.db.QueryRowContext(ctx, schemaScopedCreate, arg.ID, arg.Name) + row := q.db.QueryRowContext(ctx, schemaScopedCreateSQL, arg.ID, arg.Name) var id int32 err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go index 95c5c20a80..1d7f1fb720 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +const schemaScopedDeleteSQL = `-- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = ? ` func (q *Queries) SchemaScopedDelete(ctx context.Context, id uint64) error { - _, err := q.db.ExecContext(ctx, schemaScopedDelete, id) + _, err := q.db.ExecContext(ctx, schemaScopedDeleteSQL, id) return err } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go index 8d0cb34c86..915e124e91 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +const schemaScopedDeleteSQL = `-- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { - _, err := q.db.Exec(ctx, schemaScopedDelete, id) + _, err := q.db.Exec(ctx, schemaScopedDeleteSQL, id) return err } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go index 8d0cb34c86..915e124e91 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +const schemaScopedDeleteSQL = `-- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { - _, err := q.db.Exec(ctx, schemaScopedDelete, id) + _, err := q.db.Exec(ctx, schemaScopedDeleteSQL, id) return err } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go index 021d2a3d33..30d9d571b1 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const schemaScopedDelete = `-- name: SchemaScopedDelete :exec +const schemaScopedDeleteSQL = `-- name: SchemaScopedDelete :exec DELETE FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedDelete(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, schemaScopedDelete, id) + _, err := q.db.ExecContext(ctx, schemaScopedDeleteSQL, id) return err } diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go index 46a7d0ea3a..70f1bf85ba 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role FROM foo.users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go index 46a7d0ea3a..70f1bf85ba 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role FROM foo.users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { - rows, err := q.db.Query(ctx, listUsersByRole, role) + rows, err := q.db.Query(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go index c28c1ca8bb..1fb3874297 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listUsersByRole = `-- name: ListUsersByRole :many +const listUsersByRoleSQL = `-- name: ListUsersByRole :many SELECT role FROM foo.users WHERE role = $1 ` func (q *Queries) ListUsersByRole(ctx context.Context, role NullFooTypeUserRole) ([]NullFooTypeUserRole, error) { - rows, err := q.db.QueryContext(ctx, listUsersByRole, role) + rows, err := q.db.QueryContext(ctx, listUsersByRoleSQL, role) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go index 72a1a558a4..f899ec8d50 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedFilter = `-- name: SchemaScopedFilter :many +const schemaScopedFilterSQL = `-- name: SchemaScopedFilter :many SELECT id FROM foo.bar WHERE id = ? ` func (q *Queries) SchemaScopedFilter(ctx context.Context, id uint64) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedFilter, id) + rows, err := q.db.QueryContext(ctx, schemaScopedFilterSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go index cc723edbe6..122d1808b0 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedFilter = `-- name: SchemaScopedFilter :many +const schemaScopedFilterSQL = `-- name: SchemaScopedFilter :many SELECT id FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedFilter, id) + rows, err := q.db.Query(ctx, schemaScopedFilterSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go index cc723edbe6..122d1808b0 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedFilter = `-- name: SchemaScopedFilter :many +const schemaScopedFilterSQL = `-- name: SchemaScopedFilter :many SELECT id FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedFilter, id) + rows, err := q.db.Query(ctx, schemaScopedFilterSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go index 3fe07f3ae5..3f036770b0 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedFilter = `-- name: SchemaScopedFilter :many +const schemaScopedFilterSQL = `-- name: SchemaScopedFilter :many SELECT id FROM foo.bar WHERE id = $1 ` func (q *Queries) SchemaScopedFilter(ctx context.Context, id int32) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedFilter, id) + rows, err := q.db.QueryContext(ctx, schemaScopedFilterSQL, id) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go index b724f882e0..065f936c90 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedColList = `-- name: SchemaScopedColList :many +const schemaScopedColListSQL = `-- name: SchemaScopedColList :many SELECT foo.bar.id FROM foo.bar ` func (q *Queries) SchemaScopedColList(ctx context.Context) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedColList) + rows, err := q.db.QueryContext(ctx, schemaScopedColListSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) SchemaScopedColList(ctx context.Context) ([]uint64, error) { return items, nil } -const schemaScopedList = `-- name: SchemaScopedList :many +const schemaScopedListSQL = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` func (q *Queries) SchemaScopedList(ctx context.Context) ([]uint64, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedList) + rows, err := q.db.QueryContext(ctx, schemaScopedListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go index 4449bbe9d7..20549d4f7f 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedColList = `-- name: SchemaScopedColList :many +const schemaScopedColListSQL = `-- name: SchemaScopedColList :many SELECT foo.bar.id FROM foo.bar ` func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedColList) + rows, err := q.db.Query(ctx, schemaScopedColListSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { return items, nil } -const schemaScopedList = `-- name: SchemaScopedList :many +const schemaScopedListSQL = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedList) + rows, err := q.db.Query(ctx, schemaScopedListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go index 4449bbe9d7..20549d4f7f 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedColList = `-- name: SchemaScopedColList :many +const schemaScopedColListSQL = `-- name: SchemaScopedColList :many SELECT foo.bar.id FROM foo.bar ` func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedColList) + rows, err := q.db.Query(ctx, schemaScopedColListSQL) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { return items, nil } -const schemaScopedList = `-- name: SchemaScopedList :many +const schemaScopedListSQL = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, schemaScopedList) + rows, err := q.db.Query(ctx, schemaScopedListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go index a7b3a49be6..028a85e492 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const schemaScopedColList = `-- name: SchemaScopedColList :many +const schemaScopedColListSQL = `-- name: SchemaScopedColList :many SELECT foo.bar.id FROM foo.bar ` func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedColList) + rows, err := q.db.QueryContext(ctx, schemaScopedColListSQL) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { return items, nil } -const schemaScopedList = `-- name: SchemaScopedList :many +const schemaScopedListSQL = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` func (q *Queries) SchemaScopedList(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, schemaScopedList) + rows, err := q.db.QueryContext(ctx, schemaScopedListSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go index 19858da3a5..e59ff0a331 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +const schemaScopedUpdateSQL = `-- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = ? WHERE id = ? ` @@ -19,6 +19,6 @@ type SchemaScopedUpdateParams struct { } func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { - _, err := q.db.ExecContext(ctx, schemaScopedUpdate, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, schemaScopedUpdateSQL, arg.Name, arg.ID) return err } diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go index 75f6672b37..3e989b2416 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +const schemaScopedUpdateSQL = `-- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1 ` @@ -19,6 +19,6 @@ type SchemaScopedUpdateParams struct { } func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { - _, err := q.db.Exec(ctx, schemaScopedUpdate, arg.ID, arg.Name) + _, err := q.db.Exec(ctx, schemaScopedUpdateSQL, arg.ID, arg.Name) return err } diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go index 75f6672b37..3e989b2416 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +const schemaScopedUpdateSQL = `-- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1 ` @@ -19,6 +19,6 @@ type SchemaScopedUpdateParams struct { } func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { - _, err := q.db.Exec(ctx, schemaScopedUpdate, arg.ID, arg.Name) + _, err := q.db.Exec(ctx, schemaScopedUpdateSQL, arg.ID, arg.Name) return err } diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go index e56c19fccd..a5e3f51b74 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const schemaScopedUpdate = `-- name: SchemaScopedUpdate :exec +const schemaScopedUpdateSQL = `-- name: SchemaScopedUpdate :exec UPDATE foo.bar SET name = $2 WHERE id = $1 ` @@ -19,6 +19,6 @@ type SchemaScopedUpdateParams struct { } func (q *Queries) SchemaScopedUpdate(ctx context.Context, arg SchemaScopedUpdateParams) error { - _, err := q.db.ExecContext(ctx, schemaScopedUpdate, arg.ID, arg.Name) + _, err := q.db.ExecContext(ctx, schemaScopedUpdateSQL, arg.ID, arg.Name) return err } diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go index ce83f76e91..f4872c7574 100644 --- a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getTotalSlackQueries = `-- name: GetTotalSlackQueries :one +const getTotalSlackQueriesSQL = `-- name: GetTotalSlackQueries :one SELECT COUNT(*) AS count FROM astoria.slack_feedback @@ -26,13 +26,13 @@ type GetTotalSlackQueriesParams struct { } func (q *Queries) GetTotalSlackQueries(ctx context.Context, arg GetTotalSlackQueriesParams) (int64, error) { - row := q.db.QueryRow(ctx, getTotalSlackQueries, arg.WorkspaceID, arg.Column2, arg.Column3) + row := q.db.QueryRow(ctx, getTotalSlackQueriesSQL, arg.WorkspaceID, arg.Column2, arg.Column3) var count int64 err := row.Scan(&count) return count, err } -const getTotalSlackQueriesRequestsCreated = `-- name: GetTotalSlackQueriesRequestsCreated :one +const getTotalSlackQueriesRequestsCreatedSQL = `-- name: GetTotalSlackQueriesRequestsCreated :one SELECT COUNT(*) AS count FROM astoria.tickets @@ -48,13 +48,13 @@ type GetTotalSlackQueriesRequestsCreatedParams struct { } func (q *Queries) GetTotalSlackQueriesRequestsCreated(ctx context.Context, arg GetTotalSlackQueriesRequestsCreatedParams) (int64, error) { - row := q.db.QueryRow(ctx, getTotalSlackQueriesRequestsCreated, arg.WorkspaceID, arg.Column2, arg.Column3) + row := q.db.QueryRow(ctx, getTotalSlackQueriesRequestsCreatedSQL, arg.WorkspaceID, arg.Column2, arg.Column3) var count int64 err := row.Scan(&count) return count, err } -const getTotalSlackQueriesResolved = `-- name: GetTotalSlackQueriesResolved :one +const getTotalSlackQueriesResolvedSQL = `-- name: GetTotalSlackQueriesResolved :one SELECT COUNT(*) AS count FROM astoria.slack_feedback @@ -70,7 +70,7 @@ type GetTotalSlackQueriesResolvedParams struct { } func (q *Queries) GetTotalSlackQueriesResolved(ctx context.Context, arg GetTotalSlackQueriesResolvedParams) (int64, error) { - row := q.db.QueryRow(ctx, getTotalSlackQueriesResolved, arg.WorkspaceID, arg.Column2, arg.Column3) + row := q.db.QueryRow(ctx, getTotalSlackQueriesResolvedSQL, arg.WorkspaceID, arg.Column2, arg.Column3) var count int64 err := row.Scan(&count) return count, err diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go index a66217e67a..f0edc529c5 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectColumnCast = `-- name: SelectColumnCast :many +const selectColumnCastSQL = `-- name: SelectColumnCast :many SELECT CAST(bar AS UNSIGNED) FROM foo ` func (q *Queries) SelectColumnCast(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, selectColumnCast) + rows, err := q.db.QueryContext(ctx, selectColumnCastSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go index 54f358ea88..e2938a19f7 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectColumnCast = `-- name: SelectColumnCast :many +const selectColumnCastSQL = `-- name: SelectColumnCast :many SELECT bar::int FROM foo ` func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, selectColumnCast) + rows, err := q.db.Query(ctx, selectColumnCastSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go index 54f358ea88..e2938a19f7 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectColumnCast = `-- name: SelectColumnCast :many +const selectColumnCastSQL = `-- name: SelectColumnCast :many SELECT bar::int FROM foo ` func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, selectColumnCast) + rows, err := q.db.Query(ctx, selectColumnCastSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go index 1c5bf0417e..c4d67fb1e5 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectColumnCast = `-- name: SelectColumnCast :many +const selectColumnCastSQL = `-- name: SelectColumnCast :many SELECT bar::int FROM foo ` func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, selectColumnCast) + rows, err := q.db.QueryContext(ctx, selectColumnCastSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go index a8c2742d73..a81eae4074 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectColumnCast = `-- name: SelectColumnCast :many +const selectColumnCastSQL = `-- name: SelectColumnCast :many SELECT CAST(bar AS BLOB) FROM foo ` func (q *Queries) SelectColumnCast(ctx context.Context) ([][]byte, error) { - rows, err := q.db.QueryContext(ctx, selectColumnCast) + rows, err := q.db.QueryContext(ctx, selectColumnCastSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go index 8d2b8ae6cc..e9a28ca7ac 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many WITH abc AS ( SELECT 1 AS n ) @@ -17,7 +17,7 @@ SELECT n FROM abc ` func (q *Queries) ListAuthors(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go index 84a7ab51f1..37fb6cb091 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT DISTINCT ON (a.id) a.id, a.name FROM bar a ` func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, getBars) + rows, err := q.db.Query(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go index 84a7ab51f1..37fb6cb091 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT DISTINCT ON (a.id) a.id, a.name FROM bar a ` func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, getBars) + rows, err := q.db.Query(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go index 8f3b369164..51dbfab279 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go @@ -9,13 +9,13 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT DISTINCT ON (a.id) a.id, a.name FROM bar a ` func (q *Queries) GetBars(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, getBars) + rows, err := q.db.QueryContext(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go index a477f23b12..ef14ec1744 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT FROM bar LIMIT 5 ` @@ -17,7 +17,7 @@ type GetBarsRow struct { } func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { - rows, err := q.db.Query(ctx, getBars) + rows, err := q.db.Query(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go index a477f23b12..ef14ec1744 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT FROM bar LIMIT 5 ` @@ -17,7 +17,7 @@ type GetBarsRow struct { } func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { - rows, err := q.db.Query(ctx, getBars) + rows, err := q.db.Query(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go index af2067dbe3..76a1b55711 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getBars = `-- name: GetBars :many +const getBarsSQL = `-- name: GetBars :many SELECT FROM bar LIMIT 5 ` @@ -17,7 +17,7 @@ type GetBarsRow struct { } func (q *Queries) GetBars(ctx context.Context) ([]GetBarsRow, error) { - rows, err := q.db.QueryContext(ctx, getBars) + rows, err := q.db.QueryContext(ctx, getBarsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go index 359df59810..03b2f6133d 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barExists = `-- name: BarExists :one +const barExistsSQL = `-- name: BarExists :one SELECT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRow(ctx, barExists, id) + row := q.db.QueryRow(ctx, barExistsSQL, id) var exists bool err := row.Scan(&exists) return exists, err diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go index 359df59810..03b2f6133d 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barExists = `-- name: BarExists :one +const barExistsSQL = `-- name: BarExists :one SELECT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRow(ctx, barExists, id) + row := q.db.QueryRow(ctx, barExistsSQL, id) var exists bool err := row.Scan(&exists) return exists, err diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go index d0d680408d..3affdf5193 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barExists = `-- name: BarExists :one +const barExistsSQL = `-- name: BarExists :one SELECT EXISTS ( SELECT 1 @@ -19,7 +19,7 @@ SELECT ` func (q *Queries) BarExists(ctx context.Context, id int64) (bool, error) { - row := q.db.QueryRowContext(ctx, barExists, id) + row := q.db.QueryRowContext(ctx, barExistsSQL, id) var exists bool err := row.Scan(&exists) return exists, err diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go index cfbcd91579..e3209dcbe9 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barExists = `-- name: BarExists :one +const barExistsSQL = `-- name: BarExists :one SELECT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRowContext(ctx, barExists, id) + row := q.db.QueryRowContext(ctx, barExistsSQL, id) var exists bool err := row.Scan(&exists) return exists, err diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go index 3a97dad1de..347566227b 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM books AS b WHERE NOT b.author IN ( SELECT a.name @@ -32,6 +32,6 @@ type DeleteAuthorParams struct { } func (q *Queries) DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, arg.Age, arg.Age_2, arg.Year) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, arg.Age, arg.Age_2, arg.Year) return err } diff --git a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go index 163da541ea..833616ec40 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const fooLimit = `-- name: FooLimit :many +const fooLimitSQL = `-- name: FooLimit :many SELECT a FROM foo LIMIT ? ` func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimit, limit) + rows, err := q.db.QueryContext(ctx, fooLimitSQL, limit) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, return items, nil } -const fooLimitOffset = `-- name: FooLimitOffset :many +const fooLimitOffsetSQL = `-- name: FooLimitOffset :many SELECT a FROM foo LIMIT ? OFFSET ? ` @@ -49,7 +49,7 @@ type FooLimitOffsetParams struct { } func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, fooLimitOffsetSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go index e13ab388a3..524b62e61e 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const fooLimit = `-- name: FooLimit :many +const fooLimitSQL = `-- name: FooLimit :many SELECT a FROM foo LIMIT $1 ` func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, fooLimit, limit) + rows, err := q.db.Query(ctx, fooLimitSQL, limit) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, return items, nil } -const fooLimitOffset = `-- name: FooLimitOffset :many +const fooLimitOffsetSQL = `-- name: FooLimitOffset :many SELECT a FROM foo LIMIT $1 OFFSET $2 ` @@ -46,7 +46,7 @@ type FooLimitOffsetParams struct { } func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, fooLimitOffset, arg.Limit, arg.Offset) + rows, err := q.db.Query(ctx, fooLimitOffsetSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go index 95e18d4388..bec90b28a2 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go @@ -11,13 +11,13 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const fooLimit = `-- name: FooLimit :many +const fooLimitSQL = `-- name: FooLimit :many SELECT a FROM foo LIMIT $1 ` func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, fooLimit, limit) + rows, err := q.db.Query(ctx, fooLimitSQL, limit) if err != nil { return nil, err } @@ -36,7 +36,7 @@ func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]pgtype.Text, err return items, nil } -const fooLimitOffset = `-- name: FooLimitOffset :many +const fooLimitOffsetSQL = `-- name: FooLimitOffset :many SELECT a FROM foo LIMIT $1 OFFSET $2 ` @@ -47,7 +47,7 @@ type FooLimitOffsetParams struct { } func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, fooLimitOffset, arg.Limit, arg.Offset) + rows, err := q.db.Query(ctx, fooLimitOffsetSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go index a977098ff3..b56b9b5b83 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const fooLimit = `-- name: FooLimit :many +const fooLimitSQL = `-- name: FooLimit :many SELECT a FROM foo LIMIT $1 ` func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimit, limit) + rows, err := q.db.QueryContext(ctx, fooLimitSQL, limit) if err != nil { return nil, err } @@ -38,7 +38,7 @@ func (q *Queries) FooLimit(ctx context.Context, limit int32) ([]sql.NullString, return items, nil } -const fooLimitOffset = `-- name: FooLimitOffset :many +const fooLimitOffsetSQL = `-- name: FooLimitOffset :many SELECT a FROM foo LIMIT $1 OFFSET $2 ` @@ -49,7 +49,7 @@ type FooLimitOffsetParams struct { } func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, fooLimitOffsetSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go index 8eba03c574..4f5501e8b5 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go @@ -10,14 +10,14 @@ import ( "database/sql" ) -const fooLimit = `-- name: FooLimit :many +const fooLimitSQL = `-- name: FooLimit :many SELECT a FROM foo LIMIT ? ` func (q *Queries) FooLimit(ctx context.Context, limit int64) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimit, limit) + rows, err := q.db.QueryContext(ctx, fooLimitSQL, limit) if err != nil { return nil, err } @@ -39,7 +39,7 @@ func (q *Queries) FooLimit(ctx context.Context, limit int64) ([]sql.NullString, return items, nil } -const fooLimitOffset = `-- name: FooLimitOffset :many +const fooLimitOffsetSQL = `-- name: FooLimitOffset :many SELECT a FROM foo LIMIT ? @@ -52,7 +52,7 @@ type FooLimitOffsetParams struct { } func (q *Queries) FooLimitOffset(ctx context.Context, arg FooLimitOffsetParams) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, fooLimitOffset, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, fooLimitOffsetSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go index ca978554b3..69aab6f043 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +const getAuthorsWithBooksCountSQL = `-- name: GetAuthorsWithBooksCount :many SELECT id, name, bio, ( SELECT COUNT(id) FROM books WHERE books.author_id = id @@ -26,7 +26,7 @@ type GetAuthorsWithBooksCountRow struct { } func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { - rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go index ca978554b3..69aab6f043 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +const getAuthorsWithBooksCountSQL = `-- name: GetAuthorsWithBooksCount :many SELECT id, name, bio, ( SELECT COUNT(id) FROM books WHERE books.author_id = id @@ -26,7 +26,7 @@ type GetAuthorsWithBooksCountRow struct { } func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { - rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go index 0b610a9c83..4601046abb 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many +const getAuthorsWithBooksCountSQL = `-- name: GetAuthorsWithBooksCount :many SELECT id, name, bio, ( @@ -29,7 +29,7 @@ type GetAuthorsWithBooksCountRow struct { } func (q *Queries) GetAuthorsWithBooksCount(ctx context.Context) ([]GetAuthorsWithBooksCountRow, error) { - rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCount) + rows, err := q.db.QueryContext(ctx, getAuthorsWithBooksCountSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go index 2f9ec4b003..3da4046def 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barNotExists = `-- name: BarNotExists :one +const barNotExistsSQL = `-- name: BarNotExists :one SELECT NOT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarNotExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRow(ctx, barNotExists, id) + row := q.db.QueryRow(ctx, barNotExistsSQL, id) var not_exists bool err := row.Scan(¬_exists) return not_exists, err diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go index 2f9ec4b003..3da4046def 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barNotExists = `-- name: BarNotExists :one +const barNotExistsSQL = `-- name: BarNotExists :one SELECT NOT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarNotExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRow(ctx, barNotExists, id) + row := q.db.QueryRow(ctx, barNotExistsSQL, id) var not_exists bool err := row.Scan(¬_exists) return not_exists, err diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go index dfa8dcedcc..5faf682699 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barNotExists = `-- name: BarNotExists :one +const barNotExistsSQL = `-- name: BarNotExists :one SELECT NOT EXISTS ( SELECT 1 @@ -19,7 +19,7 @@ SELECT ` func (q *Queries) BarNotExists(ctx context.Context, id int64) (bool, error) { - row := q.db.QueryRowContext(ctx, barNotExists, id) + row := q.db.QueryRowContext(ctx, barNotExistsSQL, id) var not_exists bool err := row.Scan(¬_exists) return not_exists, err diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go index abb293a72f..8b2c6f9c76 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const barNotExists = `-- name: BarNotExists :one +const barNotExistsSQL = `-- name: BarNotExists :one SELECT NOT EXISTS ( SELECT @@ -22,7 +22,7 @@ SELECT ` func (q *Queries) BarNotExists(ctx context.Context, id int32) (bool, error) { - row := q.db.QueryRowContext(ctx, barNotExists, id) + row := q.db.QueryRowContext(ctx, barNotExistsSQL, id) var not_exists bool err := row.Scan(¬_exists) return not_exists, err diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go index 54c86dfa91..3531362a44 100644 --- a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getLastValue = `-- name: GetLastValue :one +const getLastValueSQL = `-- name: GetLastValue :one SELECT last_value FROM my_sequence ` func (q *Queries) GetLastValue(ctx context.Context) (int64, error) { - row := q.db.QueryRow(ctx, getLastValue) + row := q.db.QueryRow(ctx, getLastValueSQL) var last_value int64 err := row.Scan(&last_value) return last_value, err diff --git a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go index bf9df75976..ea5fb906c8 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -41,12 +41,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { return items, nil } -const getIDAll = `-- name: GetIDAll :many +const getIDAllSQL = `-- name: GetIDAll :many SELECT id FROM (SELECT id FROM users) t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, getIDAll) + rows, err := q.db.QueryContext(ctx, getIDAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go index 5709c64374..fdaef6aab2 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -38,12 +38,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { return items, nil } -const getIDAll = `-- name: GetIDAll :many +const getIDAllSQL = `-- name: GetIDAll :many SELECT id FROM (SELECT id FROM users) t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, getIDAll) + rows, err := q.db.Query(ctx, getIDAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go index 5709c64374..fdaef6aab2 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } @@ -38,12 +38,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { return items, nil } -const getIDAll = `-- name: GetIDAll :many +const getIDAllSQL = `-- name: GetIDAll :many SELECT id FROM (SELECT id FROM users) t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, getIDAll) + rows, err := q.db.Query(ctx, getIDAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go index bf9df75976..ea5fb906c8 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -41,12 +41,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { return items, nil } -const getIDAll = `-- name: GetIDAll :many +const getIDAllSQL = `-- name: GetIDAll :many SELECT id FROM (SELECT id FROM users) t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, getIDAll) + rows, err := q.db.QueryContext(ctx, getIDAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go index e9e6c25fe5..dc41cfeeb6 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT id, first_name, last_name, age FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]User, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } @@ -41,12 +41,12 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { return items, nil } -const getIDAll = `-- name: GetIDAll :many +const getIDAllSQL = `-- name: GetIDAll :many SELECT id FROM (SELECT id FROM users) AS t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, getIDAll) + rows, err := q.db.QueryContext(ctx, getIDAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go index e59023c188..e19caf4f46 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT camelcase FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go index 9bf2782abd..764088904f 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT "CamelCase" FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go index ad7e060d07..46db2df17e 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT "CamelCase" FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, getAll) + rows, err := q.db.Query(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go index d78319b0cc..0410bfaafc 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const getAll = `-- name: GetAll :many +const getAllSQL = `-- name: GetAll :many SELECT "CamelCase" FROM users ` func (q *Queries) GetAll(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, getAll) + rows, err := q.db.QueryContext(ctx, getAllSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go index 9dda476557..d082d8510b 100644 --- a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const subquery = `-- name: Subquery :many +const subquerySQL = `-- name: Subquery :many SELECT a, name, @@ -30,7 +30,7 @@ type SubqueryRow struct { } func (q *Queries) Subquery(ctx context.Context, arg SubqueryParams) ([]SubqueryRow, error) { - rows, err := q.db.QueryContext(ctx, subquery, arg.Column1, arg.Column2) + rows, err := q.db.QueryContext(ctx, subquerySQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go index e35db531ab..57d8c298ee 100644 --- a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const findWallets = `-- name: FindWallets :many +const findWalletsSQL = `-- name: FindWallets :many select id, address, balance, total_balance from ( select id, address, balance, @@ -36,7 +36,7 @@ type FindWalletsRow struct { } func (q *Queries) FindWallets(ctx context.Context, arg FindWalletsParams) ([]FindWalletsRow, error) { - rows, err := q.db.Query(ctx, findWallets, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, findWalletsSQL, arg.Column1, arg.Column2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go index 34bfb57035..e01577f130 100644 --- a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subquery = `-- name: Subquery :many +const subquerySQL = `-- name: Subquery :many SELECT a, name FROM (SELECT a, name FROM foo) ` func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, subquery) + rows, err := q.db.QueryContext(ctx, subquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go index 34bfb57035..e01577f130 100644 --- a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subquery = `-- name: Subquery :many +const subquerySQL = `-- name: Subquery :many SELECT a, name FROM (SELECT a, name FROM foo) ` func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, subquery) + rows, err := q.db.QueryContext(ctx, subquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go index 34bfb57035..e01577f130 100644 --- a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subquery = `-- name: Subquery :many +const subquerySQL = `-- name: Subquery :many SELECT a, name FROM (SELECT a, name FROM foo) ` func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, subquery) + rows, err := q.db.QueryContext(ctx, subquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_system/pgx/go/query.sql.go b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go index f35c7f5d08..35ed8cecda 100644 --- a/internal/endtoend/testdata/select_system/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getSystemColumns = `-- name: GetSystemColumns :one +const getSystemColumnsSQL = `-- name: GetSystemColumns :one SELECT tableoid, xmin, cmin, xmax, cmax, ctid FROM test @@ -27,7 +27,7 @@ type GetSystemColumnsRow struct { } func (q *Queries) GetSystemColumns(ctx context.Context) (GetSystemColumnsRow, error) { - row := q.db.QueryRow(ctx, getSystemColumns) + row := q.db.QueryRow(ctx, getSystemColumnsSQL) var i GetSystemColumnsRow err := row.Scan( &i.Tableoid, diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go index 6cde5ae2f2..27e33d6bbf 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectTextArray = `-- name: SelectTextArray :many +const selectTextArraySQL = `-- name: SelectTextArray :many SELECT $1::TEXT[] ` func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { - rows, err := q.db.Query(ctx, selectTextArray, dollar_1) + rows, err := q.db.Query(ctx, selectTextArraySQL, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go index 6cde5ae2f2..27e33d6bbf 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const selectTextArray = `-- name: SelectTextArray :many +const selectTextArraySQL = `-- name: SelectTextArray :many SELECT $1::TEXT[] ` func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { - rows, err := q.db.Query(ctx, selectTextArray, dollar_1) + rows, err := q.db.Query(ctx, selectTextArraySQL, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go index 5ce044c912..26aa470609 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/lib/pq" ) -const selectTextArray = `-- name: SelectTextArray :many +const selectTextArraySQL = `-- name: SelectTextArray :many SELECT $1::TEXT[] ` func (q *Queries) SelectTextArray(ctx context.Context, dollar_1 []string) ([][]string, error) { - rows, err := q.db.QueryContext(ctx, selectTextArray, pq.Array(dollar_1)) + rows, err := q.db.QueryContext(ctx, selectTextArraySQL, pq.Array(dollar_1)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go index 5d5560ac49..7b36d3f8c6 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const selectExcept = `-- name: SelectExcept :many +const selectExceptSQL = `-- name: SelectExcept :many SELECT a, b FROM foo EXCEPT SELECT a, b FROM foo ` func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectExcept) + rows, err := q.db.QueryContext(ctx, selectExceptSQL) if err != nil { return nil, err } @@ -38,14 +38,14 @@ func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { return items, nil } -const selectIntersect = `-- name: SelectIntersect :many +const selectIntersectSQL = `-- name: SelectIntersect :many SELECT a, b FROM foo INTERSECT SELECT a, b FROM foo ` func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectIntersect) + rows, err := q.db.QueryContext(ctx, selectIntersectSQL) if err != nil { return nil, err } @@ -67,14 +67,14 @@ func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnion = `-- name: SelectUnion :many +const selectUnionSQL = `-- name: SelectUnion :many SELECT a, b FROM foo UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnion) + rows, err := q.db.QueryContext(ctx, selectUnionSQL) if err != nil { return nil, err } @@ -96,14 +96,14 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionAliased = `-- name: SelectUnionAliased :many +const selectUnionAliasedSQL = `-- name: SelectUnionAliased :many (SELECT a, b FROM foo) UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionAliased) + rows, err := q.db.QueryContext(ctx, selectUnionAliasedSQL) if err != nil { return nil, err } @@ -125,14 +125,14 @@ func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionOther = `-- name: SelectUnionOther :many +const selectUnionOtherSQL = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionOther) + rows, err := q.db.QueryContext(ctx, selectUnionOtherSQL) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +const selectUnionWithLimitSQL = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo @@ -167,7 +167,7 @@ type SelectUnionWithLimitParams struct { } func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, selectUnionWithLimitSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go index d7e818b09a..fd586b3a77 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const selectExcept = `-- name: SelectExcept :many +const selectExceptSQL = `-- name: SelectExcept :many SELECT a, b FROM foo EXCEPT SELECT a, b FROM foo ` func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectExcept) + rows, err := q.db.Query(ctx, selectExceptSQL) if err != nil { return nil, err } @@ -35,14 +35,14 @@ func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { return items, nil } -const selectIntersect = `-- name: SelectIntersect :many +const selectIntersectSQL = `-- name: SelectIntersect :many SELECT a, b FROM foo INTERSECT SELECT a, b FROM foo ` func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectIntersect) + rows, err := q.db.Query(ctx, selectIntersectSQL) if err != nil { return nil, err } @@ -61,14 +61,14 @@ func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnion = `-- name: SelectUnion :many +const selectUnionSQL = `-- name: SelectUnion :many SELECT a, b FROM foo UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnion) + rows, err := q.db.Query(ctx, selectUnionSQL) if err != nil { return nil, err } @@ -87,14 +87,14 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionAliased = `-- name: SelectUnionAliased :many +const selectUnionAliasedSQL = `-- name: SelectUnionAliased :many (SELECT a, b FROM foo) UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionAliased) + rows, err := q.db.Query(ctx, selectUnionAliasedSQL) if err != nil { return nil, err } @@ -113,14 +113,14 @@ func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionOther = `-- name: SelectUnionOther :many +const selectUnionOtherSQL = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionOther) + rows, err := q.db.Query(ctx, selectUnionOtherSQL) if err != nil { return nil, err } @@ -139,7 +139,7 @@ func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +const selectUnionWithLimitSQL = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo @@ -152,7 +152,7 @@ type SelectUnionWithLimitParams struct { } func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + rows, err := q.db.Query(ctx, selectUnionWithLimitSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go index d7e818b09a..fd586b3a77 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const selectExcept = `-- name: SelectExcept :many +const selectExceptSQL = `-- name: SelectExcept :many SELECT a, b FROM foo EXCEPT SELECT a, b FROM foo ` func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectExcept) + rows, err := q.db.Query(ctx, selectExceptSQL) if err != nil { return nil, err } @@ -35,14 +35,14 @@ func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { return items, nil } -const selectIntersect = `-- name: SelectIntersect :many +const selectIntersectSQL = `-- name: SelectIntersect :many SELECT a, b FROM foo INTERSECT SELECT a, b FROM foo ` func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectIntersect) + rows, err := q.db.Query(ctx, selectIntersectSQL) if err != nil { return nil, err } @@ -61,14 +61,14 @@ func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnion = `-- name: SelectUnion :many +const selectUnionSQL = `-- name: SelectUnion :many SELECT a, b FROM foo UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnion) + rows, err := q.db.Query(ctx, selectUnionSQL) if err != nil { return nil, err } @@ -87,14 +87,14 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionAliased = `-- name: SelectUnionAliased :many +const selectUnionAliasedSQL = `-- name: SelectUnionAliased :many (SELECT a, b FROM foo) UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionAliased) + rows, err := q.db.Query(ctx, selectUnionAliasedSQL) if err != nil { return nil, err } @@ -113,14 +113,14 @@ func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionOther = `-- name: SelectUnionOther :many +const selectUnionOtherSQL = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionOther) + rows, err := q.db.Query(ctx, selectUnionOtherSQL) if err != nil { return nil, err } @@ -139,7 +139,7 @@ func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +const selectUnionWithLimitSQL = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo @@ -152,7 +152,7 @@ type SelectUnionWithLimitParams struct { } func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { - rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + rows, err := q.db.Query(ctx, selectUnionWithLimitSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go index 0d0ff61d58..7e4b05d8aa 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const selectExcept = `-- name: SelectExcept :many +const selectExceptSQL = `-- name: SelectExcept :many SELECT a, b FROM foo EXCEPT SELECT a, b FROM foo ` func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectExcept) + rows, err := q.db.QueryContext(ctx, selectExceptSQL) if err != nil { return nil, err } @@ -38,14 +38,14 @@ func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { return items, nil } -const selectIntersect = `-- name: SelectIntersect :many +const selectIntersectSQL = `-- name: SelectIntersect :many SELECT a, b FROM foo INTERSECT SELECT a, b FROM foo ` func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectIntersect) + rows, err := q.db.QueryContext(ctx, selectIntersectSQL) if err != nil { return nil, err } @@ -67,14 +67,14 @@ func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnion = `-- name: SelectUnion :many +const selectUnionSQL = `-- name: SelectUnion :many SELECT a, b FROM foo UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnion) + rows, err := q.db.QueryContext(ctx, selectUnionSQL) if err != nil { return nil, err } @@ -96,14 +96,14 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionAliased = `-- name: SelectUnionAliased :many +const selectUnionAliasedSQL = `-- name: SelectUnionAliased :many (SELECT a, b FROM foo) UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionAliased) + rows, err := q.db.QueryContext(ctx, selectUnionAliasedSQL) if err != nil { return nil, err } @@ -125,14 +125,14 @@ func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionOther = `-- name: SelectUnionOther :many +const selectUnionOtherSQL = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionOther) + rows, err := q.db.QueryContext(ctx, selectUnionOtherSQL) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +const selectUnionWithLimitSQL = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo @@ -167,7 +167,7 @@ type SelectUnionWithLimitParams struct { } func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, selectUnionWithLimitSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go index 42d9cde73d..f2361e83e1 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go @@ -9,14 +9,14 @@ import ( "context" ) -const selectExcept = `-- name: SelectExcept :many +const selectExceptSQL = `-- name: SelectExcept :many SELECT a, b FROM foo EXCEPT SELECT a, b FROM foo ` func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectExcept) + rows, err := q.db.QueryContext(ctx, selectExceptSQL) if err != nil { return nil, err } @@ -38,14 +38,14 @@ func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { return items, nil } -const selectIntersect = `-- name: SelectIntersect :many +const selectIntersectSQL = `-- name: SelectIntersect :many SELECT a, b FROM foo INTERSECT SELECT a, b FROM foo ` func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectIntersect) + rows, err := q.db.QueryContext(ctx, selectIntersectSQL) if err != nil { return nil, err } @@ -67,14 +67,14 @@ func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnion = `-- name: SelectUnion :many +const selectUnionSQL = `-- name: SelectUnion :many SELECT a, b FROM foo UNION SELECT a, b FROM foo ` func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnion) + rows, err := q.db.QueryContext(ctx, selectUnionSQL) if err != nil { return nil, err } @@ -96,14 +96,14 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionOther = `-- name: SelectUnionOther :many +const selectUnionOtherSQL = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION SELECT a, b FROM bar ` func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionOther) + rows, err := q.db.QueryContext(ctx, selectUnionOtherSQL) if err != nil { return nil, err } @@ -125,7 +125,7 @@ func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { return items, nil } -const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +const selectUnionWithLimitSQL = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo @@ -139,7 +139,7 @@ type SelectUnionWithLimitParams struct { } func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + rows, err := q.db.QueryContext(ctx, selectUnionWithLimitSQL, arg.Limit, arg.Offset) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go index 8fa694749d..5b7cab5237 100644 --- a/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const testSubqueryUnion = `-- name: TestSubqueryUnion :many +const testSubqueryUnionSQL = `-- name: TestSubqueryUnion :many SELECT tmp.id, tmp.name, tmp.bio FROM ( SELECT id, name, bio FROM authors UNION @@ -18,7 +18,7 @@ SELECT tmp.id, tmp.name, tmp.bio FROM ( ` func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, testSubqueryUnion) + rows, err := q.db.QueryContext(ctx, testSubqueryUnionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go index 56780c4d05..fa49f305a0 100644 --- a/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const testSubqueryUnion = `-- name: TestSubqueryUnion :many +const testSubqueryUnionSQL = `-- name: TestSubqueryUnion :many SELECT tmp.id, tmp.name, tmp.bio FROM ( SELECT id, name, bio FROM authors UNION @@ -18,7 +18,7 @@ SELECT tmp.id, tmp.name, tmp.bio FROM ( ` func (q *Queries) TestSubqueryUnion(ctx context.Context) ([]Author, error) { - rows, err := q.db.Query(ctx, testSubqueryUnion) + rows, err := q.db.Query(ctx, testSubqueryUnionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go index c48efce46c..8141a4be33 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const selectStatic = `-- name: SelectStatic :one +const selectStaticSQL = `-- name: SelectStatic :one SELECT 'a', 'b' AS b, 1 AS num, true AS truefield, 1.0 AS floater ` @@ -22,7 +22,7 @@ type SelectStaticRow struct { } func (q *Queries) SelectStatic(ctx context.Context) (SelectStaticRow, error) { - row := q.db.QueryRowContext(ctx, selectStatic) + row := q.db.QueryRowContext(ctx, selectStaticSQL) var i SelectStaticRow err := row.Scan( &i.Column1, diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go index d8c5962115..5943b2614d 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const showWarnings = `-- name: ShowWarnings :many +const showWarningsSQL = `-- name: ShowWarnings :many SHOW WARNINGS ` @@ -20,7 +20,7 @@ type ShowWarningsRow struct { } func (q *Queries) ShowWarnings(ctx context.Context) ([]ShowWarningsRow, error) { - rows, err := q.db.QueryContext(ctx, showWarnings) + rows, err := q.db.QueryContext(ctx, showWarningsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go index 71681b3ba8..937b145d50 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthorByID = `-- name: GetAuthorByID :one +const getAuthorByIDSQL = `-- name: GetAuthorByID :one SELECT id, name, bio FROM authors WHERE id = ? @@ -17,13 +17,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthorByID, id) + row := q.db.QueryRowContext(ctx, getAuthorByIDSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthorIDByID = `-- name: GetAuthorIDByID :one +const getAuthorIDByIDSQL = `-- name: GetAuthorIDByID :one SELECT id FROM authors WHERE id = ? @@ -31,13 +31,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) + row := q.db.QueryRowContext(ctx, getAuthorIDByIDSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT sub FROM users WHERE sub = ? @@ -45,7 +45,7 @@ LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub string) (string, error) { - row := q.db.QueryRowContext(ctx, getUser, sub) + row := q.db.QueryRowContext(ctx, getUserSQL, sub) var sub_2 string err := row.Scan(&sub_2) return sub_2, err diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go index 8f5f9f0322..7741318cce 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/google/uuid" ) -const getAuthorByID = `-- name: GetAuthorByID :one +const getAuthorByIDSQL = `-- name: GetAuthorByID :one SELECT id, name, bio FROM authors WHERE id = $1 @@ -19,13 +19,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthorByID, id) + row := q.db.QueryRow(ctx, getAuthorByIDSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthorIDByID = `-- name: GetAuthorIDByID :one +const getAuthorIDByIDSQL = `-- name: GetAuthorIDByID :one SELECT id FROM authors WHERE id = $1 @@ -33,13 +33,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRow(ctx, getAuthorIDByID, id) + row := q.db.QueryRow(ctx, getAuthorIDByIDSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT sub FROM users WHERE sub = $1 @@ -47,13 +47,13 @@ LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, getUser, sub) + row := q.db.QueryRow(ctx, getUserSQL, sub) var sub_2 uuid.UUID err := row.Scan(&sub_2) return sub_2, err } -const setDefaultName = `-- name: SetDefaultName :one +const setDefaultNameSQL = `-- name: SetDefaultName :one UPDATE authors SET name = 'Default Name' @@ -63,7 +63,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRow(ctx, setDefaultName, id) + row := q.db.QueryRow(ctx, setDefaultNameSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go index e6b88eec75..f8bf76e44f 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getAuthorByID = `-- name: GetAuthorByID :one +const getAuthorByIDSQL = `-- name: GetAuthorByID :one SELECT id, name, bio FROM authors WHERE id = $1 @@ -19,13 +19,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthorByID, id) + row := q.db.QueryRow(ctx, getAuthorByIDSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthorIDByID = `-- name: GetAuthorIDByID :one +const getAuthorIDByIDSQL = `-- name: GetAuthorIDByID :one SELECT id FROM authors WHERE id = $1 @@ -33,13 +33,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRow(ctx, getAuthorIDByID, id) + row := q.db.QueryRow(ctx, getAuthorIDByIDSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT sub FROM users WHERE sub = $1 @@ -47,13 +47,13 @@ LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub pgtype.UUID) (pgtype.UUID, error) { - row := q.db.QueryRow(ctx, getUser, sub) + row := q.db.QueryRow(ctx, getUserSQL, sub) var sub_2 pgtype.UUID err := row.Scan(&sub_2) return sub_2, err } -const setDefaultName = `-- name: SetDefaultName :one +const setDefaultNameSQL = `-- name: SetDefaultName :one UPDATE authors SET name = 'Default Name' @@ -63,7 +63,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRow(ctx, setDefaultName, id) + row := q.db.QueryRow(ctx, setDefaultNameSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go index 4df9667636..4b3b810555 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/google/uuid" ) -const getAuthorByID = `-- name: GetAuthorByID :one +const getAuthorByIDSQL = `-- name: GetAuthorByID :one SELECT id, name, bio FROM authors WHERE id = $1 @@ -19,13 +19,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthorByID, id) + row := q.db.QueryRowContext(ctx, getAuthorByIDSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthorIDByID = `-- name: GetAuthorIDByID :one +const getAuthorIDByIDSQL = `-- name: GetAuthorIDByID :one SELECT id FROM authors WHERE id = $1 @@ -33,13 +33,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) + row := q.db.QueryRowContext(ctx, getAuthorIDByIDSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT sub FROM users WHERE sub = $1 @@ -47,13 +47,13 @@ LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) { - row := q.db.QueryRowContext(ctx, getUser, sub) + row := q.db.QueryRowContext(ctx, getUserSQL, sub) var sub_2 uuid.UUID err := row.Scan(&sub_2) return sub_2, err } -const setDefaultName = `-- name: SetDefaultName :one +const setDefaultNameSQL = `-- name: SetDefaultName :one UPDATE authors SET name = 'Default Name' @@ -63,7 +63,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, setDefaultName, id) + row := q.db.QueryRowContext(ctx, setDefaultNameSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go index 0499ffb86d..e1bdf5d97a 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthorByID = `-- name: GetAuthorByID :one +const getAuthorByIDSQL = `-- name: GetAuthorByID :one SELECT id, name, bio FROM authors WHERE id = ? @@ -17,13 +17,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthorByID, id) + row := q.db.QueryRowContext(ctx, getAuthorByIDSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const getAuthorIDByID = `-- name: GetAuthorIDByID :one +const getAuthorIDByIDSQL = `-- name: GetAuthorIDByID :one SELECT id FROM authors WHERE id = ? @@ -31,13 +31,13 @@ LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) + row := q.db.QueryRowContext(ctx, getAuthorIDByIDSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT sub FROM users WHERE sub = ? @@ -45,7 +45,7 @@ LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub string) (string, error) { - row := q.db.QueryRowContext(ctx, getUser, sub) + row := q.db.QueryRowContext(ctx, getUserSQL, sub) var sub_2 string err := row.Scan(&sub_2) return sub_2, err diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go index 9e8369a034..412ae8cdb1 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go @@ -9,67 +9,67 @@ import ( "context" ) -const mixedNotation = `-- name: MixedNotation :one +const mixedNotationSQL = `-- name: MixedNotation :one SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) ` func (q *Queries) MixedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, mixedNotation) + row := q.db.QueryRow(ctx, mixedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedAnyOrder = `-- name: NamedAnyOrder :one +const namedAnyOrderSQL = `-- name: NamedAnyOrder :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) ` func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedAnyOrder) + row := q.db.QueryRow(ctx, namedAnyOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedNotation = `-- name: NamedNotation :one +const namedNotationSQL = `-- name: NamedNotation :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World') ` func (q *Queries) NamedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedNotation) + row := q.db.QueryRow(ctx, namedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedOtherOrder = `-- name: NamedOtherOrder :one +const namedOtherOrderSQL = `-- name: NamedOtherOrder :one SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') ` func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedOtherOrder) + row := q.db.QueryRow(ctx, namedOtherOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNoDefaault = `-- name: PositionalNoDefaault :one +const positionalNoDefaaultSQL = `-- name: PositionalNoDefaault :one SELECT concat_lower_or_upper('Hello', 'World') ` func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, positionalNoDefaault) + row := q.db.QueryRow(ctx, positionalNoDefaaultSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNotation = `-- name: PositionalNotation :one +const positionalNotationSQL = `-- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true) ` func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, positionalNotation) + row := q.db.QueryRow(ctx, positionalNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go index 9e8369a034..412ae8cdb1 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go @@ -9,67 +9,67 @@ import ( "context" ) -const mixedNotation = `-- name: MixedNotation :one +const mixedNotationSQL = `-- name: MixedNotation :one SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) ` func (q *Queries) MixedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, mixedNotation) + row := q.db.QueryRow(ctx, mixedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedAnyOrder = `-- name: NamedAnyOrder :one +const namedAnyOrderSQL = `-- name: NamedAnyOrder :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) ` func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedAnyOrder) + row := q.db.QueryRow(ctx, namedAnyOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedNotation = `-- name: NamedNotation :one +const namedNotationSQL = `-- name: NamedNotation :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World') ` func (q *Queries) NamedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedNotation) + row := q.db.QueryRow(ctx, namedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedOtherOrder = `-- name: NamedOtherOrder :one +const namedOtherOrderSQL = `-- name: NamedOtherOrder :one SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') ` func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, namedOtherOrder) + row := q.db.QueryRow(ctx, namedOtherOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNoDefaault = `-- name: PositionalNoDefaault :one +const positionalNoDefaaultSQL = `-- name: PositionalNoDefaault :one SELECT concat_lower_or_upper('Hello', 'World') ` func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, positionalNoDefaault) + row := q.db.QueryRow(ctx, positionalNoDefaaultSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNotation = `-- name: PositionalNotation :one +const positionalNotationSQL = `-- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true) ` func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { - row := q.db.QueryRow(ctx, positionalNotation) + row := q.db.QueryRow(ctx, positionalNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go index b5af495f9e..aa8c9d3edb 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go @@ -9,67 +9,67 @@ import ( "context" ) -const mixedNotation = `-- name: MixedNotation :one +const mixedNotationSQL = `-- name: MixedNotation :one SELECT concat_lower_or_upper('Hello', 'World', uppercase => true) ` func (q *Queries) MixedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, mixedNotation) + row := q.db.QueryRowContext(ctx, mixedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedAnyOrder = `-- name: NamedAnyOrder :one +const namedAnyOrderSQL = `-- name: NamedAnyOrder :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase => true) ` func (q *Queries) NamedAnyOrder(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedAnyOrder) + row := q.db.QueryRowContext(ctx, namedAnyOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedNotation = `-- name: NamedNotation :one +const namedNotationSQL = `-- name: NamedNotation :one SELECT concat_lower_or_upper(a => 'Hello', b => 'World') ` func (q *Queries) NamedNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedNotation) + row := q.db.QueryRowContext(ctx, namedNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const namedOtherOrder = `-- name: NamedOtherOrder :one +const namedOtherOrderSQL = `-- name: NamedOtherOrder :one SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b => 'World') ` func (q *Queries) NamedOtherOrder(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, namedOtherOrder) + row := q.db.QueryRowContext(ctx, namedOtherOrderSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNoDefaault = `-- name: PositionalNoDefaault :one +const positionalNoDefaaultSQL = `-- name: PositionalNoDefaault :one SELECT concat_lower_or_upper('Hello', 'World') ` func (q *Queries) PositionalNoDefaault(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, positionalNoDefaault) + row := q.db.QueryRowContext(ctx, positionalNoDefaaultSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err } -const positionalNotation = `-- name: PositionalNotation :one +const positionalNotationSQL = `-- name: PositionalNotation :one SELECT concat_lower_or_upper('Hello', 'World', true) ` func (q *Queries) PositionalNotation(ctx context.Context) (string, error) { - row := q.db.QueryRowContext(ctx, positionalNotation) + row := q.db.QueryRowContext(ctx, positionalNotationSQL) var concat_lower_or_upper string err := row.Scan(&concat_lower_or_upper) return concat_lower_or_upper, err diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go index cacea70a2e..18f82f7e46 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const complicated = `-- name: Complicated :many +const complicatedSQL = `-- name: Complicated :many WITH names AS (SELECT name from foo WHERE foo.name = ?) SELECT name FROM names WHERE name IN (SELECT name FROM foo WHERE foo.name = ?) ` @@ -19,7 +19,7 @@ type ComplicatedParams struct { } func (q *Queries) Complicated(ctx context.Context, arg ComplicatedParams) ([]string, error) { - rows, err := q.db.QueryContext(ctx, complicated, arg.Slug, arg.Slug) + rows, err := q.db.QueryContext(ctx, complicatedSQL, arg.Slug, arg.Slug) if err != nil { return nil, err } @@ -41,12 +41,12 @@ func (q *Queries) Complicated(ctx context.Context, arg ComplicatedParams) ([]str return items, nil } -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ? ` func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) + rows, err := q.db.QueryContext(ctx, funcParamIdentSQL, slug) if err != nil { return nil, err } @@ -68,12 +68,12 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = ? ` func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamString, slug) + rows, err := q.db.QueryContext(ctx, funcParamStringSQL, slug) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go index eed0d84a77..e333489e12 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamIdent, slug) + rows, err := q.db.Query(ctx, funcParamIdentSQL, slug) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamString, slug) + rows, err := q.db.Query(ctx, funcParamStringSQL, slug) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go index eed0d84a77..e333489e12 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamIdent, slug) + rows, err := q.db.Query(ctx, funcParamIdentSQL, slug) if err != nil { return nil, err } @@ -33,12 +33,12 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamString, slug) + rows, err := q.db.Query(ctx, funcParamStringSQL, slug) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go index aede74f4f9..c76e69d0b1 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) + rows, err := q.db.QueryContext(ctx, funcParamIdentSQL, slug) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 ` func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamString, slug) + rows, err := q.db.QueryContext(ctx, funcParamStringSQL, slug) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go index c24bd6c30f..463af807b1 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ?1 ` func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamIdent, slug) + rows, err := q.db.QueryContext(ctx, funcParamIdentSQL, slug) if err != nil { return nil, err } @@ -36,12 +36,12 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = ?1 ` func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, funcParamString, slug) + rows, err := q.db.QueryContext(ctx, funcParamStringSQL, slug) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go index f2f4deccc2..07be26694a 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const duplicate = `-- name: Duplicate :one +const duplicateSQL = `-- name: Duplicate :one SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users ` @@ -20,7 +20,7 @@ type DuplicateRow struct { } func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { - row := q.db.QueryRowContext(ctx, duplicate) + row := q.db.QueryRowContext(ctx, duplicateSQL) var i DuplicateRow err := row.Scan( &i.User.ID, @@ -33,7 +33,7 @@ func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { return i, err } -const join = `-- name: Join :one +const joinSQL = `-- name: Join :one SELECT users.id, users.name, users.age, posts.id, posts.user_id FROM posts INNER JOIN users ON posts.user_id = users.id ` @@ -44,7 +44,7 @@ type JoinRow struct { } func (q *Queries) Join(ctx context.Context) (JoinRow, error) { - row := q.db.QueryRowContext(ctx, join) + row := q.db.QueryRowContext(ctx, joinSQL) var i JoinRow err := row.Scan( &i.User.ID, @@ -56,7 +56,7 @@ func (q *Queries) Join(ctx context.Context) (JoinRow, error) { return i, err } -const only = `-- name: Only :one +const onlySQL = `-- name: Only :one SELECT users.id, users.name, users.age FROM users ` @@ -65,13 +65,13 @@ type OnlyRow struct { } func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { - row := q.db.QueryRowContext(ctx, only) + row := q.db.QueryRowContext(ctx, onlySQL) var i OnlyRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAlias = `-- name: WithAlias :one +const withAliasSQL = `-- name: WithAlias :one SELECT u.id, u.name, u.age FROM users u ` @@ -80,13 +80,13 @@ type WithAliasRow struct { } func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { - row := q.db.QueryRowContext(ctx, withAlias) + row := q.db.QueryRowContext(ctx, withAliasSQL) var i WithAliasRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAsterisk = `-- name: WithAsterisk :one +const withAsteriskSQL = `-- name: WithAsterisk :one SELECT users.id, users.name, users.age, id, name, age FROM users ` @@ -98,7 +98,7 @@ type WithAsteriskRow struct { } func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { - row := q.db.QueryRowContext(ctx, withAsterisk) + row := q.db.QueryRowContext(ctx, withAsteriskSQL) var i WithAsteriskRow err := row.Scan( &i.User.ID, @@ -111,7 +111,7 @@ func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { return i, err } -const withCrossSchema = `-- name: WithCrossSchema :many +const withCrossSchemaSQL = `-- name: WithCrossSchema :many SELECT users.id, users.name, users.age, bu.id, bu.name FROM users INNER JOIN baz.users bu ON users.id = bu.id ` @@ -122,7 +122,7 @@ type WithCrossSchemaRow struct { } func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { - rows, err := q.db.QueryContext(ctx, withCrossSchema) + rows, err := q.db.QueryContext(ctx, withCrossSchemaSQL) if err != nil { return nil, err } @@ -150,7 +150,7 @@ func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, er return items, nil } -const withSchema = `-- name: WithSchema :one +const withSchemaSQL = `-- name: WithSchema :one SELECT bu.id, bu.name FROM baz.users bu ` @@ -159,13 +159,13 @@ type WithSchemaRow struct { } func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { - row := q.db.QueryRowContext(ctx, withSchema) + row := q.db.QueryRowContext(ctx, withSchemaSQL) var i WithSchemaRow err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) return i, err } -const withSubquery = `-- name: WithSubquery :many +const withSubquerySQL = `-- name: WithSubquery :many SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users ` @@ -175,7 +175,7 @@ type WithSubqueryRow struct { } func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { - rows, err := q.db.QueryContext(ctx, withSubquery) + rows, err := q.db.QueryContext(ctx, withSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go index e627e8d37d..481648ad69 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const duplicate = `-- name: Duplicate :one +const duplicateSQL = `-- name: Duplicate :one SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users ` @@ -20,7 +20,7 @@ type DuplicateRow struct { } func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { - row := q.db.QueryRow(ctx, duplicate) + row := q.db.QueryRow(ctx, duplicateSQL) var i DuplicateRow err := row.Scan( &i.User.ID, @@ -33,7 +33,7 @@ func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { return i, err } -const join = `-- name: Join :one +const joinSQL = `-- name: Join :one SELECT users.id, users.name, users.age, posts.id, posts.user_id FROM posts INNER JOIN users ON posts.user_id = users.id ` @@ -44,7 +44,7 @@ type JoinRow struct { } func (q *Queries) Join(ctx context.Context) (JoinRow, error) { - row := q.db.QueryRow(ctx, join) + row := q.db.QueryRow(ctx, joinSQL) var i JoinRow err := row.Scan( &i.User.ID, @@ -56,7 +56,7 @@ func (q *Queries) Join(ctx context.Context) (JoinRow, error) { return i, err } -const only = `-- name: Only :one +const onlySQL = `-- name: Only :one SELECT users.id, users.name, users.age FROM users ` @@ -65,13 +65,13 @@ type OnlyRow struct { } func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { - row := q.db.QueryRow(ctx, only) + row := q.db.QueryRow(ctx, onlySQL) var i OnlyRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAlias = `-- name: WithAlias :one +const withAliasSQL = `-- name: WithAlias :one SELECT u.id, u.name, u.age FROM users u ` @@ -80,13 +80,13 @@ type WithAliasRow struct { } func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { - row := q.db.QueryRow(ctx, withAlias) + row := q.db.QueryRow(ctx, withAliasSQL) var i WithAliasRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAsterisk = `-- name: WithAsterisk :one +const withAsteriskSQL = `-- name: WithAsterisk :one SELECT users.id, users.name, users.age, id, name, age FROM users ` @@ -98,7 +98,7 @@ type WithAsteriskRow struct { } func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { - row := q.db.QueryRow(ctx, withAsterisk) + row := q.db.QueryRow(ctx, withAsteriskSQL) var i WithAsteriskRow err := row.Scan( &i.User.ID, @@ -111,7 +111,7 @@ func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { return i, err } -const withCrossSchema = `-- name: WithCrossSchema :many +const withCrossSchemaSQL = `-- name: WithCrossSchema :many SELECT users.id, users.name, users.age, bu.id, bu.name FROM users INNER JOIN baz.users bu ON users.id = bu.id ` @@ -122,7 +122,7 @@ type WithCrossSchemaRow struct { } func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { - rows, err := q.db.Query(ctx, withCrossSchema) + rows, err := q.db.Query(ctx, withCrossSchemaSQL) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, er return items, nil } -const withSchema = `-- name: WithSchema :one +const withSchemaSQL = `-- name: WithSchema :one SELECT bu.id, bu.name FROM baz.users bu ` @@ -156,13 +156,13 @@ type WithSchemaRow struct { } func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { - row := q.db.QueryRow(ctx, withSchema) + row := q.db.QueryRow(ctx, withSchemaSQL) var i WithSchemaRow err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) return i, err } -const withSubquery = `-- name: WithSubquery :many +const withSubquerySQL = `-- name: WithSubquery :many SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users ` @@ -172,7 +172,7 @@ type WithSubqueryRow struct { } func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { - rows, err := q.db.Query(ctx, withSubquery) + rows, err := q.db.Query(ctx, withSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go index 09eebcea36..a23da78714 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go @@ -12,7 +12,7 @@ import ( "github.com/lib/pq" ) -const duplicate = `-- name: Duplicate :one +const duplicateSQL = `-- name: Duplicate :one SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users ` @@ -22,7 +22,7 @@ type DuplicateRow struct { } func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { - row := q.db.QueryRowContext(ctx, duplicate) + row := q.db.QueryRowContext(ctx, duplicateSQL) var i DuplicateRow err := row.Scan( &i.User.ID, @@ -35,7 +35,7 @@ func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { return i, err } -const join = `-- name: Join :one +const joinSQL = `-- name: Join :one SELECT users.id, users.name, users.age, posts.id, posts.user_id, posts.likes FROM posts INNER JOIN users ON posts.user_id = users.id ` @@ -46,7 +46,7 @@ type JoinRow struct { } func (q *Queries) Join(ctx context.Context) (JoinRow, error) { - row := q.db.QueryRowContext(ctx, join) + row := q.db.QueryRowContext(ctx, joinSQL) var i JoinRow err := row.Scan( &i.User.ID, @@ -59,7 +59,7 @@ func (q *Queries) Join(ctx context.Context) (JoinRow, error) { return i, err } -const only = `-- name: Only :one +const onlySQL = `-- name: Only :one SELECT users.id, users.name, users.age FROM users ` @@ -68,13 +68,13 @@ type OnlyRow struct { } func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { - row := q.db.QueryRowContext(ctx, only) + row := q.db.QueryRowContext(ctx, onlySQL) var i OnlyRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAlias = `-- name: WithAlias :one +const withAliasSQL = `-- name: WithAlias :one SELECT u.id, u.name, u.age FROM users u ` @@ -83,13 +83,13 @@ type WithAliasRow struct { } func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { - row := q.db.QueryRowContext(ctx, withAlias) + row := q.db.QueryRowContext(ctx, withAliasSQL) var i WithAliasRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAsterisk = `-- name: WithAsterisk :one +const withAsteriskSQL = `-- name: WithAsterisk :one SELECT users.id, users.name, users.age, id, name, age FROM users ` @@ -101,7 +101,7 @@ type WithAsteriskRow struct { } func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { - row := q.db.QueryRowContext(ctx, withAsterisk) + row := q.db.QueryRowContext(ctx, withAsteriskSQL) var i WithAsteriskRow err := row.Scan( &i.User.ID, @@ -114,7 +114,7 @@ func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { return i, err } -const withCrossSchema = `-- name: WithCrossSchema :many +const withCrossSchemaSQL = `-- name: WithCrossSchema :many SELECT users.id, users.name, users.age, bu.id, bu.name FROM users INNER JOIN baz.users bu ON users.id = bu.id ` @@ -125,7 +125,7 @@ type WithCrossSchemaRow struct { } func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { - rows, err := q.db.QueryContext(ctx, withCrossSchema) + rows, err := q.db.QueryContext(ctx, withCrossSchemaSQL) if err != nil { return nil, err } @@ -153,7 +153,7 @@ func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, er return items, nil } -const withSchema = `-- name: WithSchema :one +const withSchemaSQL = `-- name: WithSchema :one SELECT bu.id, bu.name FROM baz.users bu ` @@ -162,13 +162,13 @@ type WithSchemaRow struct { } func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { - row := q.db.QueryRowContext(ctx, withSchema) + row := q.db.QueryRowContext(ctx, withSchemaSQL) var i WithSchemaRow err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) return i, err } -const withSubquery = `-- name: WithSubquery :many +const withSubquerySQL = `-- name: WithSubquery :many SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users ` @@ -178,7 +178,7 @@ type WithSubqueryRow struct { } func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { - rows, err := q.db.QueryContext(ctx, withSubquery) + rows, err := q.db.QueryContext(ctx, withSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go index ff1dd53f4b..12fabb54a5 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const duplicate = `-- name: Duplicate :one +const duplicateSQL = `-- name: Duplicate :one SELECT users.id, users.name, users.age, users.id, users.name, users.age FROM users ` @@ -20,7 +20,7 @@ type DuplicateRow struct { } func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { - row := q.db.QueryRowContext(ctx, duplicate) + row := q.db.QueryRowContext(ctx, duplicateSQL) var i DuplicateRow err := row.Scan( &i.User.ID, @@ -33,7 +33,7 @@ func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { return i, err } -const join = `-- name: Join :one +const joinSQL = `-- name: Join :one SELECT u.id, u.name, u.age, p.id, p.user_id FROM posts AS p INNER JOIN users AS u ON p.user_id = u.id ` @@ -44,7 +44,7 @@ type JoinRow struct { } func (q *Queries) Join(ctx context.Context) (JoinRow, error) { - row := q.db.QueryRowContext(ctx, join) + row := q.db.QueryRowContext(ctx, joinSQL) var i JoinRow err := row.Scan( &i.User.ID, @@ -56,7 +56,7 @@ func (q *Queries) Join(ctx context.Context) (JoinRow, error) { return i, err } -const only = `-- name: Only :one +const onlySQL = `-- name: Only :one SELECT users.id, users.name, users.age FROM users ` @@ -65,13 +65,13 @@ type OnlyRow struct { } func (q *Queries) Only(ctx context.Context) (OnlyRow, error) { - row := q.db.QueryRowContext(ctx, only) + row := q.db.QueryRowContext(ctx, onlySQL) var i OnlyRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAlias = `-- name: WithAlias :one +const withAliasSQL = `-- name: WithAlias :one SELECT u.id, u.name, u.age FROM users AS u ` @@ -80,13 +80,13 @@ type WithAliasRow struct { } func (q *Queries) WithAlias(ctx context.Context) (WithAliasRow, error) { - row := q.db.QueryRowContext(ctx, withAlias) + row := q.db.QueryRowContext(ctx, withAliasSQL) var i WithAliasRow err := row.Scan(&i.User.ID, &i.User.Name, &i.User.Age) return i, err } -const withAsterisk = `-- name: WithAsterisk :one +const withAsteriskSQL = `-- name: WithAsterisk :one SELECT users.id, users.name, users.age, id, name, age FROM users ` @@ -98,7 +98,7 @@ type WithAsteriskRow struct { } func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { - row := q.db.QueryRowContext(ctx, withAsterisk) + row := q.db.QueryRowContext(ctx, withAsteriskSQL) var i WithAsteriskRow err := row.Scan( &i.User.ID, @@ -111,7 +111,7 @@ func (q *Queries) WithAsterisk(ctx context.Context) (WithAsteriskRow, error) { return i, err } -const withCrossSchema = `-- name: WithCrossSchema :many +const withCrossSchemaSQL = `-- name: WithCrossSchema :many SELECT u.id, u.name, u.age, bu.id, bu.name FROM users AS u INNER JOIN baz.users bu ON u.id = bu.id ` @@ -122,7 +122,7 @@ type WithCrossSchemaRow struct { } func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, error) { - rows, err := q.db.QueryContext(ctx, withCrossSchema) + rows, err := q.db.QueryContext(ctx, withCrossSchemaSQL) if err != nil { return nil, err } @@ -150,7 +150,7 @@ func (q *Queries) WithCrossSchema(ctx context.Context) ([]WithCrossSchemaRow, er return items, nil } -const withSchema = `-- name: WithSchema :one +const withSchemaSQL = `-- name: WithSchema :one SELECT bu.id, bu.name FROM baz.users AS bu ` @@ -159,13 +159,13 @@ type WithSchemaRow struct { } func (q *Queries) WithSchema(ctx context.Context) (WithSchemaRow, error) { - row := q.db.QueryRowContext(ctx, withSchema) + row := q.db.QueryRowContext(ctx, withSchemaSQL) var i WithSchemaRow err := row.Scan(&i.BazUser.ID, &i.BazUser.Name) return i, err } -const withSubquery = `-- name: WithSubquery :many +const withSubquerySQL = `-- name: WithSubquery :many SELECT users.id, users.name, users.age, (SELECT count(*) FROM users) AS total_count FROM users ` @@ -175,7 +175,7 @@ type WithSubqueryRow struct { } func (q *Queries) WithSubquery(ctx context.Context) ([]WithSubqueryRow, error) { - rows, err := q.db.QueryContext(ctx, withSubquery) + rows, err := q.db.QueryContext(ctx, withSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go index e3b4bb8538..aceb2464e0 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = ? ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([ return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = ? ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -64,12 +64,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = ? ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -91,12 +91,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ( return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = ? ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go index aa6e821698..1f606414e9 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.Query(ctx, identOnNonNullable, bar) + rows, err := q.db.Query(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -34,12 +34,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([ return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, identOnNullable, maybeBar) + rows, err := q.db.Query(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -58,12 +58,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.Query(ctx, stringOnNonNullable, bar) + rows, err := q.db.Query(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -82,12 +82,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ( return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.Query(ctx, stringOnNullable, maybeBar) + rows, err := q.db.Query(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go index ca55c35d3c..8aedf734b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar pgtype.Text) ([]string, error) { - rows, err := q.db.Query(ctx, identOnNonNullable, bar) + rows, err := q.db.Query(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -35,12 +35,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar pgtype.Text) ([]st return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar pgtype.Text) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, identOnNullable, maybeBar) + rows, err := q.db.Query(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -59,12 +59,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar pgtype.Text) ([] return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar pgtype.Text) ([]string, error) { - rows, err := q.db.Query(ctx, stringOnNonNullable, bar) + rows, err := q.db.Query(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -83,12 +83,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar pgtype.Text) ([]s return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar pgtype.Text) ([]pgtype.Text, error) { - rows, err := q.db.Query(ctx, stringOnNullable, maybeBar) + rows, err := q.db.Query(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go index a982882a1e..8a8bec498d 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([ return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -64,12 +64,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -91,12 +91,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ( return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go index 1feb465be7..15b6338faf 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([ return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -64,12 +64,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = $1 ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -91,12 +91,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ( return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = $1 ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go index a5fd45abe3..75d03afc53 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const identOnNonNullable = `-- name: IdentOnNonNullable :many +const identOnNonNullableSQL = `-- name: IdentOnNonNullable :many SELECT bar FROM foo WHERE bar = ?1 ` func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, identOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, identOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -37,12 +37,12 @@ func (q *Queries) IdentOnNonNullable(ctx context.Context, bar sql.NullString) ([ return items, nil } -const identOnNullable = `-- name: IdentOnNullable :many +const identOnNullableSQL = `-- name: IdentOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = ?1 ` func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, identOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, identOnNullableSQL, maybeBar) if err != nil { return nil, err } @@ -64,12 +64,12 @@ func (q *Queries) IdentOnNullable(ctx context.Context, maybeBar sql.NullString) return items, nil } -const stringOnNonNullable = `-- name: StringOnNonNullable :many +const stringOnNonNullableSQL = `-- name: StringOnNonNullable :many SELECT bar FROM foo WHERE bar = ?1 ` func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ([]string, error) { - rows, err := q.db.QueryContext(ctx, stringOnNonNullable, bar) + rows, err := q.db.QueryContext(ctx, stringOnNonNullableSQL, bar) if err != nil { return nil, err } @@ -91,12 +91,12 @@ func (q *Queries) StringOnNonNullable(ctx context.Context, bar sql.NullString) ( return items, nil } -const stringOnNullable = `-- name: StringOnNullable :many +const stringOnNullableSQL = `-- name: StringOnNullable :many SELECT maybe_bar FROM foo WHERE maybe_bar = ?1 ` func (q *Queries) StringOnNullable(ctx context.Context, maybeBar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, stringOnNullable, maybeBar) + rows, err := q.db.QueryContext(ctx, stringOnNullableSQL, maybeBar) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go index 0d213c5db6..7d52b54c8d 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go @@ -13,13 +13,13 @@ import ( "github.com/sqlc-dev/sqlc-testdata/mysql" ) -const funcNullable = `-- name: FuncNullable :many +const funcNullableSQL = `-- name: FuncNullable :many SELECT bar FROM foo WHERE id IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncNullable(ctx context.Context, favourites []int32) ([]sql.NullString, error) { - query := funcNullable + query := funcNullableSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -51,13 +51,13 @@ func (q *Queries) FuncNullable(ctx context.Context, favourites []int32) ([]sql.N return items, nil } -const funcNullableNot = `-- name: FuncNullableNot :many +const funcNullableNotSQL = `-- name: FuncNullableNot :many SELECT bar FROM foo WHERE id NOT IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int32) ([]sql.NullString, error) { - query := funcNullableNot + query := funcNullableNotSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -89,7 +89,7 @@ func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int32) ([]sq return items, nil } -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ? AND id IN (/*SLICE:favourites*/?) @@ -101,7 +101,7 @@ type FuncParamIdentParams struct { } func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { - query := funcParamIdent + query := funcParamIdentSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -134,13 +134,13 @@ func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) return items, nil } -const funcParamSoloArg = `-- name: FuncParamSoloArg :many +const funcParamSoloArgSQL = `-- name: FuncParamSoloArg :many SELECT name FROM foo WHERE id IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int32) ([]string, error) { - query := funcParamSoloArg + query := funcParamSoloArgSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -172,7 +172,7 @@ func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int32) ([]s return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = ? AND id IN (/*SLICE:favourites*/?) @@ -184,7 +184,7 @@ type FuncParamStringParams struct { } func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { - query := funcParamString + query := funcParamStringSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -217,7 +217,7 @@ func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams return items, nil } -const sliceExec = `-- name: SliceExec :exec +const sliceExecSQL = `-- name: SliceExec :exec UPDATE foo SET name = ? WHERE id IN (/*SLICE:favourites*/?) ` @@ -228,7 +228,7 @@ type SliceExecParams struct { } func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { - query := sliceExec + query := sliceExecSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -243,13 +243,13 @@ func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { return err } -const typedMyStr = `-- name: TypedMyStr :many +const typedMyStrSQL = `-- name: TypedMyStr :many SELECT bar FROM foo WHERE mystr IN (/*SLICE:mystr*/?) ` func (q *Queries) TypedMyStr(ctx context.Context, mystr []mysql.ID) ([]sql.NullString, error) { - query := typedMyStr + query := typedMyStrSQL var queryParams []any if len(mystr) > 0 { for _, v := range mystr { diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go index e3f3dd5816..bf0f13d02a 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 AND id IN ($2) ` @@ -20,7 +20,7 @@ type FuncParamIdentParams struct { } func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamIdent, arg.Slug, arg.Favourites) + rows, err := q.db.Query(ctx, funcParamIdentSQL, arg.Slug, arg.Favourites) if err != nil { return nil, err } @@ -39,7 +39,7 @@ func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 AND id IN ($2) ` @@ -50,7 +50,7 @@ type FuncParamStringParams struct { } func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamString, arg.Slug, arg.Favourites) + rows, err := q.db.Query(ctx, funcParamStringSQL, arg.Slug, arg.Favourites) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go index 1c72c365eb..f6131c5ca5 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "strings" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 AND id IN ($2) @@ -22,7 +22,7 @@ type FuncParamIdentParams struct { } func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { - query := funcParamIdent + query := funcParamIdentSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -55,7 +55,7 @@ func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 AND id IN ($2) @@ -67,7 +67,7 @@ type FuncParamStringParams struct { } func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { - query := funcParamString + query := funcParamStringSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go index 2f36290c93..9e98ecb7c7 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go @@ -11,13 +11,13 @@ import ( "strings" ) -const funcNullable = `-- name: FuncNullable :many +const funcNullableSQL = `-- name: FuncNullable :many SELECT bar FROM foo WHERE id IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncNullable(ctx context.Context, favourites []int64) ([]sql.NullString, error) { - query := funcNullable + query := funcNullableSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -49,13 +49,13 @@ func (q *Queries) FuncNullable(ctx context.Context, favourites []int64) ([]sql.N return items, nil } -const funcNullableNot = `-- name: FuncNullableNot :many +const funcNullableNotSQL = `-- name: FuncNullableNot :many SELECT bar FROM foo WHERE id NOT IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int64) ([]sql.NullString, error) { - query := funcNullableNot + query := funcNullableNotSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -87,7 +87,7 @@ func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int64) ([]sq return items, nil } -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ?1 AND id IN (/*SLICE:favourites*/?) @@ -99,7 +99,7 @@ type FuncParamIdentParams struct { } func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { - query := funcParamIdent + query := funcParamIdentSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -132,13 +132,13 @@ func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) return items, nil } -const funcParamSoloArg = `-- name: FuncParamSoloArg :many +const funcParamSoloArgSQL = `-- name: FuncParamSoloArg :many SELECT name FROM foo WHERE id IN (/*SLICE:favourites*/?) ` func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int64) ([]string, error) { - query := funcParamSoloArg + query := funcParamSoloArgSQL var queryParams []any if len(favourites) > 0 { for _, v := range favourites { @@ -170,7 +170,7 @@ func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int64) ([]s return items, nil } -const funcParamString = `-- name: FuncParamString :many +const funcParamStringSQL = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = ?1 AND id IN (/*SLICE:favourites*/?) @@ -182,7 +182,7 @@ type FuncParamStringParams struct { } func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { - query := funcParamString + query := funcParamStringSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { @@ -215,7 +215,7 @@ func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams return items, nil } -const sliceExec = `-- name: SliceExec :exec +const sliceExecSQL = `-- name: SliceExec :exec UPDATE foo SET name = ?1 WHERE id IN (/*SLICE:favourites*/?) ` @@ -226,7 +226,7 @@ type SliceExecParams struct { } func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { - query := sliceExec + query := sliceExecSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go index 9ebfe37cf6..5b39623db2 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go @@ -24,7 +24,7 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.funcParamIdentStmt, err = db.PrepareContext(ctx, funcParamIdent); err != nil { + if q.funcParamIdentStmt, err = db.PrepareContext(ctx, funcParamIdentSQL); err != nil { return nil, fmt.Errorf("error preparing query FuncParamIdent: %w", err) } return &q, nil diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go index aec6437c84..65cc062ab8 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "strings" ) -const funcParamIdent = `-- name: FuncParamIdent :many +const funcParamIdentSQL = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ?1 AND id IN (/*SLICE:favourites*/?) @@ -22,7 +22,7 @@ type FuncParamIdentParams struct { } func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { - query := funcParamIdent + query := funcParamIdentSQL var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go index 27211722b5..31a9dc1655 100644 --- a/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go @@ -10,14 +10,14 @@ import ( "database/sql" ) -const getFoo = `-- name: GetFoo :many +const getFooSQL = `-- name: GetFoo :many SELECT bar FROM foo WHERE bar = ? ` func (q *Queries) GetFoo(ctx context.Context, bar sql.NullString) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, getFoo, bar) + rows, err := q.db.QueryContext(ctx, getFooSQL, bar) if err != nil { return nil, err } @@ -39,12 +39,12 @@ func (q *Queries) GetFoo(ctx context.Context, bar sql.NullString) ([]sql.NullStr return items, nil } -const listFoo = `-- name: ListFoo :many +const listFooSQL = `-- name: ListFoo :many SELECT bar FROM foo ` func (q *Queries) ListFoo(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, listFoo) + rows, err := q.db.QueryContext(ctx, listFooSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go index 6f1e81df90..c08854ba06 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors1 WHERE id = ?1 @@ -17,7 +17,7 @@ LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Authors1, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Authors1 err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go index b8abfb7ca3..d61f6c6c3f 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, a, b, foo.a, foo.b FROM foo ` @@ -24,7 +24,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -53,12 +53,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b FROM foo ` + "`" + `t` + "`" + ` ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go index 5f01bff758..5e935cf836 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, a, b, foo.a, foo.b FROM foo ` @@ -24,7 +24,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.Query(ctx, starExpansion) + rows, err := q.db.Query(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -50,12 +50,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b FROM foo "t" ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starQuotedExpansion) + rows, err := q.db.Query(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go index 4a3ce47f74..4ecc5440ac 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, a, b, foo.a, foo.b FROM foo ` @@ -25,7 +25,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.Query(ctx, starExpansion) + rows, err := q.db.Query(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -51,12 +51,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b FROM foo "t" ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starQuotedExpansion) + rows, err := q.db.Query(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go index b56411ca25..e2da438a94 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, a, b, foo.a, foo.b FROM foo ` @@ -24,7 +24,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -53,12 +53,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b FROM foo "t" ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go index 47308250ae..ac54a824db 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, a, b, foo.a, foo.b FROM foo ` @@ -24,7 +24,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -53,12 +53,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b FROM foo AS t ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go index 10c1e7be16..daf4743d36 100644 --- a/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, ` + "`" + `group` + "`" + `, a, b, ` + "`" + `group` + "`" + `, foo.a, foo.b, foo.` + "`" + `group` + "`" + ` FROM foo ` @@ -27,7 +27,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -59,12 +59,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +const starExpansionAliasedSubquerySQL = `-- name: StarExpansionAliasedSubquery :many SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x ` func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquerySQL) if err != nil { return nil, err } @@ -86,12 +86,12 @@ func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullS return items, nil } -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) + rows, err := q.db.QueryContext(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT foo.a, b, ` + "`" + `group` + "`" + `, bar.a, c FROM foo, bar ` @@ -126,7 +126,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionJoin) + rows, err := q.db.QueryContext(ctx, starExpansionJoinSQL) if err != nil { return nil, err } @@ -154,12 +154,12 @@ func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow return items, nil } -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, c FROM (SELECT a, c FROM bar) sub ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } @@ -181,12 +181,12 @@ func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b, t.` + "`" + `group` + "`" + ` FROM foo ` + "`" + `t` + "`" + ` ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go index 3a688f9404..38e667618d 100644 --- a/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, "group", a, b, "group", foo.a, foo.b, foo."group" FROM foo ` @@ -27,7 +27,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -59,12 +59,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +const starExpansionAliasedSubquerySQL = `-- name: StarExpansionAliasedSubquery :many SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x ` func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquerySQL) if err != nil { return nil, err } @@ -86,12 +86,12 @@ func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullS return items, nil } -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) + rows, err := q.db.QueryContext(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT foo.a, b, "group", bar.a, c FROM foo, bar ` @@ -126,7 +126,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionJoin) + rows, err := q.db.QueryContext(ctx, starExpansionJoinSQL) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow return items, nil } -const starExpansionReturning = `-- name: StarExpansionReturning :one +const starExpansionReturningSQL = `-- name: StarExpansionReturning :one INSERT INTO bar (a, c) VALUES ($1, $2) RETURNING a, c ` @@ -164,18 +164,18 @@ type StarExpansionReturningParams struct { } func (q *Queries) StarExpansionReturning(ctx context.Context, arg StarExpansionReturningParams) (Bar, error) { - row := q.db.QueryRowContext(ctx, starExpansionReturning, arg.A, arg.C) + row := q.db.QueryRowContext(ctx, starExpansionReturningSQL, arg.A, arg.C) var i Bar err := row.Scan(&i.A, &i.C) return i, err } -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, c FROM (SELECT a, c FROM bar) sub ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } @@ -197,12 +197,12 @@ func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b, t."group" FROM foo "t" ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go index 4ed292f831..e8d00fd09d 100644 --- a/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansion = `-- name: StarExpansion :many +const starExpansionSQL = `-- name: StarExpansion :many SELECT a, b, "group", a, b, "group", foo.a, foo.b, foo."group" FROM foo ` @@ -27,7 +27,7 @@ type StarExpansionRow struct { } func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansion) + rows, err := q.db.QueryContext(ctx, starExpansionSQL) if err != nil { return nil, err } @@ -59,12 +59,12 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) return items, nil } -const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +const starExpansionAliasedSubquerySQL = `-- name: StarExpansionAliasedSubquery :many SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x ` func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { - rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquerySQL) if err != nil { return nil, err } @@ -86,12 +86,12 @@ func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullS return items, nil } -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) + rows, err := q.db.QueryContext(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -113,12 +113,12 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionHiddenColumns = `-- name: StarExpansionHiddenColumns :many +const starExpansionHiddenColumnsSQL = `-- name: StarExpansionHiddenColumns :many SELECT name FROM recipes_fts ` func (q *Queries) StarExpansionHiddenColumns(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, starExpansionHiddenColumns) + rows, err := q.db.QueryContext(ctx, starExpansionHiddenColumnsSQL) if err != nil { return nil, err } @@ -140,7 +140,7 @@ func (q *Queries) StarExpansionHiddenColumns(ctx context.Context) ([]string, err return items, nil } -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT foo.a, b, "group", bar.a, c FROM foo, bar ` @@ -153,7 +153,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionJoin) + rows, err := q.db.QueryContext(ctx, starExpansionJoinSQL) if err != nil { return nil, err } @@ -181,12 +181,12 @@ func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow return items, nil } -const starExpansionQualifiedHiddenColumns = `-- name: StarExpansionQualifiedHiddenColumns :many +const starExpansionQualifiedHiddenColumnsSQL = `-- name: StarExpansionQualifiedHiddenColumns :many SELECT recipes_fts.name FROM recipes_fts ` func (q *Queries) StarExpansionQualifiedHiddenColumns(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, starExpansionQualifiedHiddenColumns) + rows, err := q.db.QueryContext(ctx, starExpansionQualifiedHiddenColumnsSQL) if err != nil { return nil, err } @@ -208,7 +208,7 @@ func (q *Queries) StarExpansionQualifiedHiddenColumns(ctx context.Context) ([]st return items, nil } -const starExpansionReturning = `-- name: StarExpansionReturning :one +const starExpansionReturningSQL = `-- name: StarExpansionReturning :one INSERT INTO bar (a, c) VALUES (?, ?) RETURNING a, c ` @@ -218,18 +218,18 @@ type StarExpansionReturningParams struct { } func (q *Queries) StarExpansionReturning(ctx context.Context, arg StarExpansionReturningParams) (Bar, error) { - row := q.db.QueryRowContext(ctx, starExpansionReturning, arg.A, arg.C) + row := q.db.QueryRowContext(ctx, starExpansionReturningSQL, arg.A, arg.C) var i Bar err := row.Scan(&i.A, &i.C) return i, err } -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, c FROM (SELECT a, c FROM bar) AS sub ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } @@ -251,12 +251,12 @@ func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { return items, nil } -const starQuotedExpansion = `-- name: StarQuotedExpansion :many +const starQuotedExpansionSQL = `-- name: StarQuotedExpansion :many SELECT t.a, t.b, t."group" FROM foo AS t ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + rows, err := q.db.QueryContext(ctx, starQuotedExpansionSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go index 740b103fa7..a2c017ae22 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, starExpansionCTE) + rows, err := q.db.Query(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -34,7 +34,7 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +const starExpansionTwoCTESQL = `-- name: StarExpansionTwoCTE :many WITH a AS (SELECT a, b FROM foo), b AS (SELECT 1::int as bar, a, b FROM a) @@ -48,7 +48,7 @@ type StarExpansionTwoCTERow struct { } func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { - rows, err := q.db.Query(ctx, starExpansionTwoCTE) + rows, err := q.db.Query(ctx, starExpansionTwoCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go index db22d0bd04..588bcf92b0 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.Query(ctx, starExpansionCTE) + rows, err := q.db.Query(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +const starExpansionTwoCTESQL = `-- name: StarExpansionTwoCTE :many WITH a AS (SELECT a, b FROM foo), b AS (SELECT 1::int as bar, a, b FROM a) @@ -49,7 +49,7 @@ type StarExpansionTwoCTERow struct { } func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { - rows, err := q.db.Query(ctx, starExpansionTwoCTE) + rows, err := q.db.Query(ctx, starExpansionTwoCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go index 1fe02a3dcf..08103a8409 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go @@ -10,12 +10,12 @@ import ( "database/sql" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT c, d FROM bar ` func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) + rows, err := q.db.QueryContext(ctx, starExpansionCTESQL) if err != nil { return nil, err } @@ -37,7 +37,7 @@ func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { return items, nil } -const starExpansionTwoCTE = `-- name: StarExpansionTwoCTE :many +const starExpansionTwoCTESQL = `-- name: StarExpansionTwoCTE :many WITH a AS (SELECT a, b FROM foo), b AS (SELECT 1::int as bar, a, b FROM a) @@ -51,7 +51,7 @@ type StarExpansionTwoCTERow struct { } func (q *Queries) StarExpansionTwoCTE(ctx context.Context) ([]StarExpansionTwoCTERow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionTwoCTE) + rows, err := q.db.QueryContext(ctx, starExpansionTwoCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go index 2782a00139..125cf2ec43 100644 --- a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +const getLatestVersionWithSubquerySQL = `-- name: GetLatestVersionWithSubquery :one SELECT * FROM versions WHERE versions.id IN ( @@ -25,7 +25,7 @@ WHERE versions.id IN ( ` func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (Version, error) { - row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + row := q.db.QueryRow(ctx, getLatestVersionWithSubquerySQL) var i Version err := row.Scan(&i.ID, &i.Name, &i.PreviousVersionID) return i, err diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go index 6f269946bb..c7010083b2 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte ` @@ -20,7 +20,7 @@ type StarExpansionCTERow struct { } func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { - rows, err := q.db.Query(ctx, starExpansionCTE) + rows, err := q.db.Query(ctx, starExpansionCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go index 480bec0176..192117fd79 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte ` @@ -21,7 +21,7 @@ type StarExpansionCTERow struct { } func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { - rows, err := q.db.Query(ctx, starExpansionCTE) + rows, err := q.db.Query(ctx, starExpansionCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go index cc764fc05e..c377939201 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansionCTE = `-- name: StarExpansionCTE :many +const starExpansionCTESQL = `-- name: StarExpansionCTE :many WITH cte AS (SELECT a, b FROM foo) SELECT a, b FROM cte ` @@ -20,7 +20,7 @@ type StarExpansionCTERow struct { } func (q *Queries) StarExpansionCTE(ctx context.Context) ([]StarExpansionCTERow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionCTE) + rows, err := q.db.QueryContext(ctx, starExpansionCTESQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go index 364a39a6b5..26cd319f76 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT a, b, c, d FROM foo, bar ` @@ -22,7 +22,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionJoin) + rows, err := q.db.QueryContext(ctx, starExpansionJoinSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go index b1c4a10aab..b38bc33c49 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT a, b, c, d FROM foo, bar ` @@ -22,7 +22,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.Query(ctx, starExpansionJoin) + rows, err := q.db.Query(ctx, starExpansionJoinSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go index ffb00f684d..337fc6ad37 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT a, b, c, d FROM foo, bar ` @@ -23,7 +23,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.Query(ctx, starExpansionJoin) + rows, err := q.db.Query(ctx, starExpansionJoinSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go index 364a39a6b5..26cd319f76 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const starExpansionJoin = `-- name: StarExpansionJoin :many +const starExpansionJoinSQL = `-- name: StarExpansionJoin :many SELECT a, b, c, d FROM foo, bar ` @@ -22,7 +22,7 @@ type StarExpansionJoinRow struct { } func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { - rows, err := q.db.QueryContext(ctx, starExpansionJoin) + rows, err := q.db.QueryContext(ctx, starExpansionJoinSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go index 3f9cd7a481..4f49d113e4 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionReserved = `-- name: StarExpansionReserved :many +const starExpansionReservedSQL = `-- name: StarExpansionReserved :many SELECT ` + "`" + `group` + "`" + `, ` + "`" + `key` + "`" + ` FROM foo ` func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionReserved) + rows, err := q.db.QueryContext(ctx, starExpansionReservedSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go index 614cde97b4..c596403549 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionReserved = `-- name: StarExpansionReserved :many +const starExpansionReservedSQL = `-- name: StarExpansionReserved :many SELECT "group", key FROM foo ` func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starExpansionReserved) + rows, err := q.db.Query(ctx, starExpansionReservedSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go index 614cde97b4..c596403549 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionReserved = `-- name: StarExpansionReserved :many +const starExpansionReservedSQL = `-- name: StarExpansionReserved :many SELECT "group", key FROM foo ` func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starExpansionReserved) + rows, err := q.db.Query(ctx, starExpansionReservedSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go index d3cee046ce..f501ee3ce8 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionReserved = `-- name: StarExpansionReserved :many +const starExpansionReservedSQL = `-- name: StarExpansionReserved :many SELECT "group", key FROM foo ` func (q *Queries) StarExpansionReserved(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionReserved) + rows, err := q.db.QueryContext(ctx, starExpansionReservedSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go index 4da9cb4121..cd90ddcab9 100644 --- a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const countAlertReportBy = `-- name: CountAlertReportBy :many +const countAlertReportBySQL = `-- name: CountAlertReportBy :many select DATE_TRUNC($1,ts)::text as datetime,coalesce(count,0) as count from ( SELECT DATE_TRUNC($1,eventdate) as hr ,count(*) @@ -36,7 +36,7 @@ type CountAlertReportByRow struct { } func (q *Queries) CountAlertReportBy(ctx context.Context, arg CountAlertReportByParams) ([]CountAlertReportByRow, error) { - rows, err := q.db.Query(ctx, countAlertReportBy, arg.DateTrunc, arg.Eventdate, arg.Eventdate_2) + rows, err := q.db.Query(ctx, countAlertReportBySQL, arg.DateTrunc, arg.Eventdate, arg.Eventdate_2) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go index 5dff54cbe5..12fd2ba5e3 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go index a44019cc62..5bbc2d603c 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starExpansionSubquery) + rows, err := q.db.Query(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go index a44019cc62..5bbc2d603c 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.Query(ctx, starExpansionSubquery) + rows, err := q.db.Query(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go index 5dff54cbe5..12fd2ba5e3 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const starExpansionSubquery = `-- name: StarExpansionSubquery :many +const starExpansionSubquerySQL = `-- name: StarExpansionSubquery :many SELECT a, b FROM foo WHERE EXISTS (SELECT a, b FROM foo) ` func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + rows, err := q.db.QueryContext(ctx, starExpansionSubquerySQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go index 1b7b4ef7a9..e95ad266fa 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +const subqueryCalcColumnSQL = `-- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f ` func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) + rows, err := q.db.QueryContext(ctx, subqueryCalcColumnSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go index 3e5eac58e9..2fd219453e 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +const subqueryCalcColumnSQL = `-- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f ` func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, subqueryCalcColumn) + rows, err := q.db.Query(ctx, subqueryCalcColumnSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go index 3e5eac58e9..2fd219453e 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +const subqueryCalcColumnSQL = `-- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f ` func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, subqueryCalcColumn) + rows, err := q.db.Query(ctx, subqueryCalcColumnSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go index 1b7b4ef7a9..e95ad266fa 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +const subqueryCalcColumnSQL = `-- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f ` func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) + rows, err := q.db.QueryContext(ctx, subqueryCalcColumnSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go index 6e09c33be3..01b2bac2ce 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const subqueryCalcColumn = `-- name: SubqueryCalcColumn :many +const subqueryCalcColumnSQL = `-- name: SubqueryCalcColumn :many SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f ` func (q *Queries) SubqueryCalcColumn(ctx context.Context) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, subqueryCalcColumn) + rows, err := q.db.QueryContext(ctx, subqueryCalcColumnSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go index af828e1d45..0c669508b2 100644 --- a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go @@ -11,12 +11,12 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const sumOrder = `-- name: SumOrder :one +const sumOrderSQL = `-- name: SumOrder :one SELECT SUM(quantity) FROM orders ` func (q *Queries) SumOrder(ctx context.Context) (pgtype.Numeric, error) { - row := q.db.QueryRow(ctx, sumOrder) + row := q.db.QueryRow(ctx, sumOrderSQL) var sum pgtype.Numeric err := row.Scan(&sum) return sum, err diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go index 1766c85261..fe8744bc2d 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgtype" ) -const getTransaction = `-- name: GetTransaction :many +const getTransactionSQL = `-- name: GetTransaction :many SELECT jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), jsonb_agg(instructions.value) @@ -36,7 +36,7 @@ type GetTransactionRow struct { } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) + rows, err := q.db.Query(ctx, getTransactionSQL, arg.ProgramID, arg.Data) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go index 1b791bcb61..94a1b4e499 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getTransaction = `-- name: GetTransaction :many +const getTransactionSQL = `-- name: GetTransaction :many SELECT jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), jsonb_agg(instructions.value) @@ -34,7 +34,7 @@ type GetTransactionRow struct { } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.Query(ctx, getTransaction, arg.ProgramID, arg.Data) + rows, err := q.db.Query(ctx, getTransactionSQL, arg.ProgramID, arg.Data) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go index 5cd9637531..2dfaed1427 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go @@ -10,7 +10,7 @@ import ( "encoding/json" ) -const getTransaction = `-- name: GetTransaction :many +const getTransactionSQL = `-- name: GetTransaction :many SELECT jsonb_extract_path(transactions.data, '$.transaction.signatures[0]'), jsonb_agg(instructions.value) @@ -35,7 +35,7 @@ type GetTransactionRow struct { } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data) + rows, err := q.db.QueryContext(ctx, getTransactionSQL, arg.ProgramID, arg.Data) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go index 345333f3f7..19f7556cdf 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getTransaction = `-- name: GetTransaction :many +const getTransactionSQL = `-- name: GetTransaction :many SELECT json_extract(transactions.data, '$.transaction.signatures[0]'), json_group_array(instructions.value) @@ -33,7 +33,7 @@ type GetTransactionRow struct { } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { - rows, err := q.db.QueryContext(ctx, getTransaction, arg.ProgramID, arg.Data, arg.Limit) + rows, err := q.db.QueryContext(ctx, getTransactionSQL, arg.ProgramID, arg.Data, arg.Limit) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go index 6963209e6b..baa5366792 100644 --- a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go @@ -10,123 +10,123 @@ import ( "database/sql" ) -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM "Authors" WHERE id = ? ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } -const deleteBook = `-- name: DeleteBook :exec +const deleteBookSQL = `-- name: DeleteBook :exec DELETE FROM books WHERE id = ? ` func (q *Queries) DeleteBook(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteBook, id) + _, err := q.db.ExecContext(ctx, deleteBookSQL, id) return err } -const deleteUser = `-- name: DeleteUser :exec +const deleteUserSQL = `-- name: DeleteUser :exec DELETE FROM users WHERE id = ? ` func (q *Queries) DeleteUser(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteUser, id) + _, err := q.db.ExecContext(ctx, deleteUserSQL, id) return err } -const deleteUserMixedCase = `-- name: DeleteUserMixedCase :exec +const deleteUserMixedCaseSQL = `-- name: DeleteUserMixedCase :exec DELETE FROM users WHERE id = ? ` func (q *Queries) DeleteUserMixedCase(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteUserMixedCase, id) + _, err := q.db.ExecContext(ctx, deleteUserMixedCaseSQL, id) return err } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name FROM "Authors" WHERE id = ? ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name) return i, err } -const getBook = `-- name: GetBook :one +const getBookSQL = `-- name: GetBook :one SELECT id, title FROM books WHERE id = ? ` func (q *Queries) GetBook(ctx context.Context, id int64) (Book, error) { - row := q.db.QueryRowContext(ctx, getBook, id) + row := q.db.QueryRowContext(ctx, getBookSQL, id) var i Book err := row.Scan(&i.ID, &i.Title) return i, err } -const getUser = `-- name: GetUser :one +const getUserSQL = `-- name: GetUser :one SELECT id, name FROM users WHERE id = ? ` func (q *Queries) GetUser(ctx context.Context, id int64) (User, error) { - row := q.db.QueryRowContext(ctx, getUser, id) + row := q.db.QueryRowContext(ctx, getUserSQL, id) var i User err := row.Scan(&i.ID, &i.Name) return i, err } -const getUserMixedCase = `-- name: GetUserMixedCase :one +const getUserMixedCaseSQL = `-- name: GetUserMixedCase :one SELECT id, name FROM users WHERE id = ? ` func (q *Queries) GetUserMixedCase(ctx context.Context, id int64) (User, error) { - row := q.db.QueryRowContext(ctx, getUserMixedCase, id) + row := q.db.QueryRowContext(ctx, getUserMixedCaseSQL, id) var i User err := row.Scan(&i.ID, &i.Name) return i, err } -const insertAuthor = `-- name: InsertAuthor :exec +const insertAuthorSQL = `-- name: InsertAuthor :exec INSERT INTO "Authors" (name) VALUES (?) ` func (q *Queries) InsertAuthor(ctx context.Context, name sql.NullString) error { - _, err := q.db.ExecContext(ctx, insertAuthor, name) + _, err := q.db.ExecContext(ctx, insertAuthorSQL, name) return err } -const insertBook = `-- name: InsertBook :exec +const insertBookSQL = `-- name: InsertBook :exec INSERT INTO books (title) VALUES (?) ` func (q *Queries) InsertBook(ctx context.Context, title sql.NullString) error { - _, err := q.db.ExecContext(ctx, insertBook, title) + _, err := q.db.ExecContext(ctx, insertBookSQL, title) return err } -const insertUser = `-- name: InsertUser :exec +const insertUserSQL = `-- name: InsertUser :exec INSERT INTO users (name) VALUES (?) ` func (q *Queries) InsertUser(ctx context.Context, name sql.NullString) error { - _, err := q.db.ExecContext(ctx, insertUser, name) + _, err := q.db.ExecContext(ctx, insertUserSQL, name) return err } -const insertUserMixedCase = `-- name: InsertUserMixedCase :exec +const insertUserMixedCaseSQL = `-- name: InsertUserMixedCase :exec INSERT INTO users (name) VALUES (?) ` func (q *Queries) InsertUserMixedCase(ctx context.Context, name sql.NullString) error { - _, err := q.db.ExecContext(ctx, insertUserMixedCase, name) + _, err := q.db.ExecContext(ctx, insertUserMixedCaseSQL, name) return err } -const updateAuthor = `-- name: UpdateAuthor :exec +const updateAuthorSQL = `-- name: UpdateAuthor :exec UPDATE "Authors" SET name = ? WHERE id = ? ` @@ -136,11 +136,11 @@ type UpdateAuthorParams struct { } func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error { - _, err := q.db.ExecContext(ctx, updateAuthor, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, updateAuthorSQL, arg.Name, arg.ID) return err } -const updateBook = `-- name: UpdateBook :exec +const updateBookSQL = `-- name: UpdateBook :exec UPDATE books SET title = ? WHERE id = ? ` @@ -150,11 +150,11 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.ID) + _, err := q.db.ExecContext(ctx, updateBookSQL, arg.Title, arg.ID) return err } -const updateUser = `-- name: UpdateUser :exec +const updateUserSQL = `-- name: UpdateUser :exec UPDATE users SET name = ? WHERE id = ? ` @@ -164,11 +164,11 @@ type UpdateUserParams struct { } func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error { - _, err := q.db.ExecContext(ctx, updateUser, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, updateUserSQL, arg.Name, arg.ID) return err } -const updateUserMixedCase = `-- name: UpdateUserMixedCase :exec +const updateUserMixedCaseSQL = `-- name: UpdateUserMixedCase :exec UPDATE users SET name = ? WHERE id = ? ` @@ -178,6 +178,6 @@ type UpdateUserMixedCaseParams struct { } func (q *Queries) UpdateUserMixedCase(ctx context.Context, arg UpdateUserMixedCaseParams) error { - _, err := q.db.ExecContext(ctx, updateUserMixedCase, arg.Name, arg.ID) + _, err := q.db.ExecContext(ctx, updateUserMixedCaseSQL, arg.Name, arg.ID) return err } diff --git a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go index b0369ef304..f87865dc89 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const truncate = `-- name: Truncate :exec +const truncateSQL = `-- name: Truncate :exec TRUNCATE bar ` func (q *Queries) Truncate(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, truncate) + _, err := q.db.ExecContext(ctx, truncateSQL) return err } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go index 606112035d..f9bcd7ea85 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const truncate = `-- name: Truncate :exec +const truncateSQL = `-- name: Truncate :exec TRUNCATE bar ` func (q *Queries) Truncate(ctx context.Context) error { - _, err := q.db.Exec(ctx, truncate) + _, err := q.db.Exec(ctx, truncateSQL) return err } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go index 606112035d..f9bcd7ea85 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const truncate = `-- name: Truncate :exec +const truncateSQL = `-- name: Truncate :exec TRUNCATE bar ` func (q *Queries) Truncate(ctx context.Context) error { - _, err := q.db.Exec(ctx, truncate) + _, err := q.db.Exec(ctx, truncateSQL) return err } diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go index b0369ef304..f87865dc89 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const truncate = `-- name: Truncate :exec +const truncateSQL = `-- name: Truncate :exec TRUNCATE bar ` func (q *Queries) Truncate(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, truncate) + _, err := q.db.ExecContext(ctx, truncateSQL) return err } diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go index 2f36a6e4e9..c8256391a5 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go @@ -11,23 +11,23 @@ import ( "github.com/google/uuid" ) -const find = `-- name: Find :one +const findSQL = `-- name: Find :one SELECT bar FROM foo WHERE baz = $1 ` func (q *Queries) Find(ctx context.Context, baz uuid.UUID) (uuid.NullUUID, error) { - row := q.db.QueryRowContext(ctx, find, baz) + row := q.db.QueryRowContext(ctx, findSQL, baz) var bar uuid.NullUUID err := row.Scan(&bar) return bar, err } -const list = `-- name: List :many +const listSQL = `-- name: List :many SELECT description, bar, baz FROM foo ` func (q *Queries) List(ctx context.Context) ([]Foo, error) { - rows, err := q.db.QueryContext(ctx, list) + rows, err := q.db.QueryContext(ctx, listSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go index 617353d689..54be67d15c 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoos = `-- name: ListFoos :one +const listFoosSQL = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { - row := q.db.QueryRow(ctx, listFoos, frobnicate) + row := q.db.QueryRow(ctx, listFoosSQL, frobnicate) var id string err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go index 617353d689..54be67d15c 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoos = `-- name: ListFoos :one +const listFoosSQL = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { - row := q.db.QueryRow(ctx, listFoos, frobnicate) + row := q.db.QueryRow(ctx, listFoosSQL, frobnicate) var id string err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go index 79dce10350..0956fd26bd 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const listFoos = `-- name: ListFoos :one +const listFoosSQL = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { - row := q.db.QueryRowContext(ctx, listFoos, frobnicate) + row := q.db.QueryRowContext(ctx, listFoosSQL, frobnicate) var id string err := row.Scan(&id) return id, err diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go index 9296f7be0e..74ccb16efc 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/google/uuid" ) -const createMemories = `-- name: CreateMemories :many +const createMemoriesSQL = `-- name: CreateMemories :many INSERT INTO memories (vampire_id) SELECT unnest($1::uuid[]) AS vampire_id @@ -20,7 +20,7 @@ RETURNING ` func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) { - rows, err := q.db.Query(ctx, createMemories, vampireID) + rows, err := q.db.Query(ctx, createMemoriesSQL, vampireID) if err != nil { return nil, err } @@ -44,12 +44,12 @@ func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([] return items, nil } -const getVampireIDs = `-- name: GetVampireIDs :many +const getVampireIDsSQL = `-- name: GetVampireIDs :many SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) ` func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) { - rows, err := q.db.Query(ctx, getVampireIDs, vampireID) + rows, err := q.db.Query(ctx, getVampireIDsSQL, vampireID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go index 0b4d28807e..1a8a352e46 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createMemories = `-- name: CreateMemories :many +const createMemoriesSQL = `-- name: CreateMemories :many INSERT INTO memories (vampire_id) SELECT unnest($1::uuid[]) AS vampire_id @@ -20,7 +20,7 @@ RETURNING ` func (q *Queries) CreateMemories(ctx context.Context, vampireID []pgtype.UUID) ([]Memory, error) { - rows, err := q.db.Query(ctx, createMemories, vampireID) + rows, err := q.db.Query(ctx, createMemoriesSQL, vampireID) if err != nil { return nil, err } @@ -44,12 +44,12 @@ func (q *Queries) CreateMemories(ctx context.Context, vampireID []pgtype.UUID) ( return items, nil } -const getVampireIDs = `-- name: GetVampireIDs :many +const getVampireIDsSQL = `-- name: GetVampireIDs :many SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) ` func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []pgtype.UUID) ([]pgtype.UUID, error) { - rows, err := q.db.Query(ctx, getVampireIDs, vampireID) + rows, err := q.db.Query(ctx, getVampireIDsSQL, vampireID) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go index 110208dcbf..259e866f9a 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go @@ -12,7 +12,7 @@ import ( "github.com/lib/pq" ) -const createMemories = `-- name: CreateMemories :many +const createMemoriesSQL = `-- name: CreateMemories :many INSERT INTO memories (vampire_id) SELECT unnest($1::uuid[]) AS vampire_id @@ -21,7 +21,7 @@ RETURNING ` func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([]Memory, error) { - rows, err := q.db.QueryContext(ctx, createMemories, pq.Array(vampireID)) + rows, err := q.db.QueryContext(ctx, createMemoriesSQL, pq.Array(vampireID)) if err != nil { return nil, err } @@ -48,12 +48,12 @@ func (q *Queries) CreateMemories(ctx context.Context, vampireID []uuid.UUID) ([] return items, nil } -const getVampireIDs = `-- name: GetVampireIDs :many +const getVampireIDsSQL = `-- name: GetVampireIDs :many SELECT vampires.id::uuid FROM unnest($1::uuid[]) AS vampires (id) ` func (q *Queries) GetVampireIDs(ctx context.Context, vampireID []uuid.UUID) ([]uuid.UUID, error) { - rows, err := q.db.QueryContext(ctx, getVampireIDs, pq.Array(vampireID)) + rows, err := q.db.QueryContext(ctx, getVampireIDsSQL, pq.Array(vampireID)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go index fc8ca8ecdd..342e0381f0 100644 --- a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const getPlanItems = `-- name: GetPlanItems :many +const getPlanItemsSQL = `-- name: GetPlanItems :many SELECT p.plan_id, p.item_id FROM (SELECT unnest FROM unnest($1::bigint[])) AS i(req_item_id), LATERAL ( @@ -37,7 +37,7 @@ type GetPlanItemsRow struct { } func (q *Queries) GetPlanItems(ctx context.Context, arg GetPlanItemsParams) ([]GetPlanItemsRow, error) { - rows, err := q.db.Query(ctx, getPlanItems, arg.Ids, arg.After, arg.LimitCount) + rows, err := q.db.Query(ctx, getPlanItemsSQL, arg.Ids, arg.After, arg.LimitCount) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go index bebb7c94af..0e0b2ea75b 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getValues = `-- name: GetValues :many +const getValuesSQL = `-- name: GetValues :many SELECT id, index::bigint, value::text FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) ` @@ -21,7 +21,7 @@ type GetValuesRow struct { } func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { - rows, err := q.db.Query(ctx, getValues) + rows, err := q.db.Query(ctx, getValuesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go index bebb7c94af..0e0b2ea75b 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getValues = `-- name: GetValues :many +const getValuesSQL = `-- name: GetValues :many SELECT id, index::bigint, value::text FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) ` @@ -21,7 +21,7 @@ type GetValuesRow struct { } func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { - rows, err := q.db.Query(ctx, getValues) + rows, err := q.db.Query(ctx, getValuesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go index 8578cc6874..cff1b40ce2 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getValues = `-- name: GetValues :many +const getValuesSQL = `-- name: GetValues :many SELECT id, index::bigint, value::text FROM array_values AS x, unnest(values) WITH ORDINALITY AS y (value, index) ` @@ -21,7 +21,7 @@ type GetValuesRow struct { } func (q *Queries) GetValues(ctx context.Context) ([]GetValuesRow, error) { - rows, err := q.db.QueryContext(ctx, getValues) + rows, err := q.db.QueryContext(ctx, getValuesSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go index 6b29bebdc1..7239281c45 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const createFoo = `-- name: CreateFoo :exec +const createFooSQL = `-- name: CreateFoo :exec INSERT INTO foo (id) VALUES (?) ` func (q *Queries) CreateFoo(ctx context.Context, id uint32) error { - _, err := q.db.ExecContext(ctx, createFoo, id) + _, err := q.db.ExecContext(ctx, createFooSQL, id) return err } diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go index faef31678f..8c5ce5459a 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const getRepro = `-- name: GetRepro :one +const getReproSQL = `-- name: GetRepro :one SELECT id, name, seq FROM repro WHERE id = ? LIMIT 1 ` func (q *Queries) GetRepro(ctx context.Context, id any) (Repro, error) { - row := q.db.QueryRowContext(ctx, getRepro, id) + row := q.db.QueryRowContext(ctx, getReproSQL, id) var i Repro err := row.Scan(&i.ID, &i.Name, &i.Seq) return i, err diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go index 3ec440777f..eff3b894aa 100644 --- a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateAuthor = `-- name: UpdateAuthor :one +const updateAuthorSQL = `-- name: UpdateAuthor :one update authors set names[$1] = $2 where id=$3 @@ -23,7 +23,7 @@ type UpdateAuthorParams struct { } func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) (Author, error) { - row := q.db.QueryRow(ctx, updateAuthor, arg.Names, arg.Names_2, arg.ID) + row := q.db.QueryRow(ctx, updateAuthorSQL, arg.Names, arg.Names_2, arg.ID) var i Author err := row.Scan(&i.ID, &i.Names) return i, err diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go index 9325d9a3b8..8f8b7909f7 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const updateCode = `-- name: UpdateCode :one +const updateCodeSQL = `-- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +51,7 @@ type UpdateCodeRow struct { } func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { - row := q.db.QueryRow(ctx, updateCode, + row := q.db.QueryRow(ctx, updateCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go index cabcf2f35a..a37f546b51 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go @@ -11,7 +11,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const updateCode = `-- name: UpdateCode :one +const updateCodeSQL = `-- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +51,7 @@ type UpdateCodeRow struct { } func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { - row := q.db.QueryRow(ctx, updateCode, + row := q.db.QueryRow(ctx, updateCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go index b62455f764..c04a81d21f 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go @@ -11,7 +11,7 @@ import ( "time" ) -const updateCode = `-- name: UpdateCode :one +const updateCodeSQL = `-- name: UpdateCode :one WITH cc AS ( UPDATE td3.codes SET @@ -51,7 +51,7 @@ type UpdateCodeRow struct { } func (q *Queries) UpdateCode(ctx context.Context, arg UpdateCodeParams) (UpdateCodeRow, error) { - row := q.db.QueryRowContext(ctx, updateCode, + row := q.db.QueryRowContext(ctx, updateCodeSQL, arg.CreatedBy, arg.Code, arg.Hash, diff --git a/internal/endtoend/testdata/update_inner_join/db/query.sql.go b/internal/endtoend/testdata/update_inner_join/db/query.sql.go index 7ffb4ae638..d7bf0eb5d6 100644 --- a/internal/endtoend/testdata/update_inner_join/db/query.sql.go +++ b/internal/endtoend/testdata/update_inner_join/db/query.sql.go @@ -9,11 +9,11 @@ import ( "context" ) -const updateXWithY = `-- name: UpdateXWithY :exec +const updateXWithYSQL = `-- name: UpdateXWithY :exec UPDATE x INNER JOIN y ON y.a = x.a SET x.b = y.b ` func (q *Queries) UpdateXWithY(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, updateXWithY) + _, err := q.db.ExecContext(ctx, updateXWithYSQL) return err } diff --git a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go index 0450bfe3ee..a428adb8d5 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateJoin = `-- name: UpdateJoin :exec +const updateJoinSQL = `-- name: UpdateJoin :exec UPDATE join_table as jt JOIN primary_table as pt ON jt.primary_table_id = pt.id @@ -25,11 +25,11 @@ type UpdateJoinParams struct { } func (q *Queries) UpdateJoin(ctx context.Context, arg UpdateJoinParams) error { - _, err := q.db.ExecContext(ctx, updateJoin, arg.IsActive, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, updateJoinSQL, arg.IsActive, arg.ID, arg.UserID) return err } -const updateLeftJoin = `-- name: UpdateLeftJoin :exec +const updateLeftJoinSQL = `-- name: UpdateLeftJoin :exec UPDATE join_table as jt LEFT JOIN primary_table as pt ON jt.primary_table_id = pt.id @@ -45,11 +45,11 @@ type UpdateLeftJoinParams struct { } func (q *Queries) UpdateLeftJoin(ctx context.Context, arg UpdateLeftJoinParams) error { - _, err := q.db.ExecContext(ctx, updateLeftJoin, arg.IsActive, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, updateLeftJoinSQL, arg.IsActive, arg.ID, arg.UserID) return err } -const updateRightJoin = `-- name: UpdateRightJoin :exec +const updateRightJoinSQL = `-- name: UpdateRightJoin :exec UPDATE join_table as jt RIGHT JOIN primary_table as pt ON jt.primary_table_id = pt.id @@ -65,6 +65,6 @@ type UpdateRightJoinParams struct { } func (q *Queries) UpdateRightJoin(ctx context.Context, arg UpdateRightJoinParams) error { - _, err := q.db.ExecContext(ctx, updateRightJoin, arg.IsActive, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, updateRightJoinSQL, arg.IsActive, arg.ID, arg.UserID) return err } diff --git a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go index 0e1edda0ef..f514d2f65f 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateJoin = `-- name: UpdateJoin :exec +const updateJoinSQL = `-- name: UpdateJoin :exec UPDATE join_table SET is_active = $1 FROM primary_table @@ -25,6 +25,6 @@ type UpdateJoinParams struct { } func (q *Queries) UpdateJoin(ctx context.Context, arg UpdateJoinParams) error { - _, err := q.db.ExecContext(ctx, updateJoin, arg.IsActive, arg.ID, arg.UserID) + _, err := q.db.ExecContext(ctx, updateJoinSQL, arg.IsActive, arg.ID, arg.UserID) return err } diff --git a/internal/endtoend/testdata/update_set/myql/go/query.sql.go b/internal/endtoend/testdata/update_set/myql/go/query.sql.go index bf7810ddad..b2fed09fff 100644 --- a/internal/endtoend/testdata/update_set/myql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/myql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSet = `-- name: UpdateSet :exec +const updateSetSQL = `-- name: UpdateSet :exec UPDATE foo SET name = ? WHERE slug = ? ` @@ -19,6 +19,6 @@ type UpdateSetParams struct { } func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.ExecContext(ctx, updateSet, arg.Name, arg.Slug) + _, err := q.db.ExecContext(ctx, updateSetSQL, arg.Name, arg.Slug) return err } diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go index 4849f16186..e74c90030b 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSet = `-- name: UpdateSet :exec +const updateSetSQL = `-- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1 ` @@ -19,6 +19,6 @@ type UpdateSetParams struct { } func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.Exec(ctx, updateSet, arg.Slug, arg.Name) + _, err := q.db.Exec(ctx, updateSetSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go index 4849f16186..e74c90030b 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSet = `-- name: UpdateSet :exec +const updateSetSQL = `-- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1 ` @@ -19,6 +19,6 @@ type UpdateSetParams struct { } func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.Exec(ctx, updateSet, arg.Slug, arg.Name) + _, err := q.db.Exec(ctx, updateSetSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go index f9b0709b6c..1e81db8f12 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSet = `-- name: UpdateSet :exec +const updateSetSQL = `-- name: UpdateSet :exec UPDATE foo SET name = $2 WHERE slug = $1 ` @@ -19,6 +19,6 @@ type UpdateSetParams struct { } func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.ExecContext(ctx, updateSet, arg.Slug, arg.Name) + _, err := q.db.ExecContext(ctx, updateSetSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go index bf7810ddad..b2fed09fff 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSet = `-- name: UpdateSet :exec +const updateSetSQL = `-- name: UpdateSet :exec UPDATE foo SET name = ? WHERE slug = ? ` @@ -19,6 +19,6 @@ type UpdateSetParams struct { } func (q *Queries) UpdateSet(ctx context.Context, arg UpdateSetParams) error { - _, err := q.db.ExecContext(ctx, updateSet, arg.Name, arg.Slug) + _, err := q.db.ExecContext(ctx, updateSetSQL, arg.Name, arg.Slug) return err } diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go index b39667eb5e..2fcee5e82d 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSetMultiple = `-- name: UpdateSetMultiple :exec +const updateSetMultipleSQL = `-- name: UpdateSetMultiple :exec UPDATE foo SET name = ?, slug = ? ` @@ -19,6 +19,6 @@ type UpdateSetMultipleParams struct { } func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Name, arg.Slug) + _, err := q.db.ExecContext(ctx, updateSetMultipleSQL, arg.Name, arg.Slug) return err } diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go index 9afe0b297f..c0c685e70d 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSetMultiple = `-- name: UpdateSetMultiple :exec +const updateSetMultipleSQL = `-- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1) ` @@ -19,6 +19,6 @@ type UpdateSetMultipleParams struct { } func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.Exec(ctx, updateSetMultiple, arg.Slug, arg.Name) + _, err := q.db.Exec(ctx, updateSetMultipleSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go index 9afe0b297f..c0c685e70d 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSetMultiple = `-- name: UpdateSetMultiple :exec +const updateSetMultipleSQL = `-- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1) ` @@ -19,6 +19,6 @@ type UpdateSetMultipleParams struct { } func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.Exec(ctx, updateSetMultiple, arg.Slug, arg.Name) + _, err := q.db.Exec(ctx, updateSetMultipleSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go index cbbf9094f3..fb44080727 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSetMultiple = `-- name: UpdateSetMultiple :exec +const updateSetMultipleSQL = `-- name: UpdateSetMultiple :exec UPDATE foo SET (name, slug) = ($2, $1) ` @@ -19,6 +19,6 @@ type UpdateSetMultipleParams struct { } func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Slug, arg.Name) + _, err := q.db.ExecContext(ctx, updateSetMultipleSQL, arg.Slug, arg.Name) return err } diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go index b39667eb5e..2fcee5e82d 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const updateSetMultiple = `-- name: UpdateSetMultiple :exec +const updateSetMultipleSQL = `-- name: UpdateSetMultiple :exec UPDATE foo SET name = ?, slug = ? ` @@ -19,6 +19,6 @@ type UpdateSetMultipleParams struct { } func (q *Queries) UpdateSetMultiple(ctx context.Context, arg UpdateSetMultipleParams) error { - _, err := q.db.ExecContext(ctx, updateSetMultiple, arg.Name, arg.Slug) + _, err := q.db.ExecContext(ctx, updateSetMultipleSQL, arg.Name, arg.Slug) return err } diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go index 208379091b..bb8e8f2e48 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec UPDATE authors, books @@ -22,6 +22,6 @@ WHERE ` func (q *Queries) DeleteAuthor(ctx context.Context, name string) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, name) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, name) return err } diff --git a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go index 8a5227da4e..07aa7c058d 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const upsertLocation = `-- name: UpsertLocation :exec +const upsertLocationSQL = `-- name: UpsertLocation :exec INSERT INTO locations ( name, address, @@ -35,7 +35,7 @@ type UpsertLocationParams struct { } func (q *Queries) UpsertLocation(ctx context.Context, arg UpsertLocationParams) error { - _, err := q.db.ExecContext(ctx, upsertLocation, + _, err := q.db.ExecContext(ctx, upsertLocationSQL, arg.Name, arg.Address, arg.ZipCode, diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go index ca1bd3e382..8ded8ef1cf 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name as full_name, bio FROM authors GROUP BY full_name @@ -23,7 +23,7 @@ type ListAuthorsRow struct { } func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -45,14 +45,14 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { return items, nil } -const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +const listAuthorsIdenticalAliasSQL = `-- name: ListAuthorsIdenticalAlias :many SELECT id, name as name, bio FROM authors GROUP BY name ` func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAliasSQL) if err != nil { return nil, err } @@ -74,7 +74,7 @@ func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, erro return items, nil } -const listMetrics = `-- name: ListMetrics :many +const listMetricsSQL = `-- name: ListMetrics :many SELECT time_bucket('15 days', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics WHERE DATE_SUB(NOW(), INTERVAL 6 MONTH) @@ -89,7 +89,7 @@ type ListMetricsRow struct { } func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { - rows, err := q.db.QueryContext(ctx, listMetrics) + rows, err := q.db.QueryContext(ctx, listMetricsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go index 71edbc94d6..ff29c89658 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go @@ -11,13 +11,13 @@ import ( "time" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name as name, bio FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -39,13 +39,13 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { return items, nil } -const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +const listAuthorsIdenticalAliasSQL = `-- name: ListAuthorsIdenticalAlias :many SELECT id, name as name, bio FROM authors ` func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAliasSQL) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, erro return items, nil } -const listMetrics = `-- name: ListMetrics :many +const listMetricsSQL = `-- name: ListMetrics :many SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics WHERE time > NOW() - (6 * INTERVAL '1 month') @@ -82,7 +82,7 @@ type ListMetricsRow struct { } func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { - rows, err := q.db.QueryContext(ctx, listMetrics) + rows, err := q.db.QueryContext(ctx, listMetricsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go index 712d116ac0..61c9e9857d 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go @@ -10,13 +10,13 @@ import ( "database/sql" ) -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name as name, bio FROM authors ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -38,13 +38,13 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { return items, nil } -const listAuthorsIdenticalAlias = `-- name: ListAuthorsIdenticalAlias :many +const listAuthorsIdenticalAliasSQL = `-- name: ListAuthorsIdenticalAlias :many SELECT id, name as name, bio FROM authors ` func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAlias) + rows, err := q.db.QueryContext(ctx, listAuthorsIdenticalAliasSQL) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func (q *Queries) ListAuthorsIdenticalAlias(ctx context.Context) ([]Author, erro return items, nil } -const listMetrics = `-- name: ListMetrics :many +const listMetricsSQL = `-- name: ListMetrics :many SELECT date_trunc('day', time) AS bucket, city_name, AVG(temp_c) FROM weather_metrics WHERE time > NOW() - (6 * INTERVAL '1 month') @@ -81,7 +81,7 @@ type ListMetricsRow struct { } func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { - rows, err := q.db.QueryContext(ctx, listMetrics) + rows, err := q.db.QueryContext(ctx, listMetricsSQL) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go index 8fe59c296b..25936bca0f 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go @@ -11,433 +11,433 @@ import ( "time" ) -const selectByCbinary = `-- name: SelectByCbinary :one +const selectByCbinarySQL = `-- name: SelectByCbinary :one SELECT id FROM debug WHERE Cbinary = ? LIMIT 1 ` func (q *Queries) SelectByCbinary(ctx context.Context, cbinary []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCbinary, cbinary) + row := q.db.QueryRowContext(ctx, selectByCbinarySQL, cbinary) var id int64 err := row.Scan(&id) return id, err } -const selectByCbit = `-- name: SelectByCbit :one +const selectByCbitSQL = `-- name: SelectByCbit :one SELECT id FROM debug WHERE Cbit = ? LIMIT 1 ` func (q *Queries) SelectByCbit(ctx context.Context, cbit any) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCbit, cbit) + row := q.db.QueryRowContext(ctx, selectByCbitSQL, cbit) var id int64 err := row.Scan(&id) return id, err } -const selectByCblob = `-- name: SelectByCblob :one +const selectByCblobSQL = `-- name: SelectByCblob :one SELECT id FROM debug WHERE Cblob = ? LIMIT 1 ` func (q *Queries) SelectByCblob(ctx context.Context, cblob []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCblob, cblob) + row := q.db.QueryRowContext(ctx, selectByCblobSQL, cblob) var id int64 err := row.Scan(&id) return id, err } -const selectByCbool = `-- name: SelectByCbool :one +const selectByCboolSQL = `-- name: SelectByCbool :one SELECT id FROM debug WHERE Cbool = ? LIMIT 1 ` func (q *Queries) SelectByCbool(ctx context.Context, cbool bool) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCbool, cbool) + row := q.db.QueryRowContext(ctx, selectByCboolSQL, cbool) var id int64 err := row.Scan(&id) return id, err } -const selectByCchar = `-- name: SelectByCchar :one +const selectByCcharSQL = `-- name: SelectByCchar :one SELECT id FROM debug WHERE Cchar = ? LIMIT 1 ` func (q *Queries) SelectByCchar(ctx context.Context, cchar string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCchar, cchar) + row := q.db.QueryRowContext(ctx, selectByCcharSQL, cchar) var id int64 err := row.Scan(&id) return id, err } -const selectByCdate = `-- name: SelectByCdate :one +const selectByCdateSQL = `-- name: SelectByCdate :one SELECT id FROM debug WHERE Cdate = ? LIMIT 1 ` func (q *Queries) SelectByCdate(ctx context.Context, cdate time.Time) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdate, cdate) + row := q.db.QueryRowContext(ctx, selectByCdateSQL, cdate) var id int64 err := row.Scan(&id) return id, err } -const selectByCdatetime = `-- name: SelectByCdatetime :one +const selectByCdatetimeSQL = `-- name: SelectByCdatetime :one SELECT id FROM debug WHERE Cdatetime = ? LIMIT 1 ` func (q *Queries) SelectByCdatetime(ctx context.Context, cdatetime time.Time) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdatetime, cdatetime) + row := q.db.QueryRowContext(ctx, selectByCdatetimeSQL, cdatetime) var id int64 err := row.Scan(&id) return id, err } -const selectByCdec = `-- name: SelectByCdec :one +const selectByCdecSQL = `-- name: SelectByCdec :one SELECT id FROM debug WHERE Cdec = ? LIMIT 1 ` func (q *Queries) SelectByCdec(ctx context.Context, cdec string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdec, cdec) + row := q.db.QueryRowContext(ctx, selectByCdecSQL, cdec) var id int64 err := row.Scan(&id) return id, err } -const selectByCdecimal = `-- name: SelectByCdecimal :one +const selectByCdecimalSQL = `-- name: SelectByCdecimal :one SELECT id FROM debug WHERE Cdecimal = ? LIMIT 1 ` func (q *Queries) SelectByCdecimal(ctx context.Context, cdecimal string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdecimal, cdecimal) + row := q.db.QueryRowContext(ctx, selectByCdecimalSQL, cdecimal) var id int64 err := row.Scan(&id) return id, err } -const selectByCdouble = `-- name: SelectByCdouble :one +const selectByCdoubleSQL = `-- name: SelectByCdouble :one SELECT id FROM debug WHERE Cdouble = ? LIMIT 1 ` func (q *Queries) SelectByCdouble(ctx context.Context, cdouble float64) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdouble, cdouble) + row := q.db.QueryRowContext(ctx, selectByCdoubleSQL, cdouble) var id int64 err := row.Scan(&id) return id, err } -const selectByCdoubleprecision = `-- name: SelectByCdoubleprecision :one +const selectByCdoubleprecisionSQL = `-- name: SelectByCdoubleprecision :one SELECT id FROM debug WHERE Cdoubleprecision = ? LIMIT 1 ` func (q *Queries) SelectByCdoubleprecision(ctx context.Context, cdoubleprecision float64) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCdoubleprecision, cdoubleprecision) + row := q.db.QueryRowContext(ctx, selectByCdoubleprecisionSQL, cdoubleprecision) var id int64 err := row.Scan(&id) return id, err } -const selectByCenum = `-- name: SelectByCenum :one +const selectByCenumSQL = `-- name: SelectByCenum :one SELECT id FROM debug WHERE Cenum = ? LIMIT 1 ` func (q *Queries) SelectByCenum(ctx context.Context, cenum NullDebugCenum) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCenum, cenum) + row := q.db.QueryRowContext(ctx, selectByCenumSQL, cenum) var id int64 err := row.Scan(&id) return id, err } -const selectByCfixed = `-- name: SelectByCfixed :one +const selectByCfixedSQL = `-- name: SelectByCfixed :one SELECT id FROM debug WHERE Cfixed = ? LIMIT 1 ` func (q *Queries) SelectByCfixed(ctx context.Context, cfixed string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCfixed, cfixed) + row := q.db.QueryRowContext(ctx, selectByCfixedSQL, cfixed) var id int64 err := row.Scan(&id) return id, err } -const selectByCfloat = `-- name: SelectByCfloat :one +const selectByCfloatSQL = `-- name: SelectByCfloat :one SELECT id FROM debug WHERE Cfloat = ? LIMIT 1 ` func (q *Queries) SelectByCfloat(ctx context.Context, cfloat float64) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCfloat, cfloat) + row := q.db.QueryRowContext(ctx, selectByCfloatSQL, cfloat) var id int64 err := row.Scan(&id) return id, err } -const selectByCint = `-- name: SelectByCint :one +const selectByCintSQL = `-- name: SelectByCint :one SELECT id FROM debug WHERE Cint = ? LIMIT 1 ` func (q *Queries) SelectByCint(ctx context.Context, cint int32) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCint, cint) + row := q.db.QueryRowContext(ctx, selectByCintSQL, cint) var id int64 err := row.Scan(&id) return id, err } -const selectByCinteger = `-- name: SelectByCinteger :one +const selectByCintegerSQL = `-- name: SelectByCinteger :one SELECT id FROM debug WHERE Cinteger = ? LIMIT 1 ` func (q *Queries) SelectByCinteger(ctx context.Context, cinteger int32) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCinteger, cinteger) + row := q.db.QueryRowContext(ctx, selectByCintegerSQL, cinteger) var id int64 err := row.Scan(&id) return id, err } -const selectByCjson = `-- name: SelectByCjson :one +const selectByCjsonSQL = `-- name: SelectByCjson :one SELECT id FROM debug WHERE Cjson = ? LIMIT 1 ` func (q *Queries) SelectByCjson(ctx context.Context, cjson json.RawMessage) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCjson, cjson) + row := q.db.QueryRowContext(ctx, selectByCjsonSQL, cjson) var id int64 err := row.Scan(&id) return id, err } -const selectByClongblob = `-- name: SelectByClongblob :one +const selectByClongblobSQL = `-- name: SelectByClongblob :one SELECT id FROM debug WHERE Clongblob = ? LIMIT 1 ` func (q *Queries) SelectByClongblob(ctx context.Context, clongblob []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByClongblob, clongblob) + row := q.db.QueryRowContext(ctx, selectByClongblobSQL, clongblob) var id int64 err := row.Scan(&id) return id, err } -const selectByClongtext = `-- name: SelectByClongtext :one +const selectByClongtextSQL = `-- name: SelectByClongtext :one SELECT id FROM debug WHERE Clongtext = ? LIMIT 1 ` func (q *Queries) SelectByClongtext(ctx context.Context, clongtext string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByClongtext, clongtext) + row := q.db.QueryRowContext(ctx, selectByClongtextSQL, clongtext) var id int64 err := row.Scan(&id) return id, err } -const selectByCmediumblob = `-- name: SelectByCmediumblob :one +const selectByCmediumblobSQL = `-- name: SelectByCmediumblob :one SELECT id FROM debug WHERE Cmediumblob = ? LIMIT 1 ` func (q *Queries) SelectByCmediumblob(ctx context.Context, cmediumblob []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCmediumblob, cmediumblob) + row := q.db.QueryRowContext(ctx, selectByCmediumblobSQL, cmediumblob) var id int64 err := row.Scan(&id) return id, err } -const selectByCmediumint = `-- name: SelectByCmediumint :one +const selectByCmediumintSQL = `-- name: SelectByCmediumint :one SELECT id FROM debug WHERE Cmediumint = ? LIMIT 1 ` func (q *Queries) SelectByCmediumint(ctx context.Context, cmediumint int32) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCmediumint, cmediumint) + row := q.db.QueryRowContext(ctx, selectByCmediumintSQL, cmediumint) var id int64 err := row.Scan(&id) return id, err } -const selectByCmediumtext = `-- name: SelectByCmediumtext :one +const selectByCmediumtextSQL = `-- name: SelectByCmediumtext :one SELECT id FROM debug WHERE Cmediumtext = ? LIMIT 1 ` func (q *Queries) SelectByCmediumtext(ctx context.Context, cmediumtext string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCmediumtext, cmediumtext) + row := q.db.QueryRowContext(ctx, selectByCmediumtextSQL, cmediumtext) var id int64 err := row.Scan(&id) return id, err } -const selectByCnumeric = `-- name: SelectByCnumeric :one +const selectByCnumericSQL = `-- name: SelectByCnumeric :one SELECT id FROM debug WHERE Cnumeric = ? LIMIT 1 ` func (q *Queries) SelectByCnumeric(ctx context.Context, cnumeric string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCnumeric, cnumeric) + row := q.db.QueryRowContext(ctx, selectByCnumericSQL, cnumeric) var id int64 err := row.Scan(&id) return id, err } -const selectByCreal = `-- name: SelectByCreal :one +const selectByCrealSQL = `-- name: SelectByCreal :one SELECT id FROM debug WHERE Creal = ? LIMIT 1 ` func (q *Queries) SelectByCreal(ctx context.Context, creal float64) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCreal, creal) + row := q.db.QueryRowContext(ctx, selectByCrealSQL, creal) var id int64 err := row.Scan(&id) return id, err } -const selectByCset = `-- name: SelectByCset :one +const selectByCsetSQL = `-- name: SelectByCset :one SELECT id FROM debug WHERE Cset = ? LIMIT 1 ` func (q *Queries) SelectByCset(ctx context.Context, cset DebugCset) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCset, cset) + row := q.db.QueryRowContext(ctx, selectByCsetSQL, cset) var id int64 err := row.Scan(&id) return id, err } -const selectByCsmallint = `-- name: SelectByCsmallint :one +const selectByCsmallintSQL = `-- name: SelectByCsmallint :one SELECT id FROM debug WHERE Csmallint = ? LIMIT 1 ` func (q *Queries) SelectByCsmallint(ctx context.Context, csmallint int16) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCsmallint, csmallint) + row := q.db.QueryRowContext(ctx, selectByCsmallintSQL, csmallint) var id int64 err := row.Scan(&id) return id, err } -const selectByCtext = `-- name: SelectByCtext :one +const selectByCtextSQL = `-- name: SelectByCtext :one SELECT id FROM debug WHERE Ctext = ? LIMIT 1 ` func (q *Queries) SelectByCtext(ctx context.Context, ctext string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtext, ctext) + row := q.db.QueryRowContext(ctx, selectByCtextSQL, ctext) var id int64 err := row.Scan(&id) return id, err } -const selectByCtime = `-- name: SelectByCtime :one +const selectByCtimeSQL = `-- name: SelectByCtime :one SELECT id FROM debug WHERE Ctime = ? LIMIT 1 ` func (q *Queries) SelectByCtime(ctx context.Context, ctime time.Time) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtime, ctime) + row := q.db.QueryRowContext(ctx, selectByCtimeSQL, ctime) var id int64 err := row.Scan(&id) return id, err } -const selectByCtimestamp = `-- name: SelectByCtimestamp :one +const selectByCtimestampSQL = `-- name: SelectByCtimestamp :one SELECT id FROM debug WHERE Ctimestamp = ? LIMIT 1 ` func (q *Queries) SelectByCtimestamp(ctx context.Context, ctimestamp time.Time) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtimestamp, ctimestamp) + row := q.db.QueryRowContext(ctx, selectByCtimestampSQL, ctimestamp) var id int64 err := row.Scan(&id) return id, err } -const selectByCtinyblob = `-- name: SelectByCtinyblob :one +const selectByCtinyblobSQL = `-- name: SelectByCtinyblob :one SELECT id FROM debug WHERE Ctinyblob = ? LIMIT 1 ` func (q *Queries) SelectByCtinyblob(ctx context.Context, ctinyblob []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtinyblob, ctinyblob) + row := q.db.QueryRowContext(ctx, selectByCtinyblobSQL, ctinyblob) var id int64 err := row.Scan(&id) return id, err } -const selectByCtinyint = `-- name: SelectByCtinyint :one +const selectByCtinyintSQL = `-- name: SelectByCtinyint :one SELECT id FROM debug WHERE Ctinyint = ? LIMIT 1 ` func (q *Queries) SelectByCtinyint(ctx context.Context, ctinyint int8) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtinyint, ctinyint) + row := q.db.QueryRowContext(ctx, selectByCtinyintSQL, ctinyint) var id int64 err := row.Scan(&id) return id, err } -const selectByCtinytext = `-- name: SelectByCtinytext :one +const selectByCtinytextSQL = `-- name: SelectByCtinytext :one SELECT id FROM debug WHERE Ctinytext = ? LIMIT 1 ` func (q *Queries) SelectByCtinytext(ctx context.Context, ctinytext string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCtinytext, ctinytext) + row := q.db.QueryRowContext(ctx, selectByCtinytextSQL, ctinytext) var id int64 err := row.Scan(&id) return id, err } -const selectByCvarbinary = `-- name: SelectByCvarbinary :one +const selectByCvarbinarySQL = `-- name: SelectByCvarbinary :one SELECT id FROM debug WHERE Cvarbinary = ? LIMIT 1 ` func (q *Queries) SelectByCvarbinary(ctx context.Context, cvarbinary []byte) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCvarbinary, cvarbinary) + row := q.db.QueryRowContext(ctx, selectByCvarbinarySQL, cvarbinary) var id int64 err := row.Scan(&id) return id, err } -const selectByCvarchar = `-- name: SelectByCvarchar :one +const selectByCvarcharSQL = `-- name: SelectByCvarchar :one SELECT id FROM debug WHERE Cvarchar = ? LIMIT 1 ` func (q *Queries) SelectByCvarchar(ctx context.Context, cvarchar string) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCvarchar, cvarchar) + row := q.db.QueryRowContext(ctx, selectByCvarcharSQL, cvarchar) var id int64 err := row.Scan(&id) return id, err } -const selectByCyear = `-- name: SelectByCyear :one +const selectByCyearSQL = `-- name: SelectByCyear :one SELECT id FROM debug WHERE Cyear = ? LIMIT 1 ` func (q *Queries) SelectByCyear(ctx context.Context, cyear int16) (int64, error) { - row := q.db.QueryRowContext(ctx, selectByCyear, cyear) + row := q.db.QueryRowContext(ctx, selectByCyearSQL, cyear) var id int64 err := row.Scan(&id) return id, err } -const selectById = `-- name: SelectById :one +const selectByIdSQL = `-- name: SelectById :one SELECT id FROM debug WHERE id = ? LIMIT 1 ` func (q *Queries) SelectById(ctx context.Context, id int64) (int64, error) { - row := q.db.QueryRowContext(ctx, selectById, id) + row := q.db.QueryRowContext(ctx, selectByIdSQL, id) var id_2 int64 err := row.Scan(&id_2) return id_2, err diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go index b042473394..f95e80d478 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go @@ -9,16 +9,16 @@ import ( "context" ) -const deleteTblFt = `-- name: DeleteTblFt :exec +const deleteTblFtSQL = `-- name: DeleteTblFt :exec DELETE FROM tbl_ft WHERE b = ? ` func (q *Queries) DeleteTblFt(ctx context.Context, b string) error { - _, err := q.db.ExecContext(ctx, deleteTblFt, b) + _, err := q.db.ExecContext(ctx, deleteTblFtSQL, b) return err } -const insertTblFt = `-- name: InsertTblFt :exec +const insertTblFtSQL = `-- name: InsertTblFt :exec INSERT INTO tbl_ft (b, c) VALUES (?, ?) ` @@ -28,18 +28,18 @@ type InsertTblFtParams struct { } func (q *Queries) InsertTblFt(ctx context.Context, arg InsertTblFtParams) error { - _, err := q.db.ExecContext(ctx, insertTblFt, arg.B, arg.C) + _, err := q.db.ExecContext(ctx, insertTblFtSQL, arg.B, arg.C) return err } -const selectAllColsFt = `-- name: SelectAllColsFt :many +const selectAllColsFtSQL = `-- name: SelectAllColsFt :many SELECT b FROM ft WHERE b MATCH ? ` func (q *Queries) SelectAllColsFt(ctx context.Context, b string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, selectAllColsFt, b) + rows, err := q.db.QueryContext(ctx, selectAllColsFtSQL, b) if err != nil { return nil, err } @@ -61,14 +61,14 @@ func (q *Queries) SelectAllColsFt(ctx context.Context, b string) ([]string, erro return items, nil } -const selectAllColsTblFt = `-- name: SelectAllColsTblFt :many +const selectAllColsTblFtSQL = `-- name: SelectAllColsTblFt :many SELECT b, c FROM tbl_ft WHERE b MATCH ? ` func (q *Queries) SelectAllColsTblFt(ctx context.Context, b string) ([]TblFt, error) { - rows, err := q.db.QueryContext(ctx, selectAllColsTblFt, b) + rows, err := q.db.QueryContext(ctx, selectAllColsTblFtSQL, b) if err != nil { return nil, err } @@ -90,7 +90,7 @@ func (q *Queries) SelectAllColsTblFt(ctx context.Context, b string) ([]TblFt, er return items, nil } -const selectBm25Func = `-- name: SelectBm25Func :many +const selectBm25FuncSQL = `-- name: SelectBm25Func :many SELECT b, c, bm25(tbl_ft, 2.0) FROM tbl_ft WHERE b MATCH ? @@ -104,7 +104,7 @@ type SelectBm25FuncRow struct { } func (q *Queries) SelectBm25Func(ctx context.Context, b string) ([]SelectBm25FuncRow, error) { - rows, err := q.db.QueryContext(ctx, selectBm25Func, b) + rows, err := q.db.QueryContext(ctx, selectBm25FuncSQL, b) if err != nil { return nil, err } @@ -126,14 +126,14 @@ func (q *Queries) SelectBm25Func(ctx context.Context, b string) ([]SelectBm25Fun return items, nil } -const selectHightlighFunc = `-- name: SelectHightlighFunc :many +const selectHightlighFuncSQL = `-- name: SelectHightlighFunc :many SELECT highlight(tbl_ft, 0, '', '') FROM tbl_ft WHERE b MATCH ? ` func (q *Queries) SelectHightlighFunc(ctx context.Context, b string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, selectHightlighFunc, b) + rows, err := q.db.QueryContext(ctx, selectHightlighFuncSQL, b) if err != nil { return nil, err } @@ -155,14 +155,14 @@ func (q *Queries) SelectHightlighFunc(ctx context.Context, b string) ([]string, return items, nil } -const selectOneColFt = `-- name: SelectOneColFt :many +const selectOneColFtSQL = `-- name: SelectOneColFt :many SELECT b FROM ft WHERE b = ? ` func (q *Queries) SelectOneColFt(ctx context.Context, b string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, selectOneColFt, b) + rows, err := q.db.QueryContext(ctx, selectOneColFtSQL, b) if err != nil { return nil, err } @@ -184,14 +184,14 @@ func (q *Queries) SelectOneColFt(ctx context.Context, b string) ([]string, error return items, nil } -const selectOneColTblFt = `-- name: SelectOneColTblFt :many +const selectOneColTblFtSQL = `-- name: SelectOneColTblFt :many SELECT c FROM tbl_ft WHERE b = ? ` func (q *Queries) SelectOneColTblFt(ctx context.Context, b string) ([]string, error) { - rows, err := q.db.QueryContext(ctx, selectOneColTblFt, b) + rows, err := q.db.QueryContext(ctx, selectOneColTblFtSQL, b) if err != nil { return nil, err } @@ -213,12 +213,12 @@ func (q *Queries) SelectOneColTblFt(ctx context.Context, b string) ([]string, er return items, nil } -const selectSnippetFunc = `-- name: SelectSnippetFunc :many +const selectSnippetFuncSQL = `-- name: SelectSnippetFunc :many SELECT snippet(tbl_ft, 0, '', '', 'aa', ?) FROM tbl_ft ` func (q *Queries) SelectSnippetFunc(ctx context.Context, snippet int64) ([]string, error) { - rows, err := q.db.QueryContext(ctx, selectSnippetFunc, snippet) + rows, err := q.db.QueryContext(ctx, selectSnippetFuncSQL, snippet) if err != nil { return nil, err } @@ -240,7 +240,7 @@ func (q *Queries) SelectSnippetFunc(ctx context.Context, snippet int64) ([]strin return items, nil } -const updateTblFt = `-- name: UpdateTblFt :exec +const updateTblFtSQL = `-- name: UpdateTblFt :exec UPDATE tbl_ft SET c = ? WHERE b = ? ` @@ -250,6 +250,6 @@ type UpdateTblFtParams struct { } func (q *Queries) UpdateTblFt(ctx context.Context, arg UpdateTblFtParams) error { - _, err := q.db.ExecContext(ctx, updateTblFt, arg.C, arg.B) + _, err := q.db.ExecContext(ctx, updateTblFtSQL, arg.C, arg.B) return err } diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go index 7fe6d32f15..33e9926d75 100644 --- a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const searchRecipes = `-- name: SearchRecipes :many +const searchRecipesSQL = `-- name: SearchRecipes :many SELECT rowid, name FROM recipes_fts WHERE recipes_fts MATCH ? @@ -22,7 +22,7 @@ type SearchRecipesRow struct { } func (q *Queries) SearchRecipes(ctx context.Context, recipesFts string) ([]SearchRecipesRow, error) { - rows, err := q.db.QueryContext(ctx, searchRecipes, recipesFts) + rows, err := q.db.QueryContext(ctx, searchRecipesSQL, recipesFts) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (q *Queries) SearchRecipes(ctx context.Context, recipesFts string) ([]Searc return items, nil } -const searchRecipesRanked = `-- name: SearchRecipesRanked :many +const searchRecipesRankedSQL = `-- name: SearchRecipesRanked :many SELECT rowid, name, rank FROM recipes_fts WHERE recipes_fts MATCH ? @@ -58,7 +58,7 @@ type SearchRecipesRankedRow struct { } func (q *Queries) SearchRecipesRanked(ctx context.Context, recipesFts string) ([]SearchRecipesRankedRow, error) { - rows, err := q.db.QueryContext(ctx, searchRecipesRanked, recipesFts) + rows, err := q.db.QueryContext(ctx, searchRecipesRankedSQL, recipesFts) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go index 1f40224e16..7b7daa6493 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go @@ -9,7 +9,7 @@ import ( "context" ) -const getAccountByName = `-- name: GetAccountByName :one +const getAccountByNameSQL = `-- name: GetAccountByName :one SELECT id, name FROM accounts WHERE name = ? COLLATE nocase @@ -17,7 +17,7 @@ LIMIT 1 ` func (q *Queries) GetAccountByName(ctx context.Context, name string) (Account, error) { - row := q.db.QueryRowContext(ctx, getAccountByName, name) + row := q.db.QueryRowContext(ctx, getAccountByNameSQL, name) var i Account err := row.Scan(&i.ID, &i.Name) return i, err diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go index cd9e3a04c9..a631daec08 100644 --- a/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go @@ -11,7 +11,7 @@ import ( "fmt" ) -const createAuthor = `-- name: CreateAuthor :execlastid +const createAuthorSQL = `-- name: CreateAuthor :execlastid INSERT INTO authors ( name, bio ) VALUES ( @@ -20,72 +20,72 @@ INSERT INTO authors ( ` func (q *Queries) CreateAuthor(ctx context.Context) (int64, error) { - result, err := q.db.ExecContext(ctx, createAuthor) + result, err := q.db.ExecContext(ctx, createAuthorSQL) if err != nil { return 0, fmt.Errorf("query CreateAuthor: %w", err) } return result.LastInsertId() } -const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +const deleteAuthorExecSQL = `-- name: DeleteAuthorExec :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExec(ctx context.Context) error { - _, err := q.db.ExecContext(ctx, deleteAuthorExec) + _, err := q.db.ExecContext(ctx, deleteAuthorExecSQL) if err != nil { err = fmt.Errorf("query DeleteAuthorExec: %w", err) } return err } -const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +const deleteAuthorExecLastIDSQL = `-- name: DeleteAuthorExecLastID :execlastid DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecLastID(ctx context.Context) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID) + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastIDSQL) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) } return result.LastInsertId() } -const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +const deleteAuthorExecResultSQL = `-- name: DeleteAuthorExecResult :execresult DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecResult(ctx context.Context) (sql.Result, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecResult) + result, err := q.db.ExecContext(ctx, deleteAuthorExecResultSQL) if err != nil { err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) } return result, err } -const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +const deleteAuthorExecRowsSQL = `-- name: DeleteAuthorExecRows :execrows DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecRows(ctx context.Context) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecRows) + result, err := q.db.ExecContext(ctx, deleteAuthorExecRowsSQL) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) } return result.RowsAffected() } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor) + row := q.db.QueryRowContext(ctx, getAuthorSQL) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -94,13 +94,13 @@ func (q *Queries) GetAuthor(ctx context.Context) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, fmt.Errorf("query ListAuthors: %w", err) } diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go index e11566eb17..d740a05eee 100644 --- a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go @@ -13,7 +13,7 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -28,7 +28,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -37,57 +37,57 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut return i, err } -const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +const deleteAuthorExecSQL = `-- name: DeleteAuthorExec :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { - _, err := q.db.Exec(ctx, deleteAuthorExec, id) + _, err := q.db.Exec(ctx, deleteAuthorExecSQL, id) if err != nil { return fmt.Errorf("query DeleteAuthorExec: %w", err) } return nil } -const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +const deleteAuthorExecLastIDSQL = `-- name: DeleteAuthorExecLastID :execlastid DELETE FROM authors WHERE id = $1 ` -const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +const deleteAuthorExecResultSQL = `-- name: DeleteAuthorExecResult :execresult DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (pgconn.CommandTag, error) { - result, err := q.db.Exec(ctx, deleteAuthorExecResult, id) + result, err := q.db.Exec(ctx, deleteAuthorExecResultSQL, id) if err != nil { err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) } return result, err } -const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +const deleteAuthorExecRowsSQL = `-- name: DeleteAuthorExecRows :execrows DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { - result, err := q.db.Exec(ctx, deleteAuthorExecRows, id) + result, err := q.db.Exec(ctx, deleteAuthorExecRowsSQL, id) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) } return result.RowsAffected(), nil } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRow(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -96,13 +96,13 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.Query(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthorsSQL) if err != nil { return nil, fmt.Errorf("query ListAuthors: %w", err) } diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go index b954a613a8..3eebbab950 100644 --- a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go @@ -11,7 +11,7 @@ import ( "fmt" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -26,7 +26,7 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -35,65 +35,65 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut return i, err } -const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +const deleteAuthorExecSQL = `-- name: DeleteAuthorExec :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + _, err := q.db.ExecContext(ctx, deleteAuthorExecSQL, id) if err != nil { err = fmt.Errorf("query DeleteAuthorExec: %w", err) } return err } -const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +const deleteAuthorExecLastIDSQL = `-- name: DeleteAuthorExecLastID :execlastid DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastIDSQL, id) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) } return result.LastInsertId() } -const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +const deleteAuthorExecResultSQL = `-- name: DeleteAuthorExecResult :execresult DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecResultSQL, id) if err != nil { err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) } return result, err } -const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +const deleteAuthorExecRowsSQL = `-- name: DeleteAuthorExecRows :execrows DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecRowsSQL, id) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) } return result.RowsAffected() } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -102,13 +102,13 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, fmt.Errorf("query ListAuthors: %w", err) } diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go index 11b72d8491..4b926f5dd2 100644 --- a/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go @@ -11,7 +11,7 @@ import ( "fmt" ) -const createAuthor = `-- name: CreateAuthor :execlastid +const createAuthorSQL = `-- name: CreateAuthor :execlastid INSERT INTO authors ( name, bio ) VALUES ( @@ -25,72 +25,72 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (int64, error) { - result, err := q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + result, err := q.db.ExecContext(ctx, createAuthorSQL, arg.Name, arg.Bio) if err != nil { return 0, fmt.Errorf("query CreateAuthor: %w", err) } return result.LastInsertId() } -const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +const deleteAuthorExecSQL = `-- name: DeleteAuthorExec :exec DELETE FROM authors WHERE id = ?1 ` func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + _, err := q.db.ExecContext(ctx, deleteAuthorExecSQL, id) if err != nil { err = fmt.Errorf("query DeleteAuthorExec: %w", err) } return err } -const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +const deleteAuthorExecLastIDSQL = `-- name: DeleteAuthorExecLastID :execlastid DELETE FROM authors WHERE id = ?1 ` func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastIDSQL, id) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) } return result.LastInsertId() } -const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +const deleteAuthorExecResultSQL = `-- name: DeleteAuthorExecResult :execresult DELETE FROM authors WHERE id = ?1 ` func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecResultSQL, id) if err != nil { err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) } return result, err } -const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +const deleteAuthorExecRowsSQL = `-- name: DeleteAuthorExecRows :execrows DELETE FROM authors WHERE id = ?1 ` func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { - result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + result, err := q.db.ExecContext(ctx, deleteAuthorExecRowsSQL, id) if err != nil { return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) } return result.RowsAffected() } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, name, bio FROM authors WHERE id = ?1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) if err != nil { @@ -99,13 +99,13 @@ func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, name, bio FROM authors ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, fmt.Errorf("query ListAuthors: %w", err) } diff --git a/internal/endtoend/testdata/yaml_overrides/go/query.sql.go b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go index 0a94a438a6..fc61877415 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/query.sql.go +++ b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go @@ -9,12 +9,12 @@ import ( "context" ) -const test = `-- name: Test :one +const testSQL = `-- name: Test :one SELECT 1 ` func (q *Queries) Test(ctx context.Context) (int32, error) { - row := q.db.QueryRowContext(ctx, test) + row := q.db.QueryRowContext(ctx, testSQL) var column_1 int32 err := row.Scan(&column_1) return column_1, err From 18b2ceb0e57e3c60afb16dfeed8be2e9112d05a4 Mon Sep 17 00:00:00 2001 From: Robson Roberto Souza Peixoto Date: Tue, 24 Nov 2026 19:38:59 -0300 Subject: [PATCH 2/2] docs: use the SQL-suffixed query constants in examples --- docs/howto/delete.md | 4 ++-- docs/howto/insert.md | 12 ++++++------ docs/howto/prepared_query.md | 6 +++--- docs/howto/query_count.md | 8 ++++---- docs/howto/select.md | 24 ++++++++++++------------ docs/howto/update.md | 8 ++++---- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/howto/delete.md b/docs/howto/delete.md index 4dc0d61694..7fc868bb71 100644 --- a/docs/howto/delete.md +++ b/docs/howto/delete.md @@ -41,12 +41,12 @@ type Queries struct { db DBTX } -const deleteAuthor = `-- name: DeleteAuthor :exec +const deleteAuthorSQL = `-- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.ExecContext(ctx, deleteAuthorSQL, id) return err } ``` diff --git a/docs/howto/insert.md b/docs/howto/insert.md index 1129a46810..6f97b2569a 100644 --- a/docs/howto/insert.md +++ b/docs/howto/insert.md @@ -41,12 +41,12 @@ type Queries struct { db DBTX } -const createAuthor = `-- name: CreateAuthor :exec +const createAuthorSQL = `-- name: CreateAuthor :exec INSERT INTO authors (bio) VALUES ($1) ` func (q *Queries) CreateAuthor(ctx context.Context, bio string) error { - _, err := q.db.ExecContext(ctx, createAuthor, bio) + _, err := q.db.ExecContext(ctx, createAuthorSQL, bio) return err } ``` @@ -112,7 +112,7 @@ import ( "database/sql" ) -const createAuthor = `-- name: CreateAuthor :one +const createAuthorSQL = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio ) VALUES ( @@ -127,13 +127,13 @@ type CreateAuthorParams struct { } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorSQL, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err } -const createAuthorAndReturnId = `-- name: CreateAuthorAndReturnId :one +const createAuthorAndReturnIdSQL = `-- name: CreateAuthorAndReturnId :one INSERT INTO authors ( name, bio ) VALUES ( @@ -148,7 +148,7 @@ type CreateAuthorAndReturnIdParams struct { } func (q *Queries) CreateAuthorAndReturnId(ctx context.Context, arg CreateAuthorAndReturnIdParams) (int64, error) { - row := q.db.QueryRowContext(ctx, createAuthorAndReturnId, arg.Name, arg.Bio) + row := q.db.QueryRowContext(ctx, createAuthorAndReturnIdSQL, arg.Name, arg.Bio) var id int64 err := row.Scan(&id) return id, err diff --git a/docs/howto/prepared_query.md b/docs/howto/prepared_query.md index 83e62b5929..cfb5b98495 100644 --- a/docs/howto/prepared_query.md +++ b/docs/howto/prepared_query.md @@ -45,7 +45,7 @@ func New(db DBTX) *Queries { func Prepare(ctx context.Context, db DBTX) (*Queries, error) { q := Queries{db: db} var err error - if q.getRecordStmt, err = db.PrepareContext(ctx, getRecord); err != nil { + if q.getRecordStmt, err = db.PrepareContext(ctx, getRecordSQL); err != nil { return nil, fmt.Errorf("error preparing query GetRecord: %w", err) } return &q, nil @@ -76,13 +76,13 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries { } } -const getRecord = `-- name: GetRecord :one +const getRecordSQL = `-- name: GetRecord :one SELECT id FROM records WHERE id = $1 ` func (q *Queries) GetRecord(ctx context.Context, id int32) (int32, error) { - row := q.queryRow(ctx, q.getRecordStmt, getRecord, id) + row := q.queryRow(ctx, q.getRecordStmt, getRecordSQL, id) err := row.Scan(&id) return id, err } diff --git a/docs/howto/query_count.md b/docs/howto/query_count.md index 687d98a9c2..20315cbbb9 100644 --- a/docs/howto/query_count.md +++ b/docs/howto/query_count.md @@ -36,18 +36,18 @@ type Queries struct { db DBTX } -const countAuthors = `-- name: CountAuthors :one +const countAuthorsSQL = `-- name: CountAuthors :one SELECT count(*) FROM authors ` func (q *Queries) CountAuthors(ctx context.Context) (int, error) { - row := q.db.QueryRowContext(ctx, countAuthors) + row := q.db.QueryRowContext(ctx, countAuthorsSQL) var i int err := row.Scan(&i) return i, err } -const countAuthorsByTown = `-- name: CountAuthorsByTown :many +const countAuthorsByTownSQL = `-- name: CountAuthorsByTown :many SELECT hometown, count(*) FROM authors GROUP BY 1 ORDER BY 1 @@ -59,7 +59,7 @@ type CountAuthorsByTownRow struct { } func (q *Queries) CountAuthorsByTown(ctx context.Context) ([]CountAuthorsByTownRow, error) { - rows, err := q.db.QueryContext(ctx, countAuthorsByTown) + rows, err := q.db.QueryContext(ctx, countAuthorsByTownSQL) if err != nil { return nil, err } diff --git a/docs/howto/select.md b/docs/howto/select.md index 998a1348f8..d749fa52f1 100644 --- a/docs/howto/select.md +++ b/docs/howto/select.md @@ -81,25 +81,25 @@ type Queries struct { db DBTX } -const getAuthor = `-- name: GetAuthor :one +const getAuthorSQL = `-- name: GetAuthor :one SELECT id, bio, birth_year FROM authors WHERE id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, id int) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRowContext(ctx, getAuthorSQL, id) var i Author err := row.Scan(&i.ID, &i.Bio, &i.BirthYear) return i, err } -const listAuthors = `-- name: ListAuthors :many +const listAuthorsSQL = `-- name: ListAuthors :many SELECT id, bio, birth_year FROM authors ORDER BY id ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL) if err != nil { return nil, err } @@ -172,19 +172,19 @@ type Queries struct { db DBTX } -const getBioForAuthor = `-- name: GetBioForAuthor :one +const getBioForAuthorSQL = `-- name: GetBioForAuthor :one SELECT bio FROM authors WHERE id = $1 ` func (q *Queries) GetBioForAuthor(ctx context.Context, id int) (string, error) { - row := q.db.QueryRowContext(ctx, getBioForAuthor, id) + row := q.db.QueryRowContext(ctx, getBioForAuthorSQL, id) var i string err := row.Scan(&i) return i, err } -const getInfoForAuthor = `-- name: GetInfoForAuthor :one +const getInfoForAuthorSQL = `-- name: GetInfoForAuthor :one SELECT bio, birth_year FROM authors WHERE id = $1 ` @@ -195,7 +195,7 @@ type GetInfoForAuthorRow struct { } func (q *Queries) GetInfoForAuthor(ctx context.Context, id int) (GetInfoForAuthorRow, error) { - row := q.db.QueryRowContext(ctx, getInfoForAuthor, id) + row := q.db.QueryRowContext(ctx, getInfoForAuthorSQL, id) var i GetInfoForAuthorRow err := row.Scan(&i.Bio, &i.BirthYear) return i, err @@ -255,13 +255,13 @@ type Queries struct { db DBTX } -const listAuthors = `-- name: ListAuthorsByIDs :many +const listAuthorsSQL = `-- name: ListAuthorsByIDs :many SELECT id, bio, birth_year FROM authors WHERE id = ANY($1::int[]) ` func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors, pq.Array(ids)) + rows, err := q.db.QueryContext(ctx, listAuthorsSQL, pq.Array(ids)) if err != nil { return nil, err } @@ -354,13 +354,13 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries { } } -const listAuthorsByIDs = `-- name: ListAuthorsByIDs :many +const listAuthorsByIDsSQL = `-- name: ListAuthorsByIDs :many SELECT id, bio, birth_year FROM authors WHERE id IN (/*SLICE:ids*/?) ` func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int64) ([]Author, error) { - sql := listAuthorsByIDs + sql := listAuthorsByIDsSQL var queryParams []any if len(ids) == 0 { return nil, fmt.Errorf("slice ids must have at least one element") diff --git a/docs/howto/update.md b/docs/howto/update.md index 52b4ac1150..2f26429d6d 100644 --- a/docs/howto/update.md +++ b/docs/howto/update.md @@ -46,12 +46,12 @@ type Queries struct { db DBTX } -const updateAuthorBios = `-- name: UpdateAuthorBios :exec +const updateAuthorBiosSQL = `-- name: UpdateAuthorBios :exec UPDATE authors SET bio = $1 ` func (q *Queries) UpdateAuthorBios(ctx context.Context, bio string) error { - _, err := q.db.ExecContext(ctx, updateAuthorBios, bio) + _, err := q.db.ExecContext(ctx, updateAuthorBiosSQL, bio) return err } ``` @@ -97,7 +97,7 @@ type Queries struct { db DBTX } -const updateAuthor = `-- name: UpdateAuthor :exec +const updateAuthorSQL = `-- name: UpdateAuthor :exec UPDATE authors SET bio = $2 WHERE id = $1 ` @@ -108,7 +108,7 @@ type UpdateAuthorParams struct { } func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error { - _, err := q.db.ExecContext(ctx, updateAuthor, arg.ID, arg.Bio) + _, err := q.db.ExecContext(ctx, updateAuthorSQL, arg.ID, arg.Bio) return err } ```