MCPcopy Create free account
hub / github.com/andywer/postguard / getSubqueries

Function getSubqueries

src/postgres/parse-pg-query.ts:64–79  ·  view source on GitHub ↗
(
  statementPath: QueryNodePath<QueryParser.Query>
)

Source from the content-addressed store, hash-verified

62 ["larg", "rarg", "selectStmt"].indexOf(path.parentPropKey) > -1
63
64function getSubqueries(
65 statementPath: QueryNodePath<QueryParser.Query>
66): Array<QueryNodePath<QueryParser.Query>> {
67 const subqueries: Array<QueryNodePath<QueryParser.Query>> = []
68
69 traverseSubTree(statementPath, (path, $cancelRecursion) => {
70 if (path.node === statementPath.node) return
71
72 if (isSubquery(path.node)) {
73 subqueries.push(path)
74 return $cancelRecursion
75 }
76 })
77
78 return subqueries
79}
80
81function getTableReferences(
82 statementPath: QueryNodePath<any>,

Callers 1

instantiateQueryFunction · 0.85

Calls 2

traverseSubTreeFunction · 0.90
isSubqueryFunction · 0.85

Tested by

no test coverage detected