Commit 37d0206
committed
default models package, always import as
Two refinements on top of the initial #835 work:
1. output_models_package now defaults to filepath.Base(output_models_path)
when unset, matching how `package` defaults to base(out). When only
output_models_emit: false is configured (no path), it falls back to
filepath.Base(output_models_import).
2. Query files always import the models package under the alias `models`
and reference types as `models.User`, regardless of the actual package
name. This keeps generated query code readable without users having to
think about import aliases. The actual `package X` declaration in
models.go still uses the configured (or defaulted) package name.
https://claude.ai/code/session_01Nj4LbGbqFBTU1EPKKNHtNnmodels
1 parent 9610f6a commit 37d0206
8 files changed
Lines changed: 63 additions & 54 deletions
File tree
- internal
- codegen/golang
- opts
- endtoend/testdata
- output_models_path/postgresql
- db
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
| |||
186 | 202 | | |
187 | 203 | | |
188 | 204 | | |
189 | | - | |
| 205 | + | |
190 | 206 | | |
191 | | - | |
| 207 | + | |
192 | 208 | | |
193 | 209 | | |
194 | 210 | | |
195 | | - | |
| 211 | + | |
196 | 212 | | |
197 | 213 | | |
198 | 214 | | |
199 | | - | |
| 215 | + | |
200 | 216 | | |
201 | 217 | | |
202 | 218 | | |
| |||
219 | 235 | | |
220 | 236 | | |
221 | 237 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 238 | + | |
| 239 | + | |
228 | 240 | | |
229 | 241 | | |
230 | 242 | | |
| |||
Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
0 commit comments