@@ -7,13 +7,10 @@ import (
7
7
"io/ioutil"
8
8
"path/filepath"
9
9
"regexp"
10
- "sort"
11
10
"strings"
12
11
13
- "github.com/kyleconroy/sqlc/internal/codegen/golang"
14
12
"github.com/kyleconroy/sqlc/internal/migrations"
15
13
"github.com/kyleconroy/sqlc/internal/multierr"
16
- "github.com/kyleconroy/sqlc/internal/pg"
17
14
"github.com/kyleconroy/sqlc/internal/sql/ast"
18
15
"github.com/kyleconroy/sqlc/internal/sql/catalog"
19
16
"github.com/kyleconroy/sqlc/internal/sql/sqlerr"
@@ -141,57 +138,3 @@ func parseQueries(p Parser, c *catalog.Catalog, queries []string) (*Result, erro
141
138
Queries : q ,
142
139
}, nil
143
140
}
144
-
145
- // Deprecated.
146
- func buildResult (c * catalog.Catalog ) (* BuildResult , error ) {
147
- var structs []golang.Struct
148
- var enums []golang.Enum
149
- for _ , schema := range c .Schemas {
150
- for _ , table := range schema .Tables {
151
- s := golang.Struct {
152
- Table : pg.FQN {Schema : schema .Name , Rel : table .Rel .Name },
153
- Name : strings .Title (table .Rel .Name ),
154
- Comment : table .Comment ,
155
- }
156
- for _ , col := range table .Columns {
157
- s .Fields = append (s .Fields , golang.Field {
158
- Name : structName (col .Name ),
159
- Type : "string" ,
160
- Tags : map [string ]string {"json:" : col .Name },
161
- Comment : col .Comment ,
162
- })
163
- }
164
- structs = append (structs , s )
165
- }
166
- for _ , typ := range schema .Types {
167
- switch t := typ .(type ) {
168
- case * catalog.Enum :
169
- var name string
170
- if schema .Name == c .DefaultSchema {
171
- name = t .Name
172
- } else {
173
- name = schema .Name + "_" + t .Name
174
- }
175
- e := golang.Enum {
176
- Name : structName (name ),
177
- Comment : t .Comment ,
178
- }
179
- for _ , v := range t .Vals {
180
- e .Constants = append (e .Constants , golang.Constant {
181
- Name : e .Name + enumValueName (v ),
182
- Value : v ,
183
- Type : e .Name ,
184
- })
185
- }
186
- enums = append (enums , e )
187
- }
188
- }
189
- }
190
- if len (structs ) > 0 {
191
- sort .Slice (structs , func (i , j int ) bool { return structs [i ].Name < structs [j ].Name })
192
- }
193
- if len (enums ) > 0 {
194
- sort .Slice (enums , func (i , j int ) bool { return enums [i ].Name < enums [j ].Name })
195
- }
196
- return & BuildResult {structs : structs , enums : enums }, nil
197
- }
0 commit comments