@@ -14,14 +14,14 @@ import (
14
14
"github.com/kyleconroy/sqlc/internal/codegen/golang"
15
15
"github.com/kyleconroy/sqlc/internal/codegen/json"
16
16
"github.com/kyleconroy/sqlc/internal/codegen/kotlin"
17
- "github.com/kyleconroy/sqlc/internal/codegen/process"
18
17
"github.com/kyleconroy/sqlc/internal/codegen/python"
19
18
"github.com/kyleconroy/sqlc/internal/compiler"
20
19
"github.com/kyleconroy/sqlc/internal/config"
21
20
"github.com/kyleconroy/sqlc/internal/debug"
21
+ "github.com/kyleconroy/sqlc/internal/ext"
22
+ "github.com/kyleconroy/sqlc/internal/ext/process"
22
23
"github.com/kyleconroy/sqlc/internal/multierr"
23
24
"github.com/kyleconroy/sqlc/internal/opts"
24
- "github.com/kyleconroy/sqlc/internal/plugin"
25
25
)
26
26
27
27
const errMessageNoVersion = `The configuration file must have a version number.
@@ -220,37 +220,36 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
220
220
if debug .Traced {
221
221
region = trace .StartRegion (ctx , "codegen" )
222
222
}
223
- var genfunc func ( req * plugin. CodeGenRequest ) ( * plugin. CodeGenResponse , error )
223
+ var handler ext. Handler
224
224
var out string
225
225
switch {
226
226
case sql .Gen .Go != nil :
227
227
out = combo .Go .Out
228
- genfunc = golang .Generate
228
+ handler = ext . HandleFunc ( golang .Generate )
229
229
230
230
case sql .Gen .Kotlin != nil :
231
231
out = combo .Kotlin .Out
232
- genfunc = kotlin .Generate
232
+ handler = ext . HandleFunc ( kotlin .Generate )
233
233
234
234
case sql .Gen .Python != nil :
235
235
out = combo .Python .Out
236
- genfunc = python .Generate
236
+ handler = ext . HandleFunc ( python .Generate )
237
237
238
238
case sql .Gen .JSON != nil :
239
239
out = combo .JSON .Out
240
- genfunc = json .Generate
240
+ handler = ext . HandleFunc ( json .Generate )
241
241
242
242
case sql .Plugin != nil :
243
243
out = sql .Plugin .Out
244
- runner := process.Runner {
244
+ handler = & process.Runner {
245
245
Config : combo .Global ,
246
246
Plugin : sql .Plugin .Plugin ,
247
247
}
248
- genfunc = runner .Generate
249
248
250
249
default :
251
250
panic ("missing language backend" )
252
251
}
253
- resp , err := genfunc (codeGenRequest (result , combo ))
252
+ resp , err := handler . Generate (codeGenRequest (result , combo ))
254
253
if region != nil {
255
254
region .End ()
256
255
}
0 commit comments