MCPcopy
hub / github.com/sqlc-dev/sqlc / interfaceImports

Method interfaceImports

internal/codegen/golang/imports.go:249–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247}
248
249func (i *importer) interfaceImports() fileImports {
250 std, pkg := buildImports(i.Options, i.Queries, func(name string) bool {
251 for _, q := range i.Queries {
252 if q.hasRetType() {
253 if usesBatch([]Query{q}) {
254 continue
255 }
256 if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) {
257 return true
258 }
259 }
260 for _, f := range q.Arg.Pairs() {
261 if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) {
262 return true
263 }
264 }
265 }
266 return false
267 })
268
269 std["context"] = struct{}{}
270
271 return sortedImports(std, pkg)
272}
273
274func (i *importer) modelImports() fileImports {
275 std, pkg := buildImports(i.Options, nil, i.usesType)

Callers 1

ImportsMethod · 0.95

Calls 7

buildImportsFunction · 0.85
usesBatchFunction · 0.85
sortedImportsFunction · 0.85
hasRetTypeMethod · 0.80
TypeMethod · 0.80
PairsMethod · 0.65

Tested by

no test coverage detected