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

Function sortedImports

internal/codegen/golang/imports.go:285–297  ·  view source on GitHub ↗
(std map[string]struct{}, pkg map[ImportSpec]struct{})

Source from the content-addressed store, hash-verified

283}
284
285func sortedImports(std map[string]struct{}, pkg map[ImportSpec]struct{}) fileImports {
286 pkgs := make([]ImportSpec, 0, len(pkg))
287 for spec := range pkg {
288 pkgs = append(pkgs, spec)
289 }
290 stds := make([]ImportSpec, 0, len(std))
291 for path := range std {
292 stds = append(stds, ImportSpec{Path: path})
293 }
294 sort.Slice(stds, func(i, j int) bool { return stds[i].Path < stds[j].Path })
295 sort.Slice(pkgs, func(i, j int) bool { return pkgs[i].Path < pkgs[j].Path })
296 return fileImports{stds, pkgs}
297}
298
299func (i *importer) queryImports(filename string) fileImports {
300 var gq []Query

Callers 5

interfaceImportsMethod · 0.85
modelImportsMethod · 0.85
queryImportsMethod · 0.85
copyfromImportsMethod · 0.85
batchImportsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected