MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / pluginQueries

Function pluginQueries

internal/cmd/shim.go:136–167  ·  view source on GitHub ↗
(r *compiler.Result)

Source from the content-addressed store, hash-verified

134}
135
136func 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
169func pluginQueryColumn(c *compiler.Column) *plugin.Column {
170 l := -1

Callers 1

codeGenRequestFunction · 0.85

Calls 2

pluginQueryColumnFunction · 0.85
pluginQueryParamFunction · 0.85

Tested by

no test coverage detected