Skip to content

Commit f15bec9

Browse files
authored
Merge pull request #186 from src-d/bzz-add-example
Add one more query example
2 parents 65b4177 + 4464b05 commit f15bec9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

frontend/src/App.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,21 @@ FROM ( SELECT MONTH(committer_when) as month,
140140
ON YEAR(c.committer_when) = 2018 AND r.commit_hash = c.commit_hash
141141
WHERE r.ref_name = 'HEAD'
142142
) as t GROUP BY committer_email, committer_name, month, repository_id`
143+
},
144+
{
145+
name: 'Number of functions per file for Go',
146+
sql: ` /* Number of funtions per file for Golang at HEAD */
147+
SELECT files.repository_id, files.file_path,
148+
ARRAY_LENGTH(UAST(
149+
files.blob_content,
150+
LANGUAGE(files.file_path, files.blob_content),
151+
'//*[@roleFunction and @roleDeclaration]'
152+
)) as functions
153+
FROM files
154+
NATURAL JOIN refs
155+
WHERE
156+
LANGUAGE(files.file_path,files.blob_content) = 'Go'
157+
AND refs.ref_name = 'HEAD'`
143158
}
144159
];
145160
}

0 commit comments

Comments
 (0)