@@ -14,14 +14,14 @@ import (
1414 "github.com/kyleconroy/sqlc/internal/codegen/golang"
1515 "github.com/kyleconroy/sqlc/internal/codegen/json"
1616 "github.com/kyleconroy/sqlc/internal/codegen/kotlin"
17- "github.com/kyleconroy/sqlc/internal/codegen/process"
1817 "github.com/kyleconroy/sqlc/internal/codegen/python"
1918 "github.com/kyleconroy/sqlc/internal/compiler"
2019 "github.com/kyleconroy/sqlc/internal/config"
2120 "github.com/kyleconroy/sqlc/internal/debug"
21+ "github.com/kyleconroy/sqlc/internal/ext"
22+ "github.com/kyleconroy/sqlc/internal/ext/process"
2223 "github.com/kyleconroy/sqlc/internal/multierr"
2324 "github.com/kyleconroy/sqlc/internal/opts"
24- "github.com/kyleconroy/sqlc/internal/plugin"
2525)
2626
2727const 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
220220 if debug .Traced {
221221 region = trace .StartRegion (ctx , "codegen" )
222222 }
223- var genfunc func ( req * plugin. CodeGenRequest ) ( * plugin. CodeGenResponse , error )
223+ var handler ext. Handler
224224 var out string
225225 switch {
226226 case sql .Gen .Go != nil :
227227 out = combo .Go .Out
228- genfunc = golang .Generate
228+ handler = ext . HandleFunc ( golang .Generate )
229229
230230 case sql .Gen .Kotlin != nil :
231231 out = combo .Kotlin .Out
232- genfunc = kotlin .Generate
232+ handler = ext . HandleFunc ( kotlin .Generate )
233233
234234 case sql .Gen .Python != nil :
235235 out = combo .Python .Out
236- genfunc = python .Generate
236+ handler = ext . HandleFunc ( python .Generate )
237237
238238 case sql .Gen .JSON != nil :
239239 out = combo .JSON .Out
240- genfunc = json .Generate
240+ handler = ext . HandleFunc ( json .Generate )
241241
242242 case sql .Plugin != nil :
243243 out = sql .Plugin .Out
244- runner := process.Runner {
244+ handler = & process.Runner {
245245 Config : combo .Global ,
246246 Plugin : sql .Plugin .Plugin ,
247247 }
248- genfunc = runner .Generate
249248
250249 default :
251250 panic ("missing language backend" )
252251 }
253- resp , err := genfunc (codeGenRequest (result , combo ))
252+ resp , err := handler . Generate (codeGenRequest (result , combo ))
254253 if region != nil {
255254 region .End ()
256255 }
0 commit comments