MCPcopy Index your code
hub / github.com/coder/coder / readQuerierFunctions

Function readQuerierFunctions

scripts/dbgen/main.go:293–314  ·  view source on GitHub ↗

readQuerierFunctions reads the functions from coderd/database/querier.go

()

Source from the content-addressed store, hash-verified

291
292// readQuerierFunctions reads the functions from coderd/database/querier.go
293func readQuerierFunctions() ([]querierFunction, error) {
294 f, err := parseDBFile("querier.go")
295 if err != nil {
296 return nil, xerrors.Errorf("parse querier.go: %w", err)
297 }
298 funcs, err := loadInterfaceFuncs(f, "sqlcQuerier")
299 if err != nil {
300 return nil, xerrors.Errorf("load interface %s funcs: %w", "sqlcQuerier", err)
301 }
302
303 customFile, err := parseDBFile("modelqueries.go")
304 if err != nil {
305 return nil, xerrors.Errorf("parse modelqueriers.go: %w", err)
306 }
307 // Custom funcs should be appended after the regular functions
308 customFuncs, err := loadInterfaceFuncs(customFile, "customQuerier")
309 if err != nil {
310 return nil, xerrors.Errorf("load interface %s funcs: %w", "customQuerier", err)
311 }
312
313 return append(funcs, customFuncs...), nil
314}
315
316func parseDBFile(filename string) (*dst.File, error) {
317 localPath, err := localFilePath()

Callers 1

initFunction · 0.85

Calls 3

parseDBFileFunction · 0.85
loadInterfaceFuncsFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected