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

Function pullQueryArgs

coderd/database/gentest/modelqueries_test.go:149–165  ·  view source on GitHub ↗
(fn *ast.FuncDecl)

Source from the content-addressed store, hash-verified

147}
148
149func pullQueryArgs(fn *ast.FuncDecl) []ast.Expr {
150 for _, exp := range fn.Body.List {
151 // find "rows, err :="
152 if assign, ok := exp.(*ast.AssignStmt); ok {
153 if len(assign.Lhs) == 2 {
154 if id, ok := assign.Lhs[0].(*ast.Ident); ok && id.Name == "rows" {
155 // This is rows, err :=
156 query := assign.Rhs[0].(*ast.CallExpr)
157 if qSel, ok := query.Fun.(*ast.SelectorExpr); ok && qSel.Sel.Name == "QueryContext" {
158 return query.Args
159 }
160 }
161 }
162 }
163 }
164 return nil
165}
166
167func pullRowScanArgs(fn *ast.FuncDecl) []ast.Expr {
168 for _, exp := range fn.Body.List {

Callers 1

parseFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected