(r *compiler.Result)
| 134 | } |
| 135 | |
| 136 | func pluginQueries(r *compiler.Result) []*plugin.Query { |
| 137 | var out []*plugin.Query |
| 138 | for _, q := range r.Queries { |
| 139 | var params []*plugin.Parameter |
| 140 | var columns []*plugin.Column |
| 141 | for _, c := range q.Columns { |
| 142 | columns = append(columns, pluginQueryColumn(c)) |
| 143 | } |
| 144 | for _, p := range q.Params { |
| 145 | params = append(params, pluginQueryParam(p)) |
| 146 | } |
| 147 | var iit *plugin.Identifier |
| 148 | if q.InsertIntoTable != nil { |
| 149 | iit = &plugin.Identifier{ |
| 150 | Catalog: q.InsertIntoTable.Catalog, |
| 151 | Schema: q.InsertIntoTable.Schema, |
| 152 | Name: q.InsertIntoTable.Name, |
| 153 | } |
| 154 | } |
| 155 | out = append(out, &plugin.Query{ |
| 156 | Name: q.Metadata.Name, |
| 157 | Cmd: q.Metadata.Cmd, |
| 158 | Text: q.SQL, |
| 159 | Comments: q.Metadata.Comments, |
| 160 | Columns: columns, |
| 161 | Params: params, |
| 162 | Filename: q.Metadata.Filename, |
| 163 | InsertIntoTable: iit, |
| 164 | }) |
| 165 | } |
| 166 | return out |
| 167 | } |
| 168 | |
| 169 | func pluginQueryColumn(c *compiler.Column) *plugin.Column { |
| 170 | l := -1 |
no test coverage detected