(qc *QueryCatalog, raw *ast.RawStmt)
| 12 | ) |
| 13 | |
| 14 | func (c *Compiler) expand(qc *QueryCatalog, raw *ast.RawStmt) ([]source.Edit, error) { |
| 15 | // Return early if there are no A_Star nodes to expand |
| 16 | stars := astutils.Search(raw, func(node ast.Node) bool { |
| 17 | _, ok := node.(*ast.A_Star) |
| 18 | return ok |
| 19 | }) |
| 20 | if len(stars.Items) == 0 { |
| 21 | return nil, nil |
| 22 | } |
| 23 | list := astutils.Search(raw, func(node ast.Node) bool { |
| 24 | switch node.(type) { |
| 25 | case *ast.DeleteStmt: |
| 26 | case *ast.InsertStmt: |
| 27 | case *ast.SelectStmt: |
| 28 | case *ast.UpdateStmt: |
| 29 | default: |
| 30 | return false |
| 31 | } |
| 32 | return true |
| 33 | }) |
| 34 | if len(list.Items) == 0 { |
| 35 | return nil, nil |
| 36 | } |
| 37 | var edits []source.Edit |
| 38 | for _, item := range list.Items { |
| 39 | edit, err := c.expandStmt(qc, raw, item) |
| 40 | if err != nil { |
| 41 | return nil, err |
| 42 | } |
| 43 | edits = append(edits, edit...) |
| 44 | } |
| 45 | return edits, nil |
| 46 | } |
| 47 | |
| 48 | var validPostgresIdent = regexp.MustCompile(`^[a-z_][a-z0-9_$]*$`) |
| 49 |
no test coverage detected