@@ -16,7 +16,6 @@ import (
1616 "github.com/kyleconroy/sqlc/internal/config"
1717 "github.com/kyleconroy/sqlc/internal/debug"
1818 "github.com/kyleconroy/sqlc/internal/multierr"
19- "github.com/kyleconroy/sqlc/internal/mysql"
2019 "github.com/kyleconroy/sqlc/internal/opts"
2120)
2221
@@ -147,32 +146,22 @@ func Generate(e Env, dir string, stderr io.Writer) (map[string]string, error) {
147146 name = combo .Kotlin .Package
148147 }
149148
149+ result , errored := parse (e , name , dir , sql .SQL , combo , parseOpts , stderr )
150+ if errored {
151+ break
152+ }
153+
150154 var files map [string ]string
151155 var out string
152-
153- // TODO: Note about how this will be going away
154- if sql .Engine == config .EngineMySQL {
155- result , errored := parseMySQL (e , name , dir , sql .SQL , combo , parseOpts , stderr )
156- if errored {
157- break
158- }
156+ switch {
157+ case sql .Gen .Go != nil :
159158 out = combo .Go .Out
160- files , err = golang .DeprecatedGenerate (result , combo )
161- } else {
162- result , errored := parse (e , name , dir , sql .SQL , combo , parseOpts , stderr )
163- if errored {
164- break
165- }
166- switch {
167- case sql .Gen .Go != nil :
168- out = combo .Go .Out
169- files , err = golang .Generate (result , combo )
170- case sql .Gen .Kotlin != nil :
171- out = combo .Kotlin .Out
172- files , err = kotlin .Generate (result , combo )
173- default :
174- panic ("missing language backend" )
175- }
159+ files , err = golang .Generate (result , combo )
160+ case sql .Gen .Kotlin != nil :
161+ out = combo .Kotlin .Out
162+ files , err = kotlin .Generate (result , combo )
163+ default :
164+ panic ("missing language backend" )
176165 }
177166
178167 if err != nil {
@@ -193,23 +182,6 @@ func Generate(e Env, dir string, stderr io.Writer) (map[string]string, error) {
193182 return output , nil
194183}
195184
196- // Experimental MySQL support
197- func parseMySQL (e Env , name , dir string , sql config.SQL , combo config.CombinedSettings , parserOpts opts.Parser , stderr io.Writer ) (golang.Generateable , bool ) {
198- q , err := mysql .GeneratePkg (name , sql .Schema , sql .Queries , combo )
199- if err != nil {
200- fmt .Fprintf (stderr , "# package %s\n " , name )
201- if parserErr , ok := err .(* multierr.Error ); ok {
202- for _ , fileErr := range parserErr .Errs () {
203- printFileErr (stderr , dir , fileErr )
204- }
205- } else {
206- fmt .Fprintf (stderr , "error parsing schema: %s\n " , err )
207- }
208- return nil , true
209- }
210- return q , false
211- }
212-
213185func parse (e Env , name , dir string , sql config.SQL , combo config.CombinedSettings , parserOpts opts.Parser , stderr io.Writer ) (* compiler.Result , bool ) {
214186 c := compiler .NewCompiler (sql , combo )
215187 if err := c .ParseCatalog (sql .Schema ); err != nil {
0 commit comments