|
9 | 9 | "os" |
10 | 10 | "strings" |
11 | 11 |
|
| 12 | + "github.com/kyleconroy/sqlc/internal/pattern" |
12 | 13 | "github.com/kyleconroy/sqlc/internal/sql/ast" |
13 | 14 |
|
14 | 15 | yaml "gopkg.in/yaml.v3" |
@@ -169,10 +170,10 @@ type Override struct { |
169 | 170 | // fully qualified name of the column, e.g. `accounts.id` |
170 | 171 | Column string `json:"column" yaml:"column"` |
171 | 172 |
|
172 | | - ColumnName *Match |
173 | | - TableCatalog *Match |
174 | | - TableSchema *Match |
175 | | - TableRel *Match |
| 173 | + ColumnName *pattern.Match |
| 174 | + TableCatalog *pattern.Match |
| 175 | + TableSchema *pattern.Match |
| 176 | + TableRel *pattern.Match |
176 | 177 | GoImportPath string |
177 | 178 | GoPackage string |
178 | 179 | GoTypeName string |
@@ -242,36 +243,36 @@ func (o *Override) Parse() (err error) { |
242 | 243 | colParts := strings.Split(o.Column, ".") |
243 | 244 | switch len(colParts) { |
244 | 245 | case 2: |
245 | | - if o.ColumnName, err = MatchCompile(colParts[1]); err != nil { |
| 246 | + if o.ColumnName, err = pattern.MatchCompile(colParts[1]); err != nil { |
246 | 247 | return err |
247 | 248 | } |
248 | | - if o.TableRel, err = MatchCompile(colParts[0]); err != nil { |
| 249 | + if o.TableRel, err = pattern.MatchCompile(colParts[0]); err != nil { |
249 | 250 | return err |
250 | 251 | } |
251 | | - if o.TableSchema, err = MatchCompile("public"); err != nil { |
| 252 | + if o.TableSchema, err = pattern.MatchCompile("public"); err != nil { |
252 | 253 | return err |
253 | 254 | } |
254 | 255 | case 3: |
255 | | - if o.ColumnName, err = MatchCompile(colParts[2]); err != nil { |
| 256 | + if o.ColumnName, err = pattern.MatchCompile(colParts[2]); err != nil { |
256 | 257 | return err |
257 | 258 | } |
258 | | - if o.TableRel, err = MatchCompile(colParts[1]); err != nil { |
| 259 | + if o.TableRel, err = pattern.MatchCompile(colParts[1]); err != nil { |
259 | 260 | return err |
260 | 261 | } |
261 | | - if o.TableSchema, err = MatchCompile(colParts[0]); err != nil { |
| 262 | + if o.TableSchema, err = pattern.MatchCompile(colParts[0]); err != nil { |
262 | 263 | return err |
263 | 264 | } |
264 | 265 | case 4: |
265 | | - if o.ColumnName, err = MatchCompile(colParts[3]); err != nil { |
| 266 | + if o.ColumnName, err = pattern.MatchCompile(colParts[3]); err != nil { |
266 | 267 | return err |
267 | 268 | } |
268 | | - if o.TableRel, err = MatchCompile(colParts[2]); err != nil { |
| 269 | + if o.TableRel, err = pattern.MatchCompile(colParts[2]); err != nil { |
269 | 270 | return err |
270 | 271 | } |
271 | | - if o.TableSchema, err = MatchCompile(colParts[1]); err != nil { |
| 272 | + if o.TableSchema, err = pattern.MatchCompile(colParts[1]); err != nil { |
272 | 273 | return err |
273 | 274 | } |
274 | | - if o.TableCatalog, err = MatchCompile(colParts[0]); err != nil { |
| 275 | + if o.TableCatalog, err = pattern.MatchCompile(colParts[0]); err != nil { |
275 | 276 | return err |
276 | 277 | } |
277 | 278 | default: |
|
0 commit comments