You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support a new configuration parameter `emit_methods_with_db_argument `that modifies the generated method sets to provide methods like shown in WidgetInserter. If set to true, the generated *Queries omits storing a DBTX as a struct field and requires it be passed in to all method calls. In doing so, it allows callers to easily provide the connection for standalone use or for use as part of a broader transaction and makes it easy for the surrounding code to use a narrowly defined interface.
Copy file name to clipboardExpand all lines: docs/reference/config.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ packages:
19
19
emit_json_tags: true
20
20
emit_result_struct_pointers: false
21
21
emit_params_struct_pointers: false
22
+
emit_methods_with_db_argument: false
22
23
json_tags_case_style: "camel"
23
24
output_db_file_name: "db.go"
24
25
output_models_file_name: "models.go"
@@ -57,6 +58,8 @@ Each package document has the following keys:
57
58
- If true, query results are returned as pointers to structs. Queries returning multiple results are returned as slices of pointers. Defaults to `false`.
58
59
- `emit_params_struct_pointers`:
59
60
- If true, parameters are passed as pointers to structs. Defaults to `false`.
61
+
- `emit_methods_with_db_argument`:
62
+
- If true, generated methods will accept a DBTX argument instead of storing a DBTX on the `*Queries` struct. Defaults to `false`.
60
63
- `json_tags_case_style`:
61
64
- `camel`for camelCase, `pascal` for PascalCase, `snake` for snake_case or `none` to use the column name in the DB. Defaults to `none`.
0 commit comments