Sourcegraph API (experimental
!)
You can use the mergestat
command to query the Sourcegraph API.
Authenticating​
You must provide an authentication token in order to use the Sourcegraph API tables.
You can create a personal access token following these instructions.
The mergestat
command will look for a SOURCEGRAPH_TOKEN
environment variable when executing, to use for authentication.
This is also true if running as a runtime loadable extension.
sourcegraph_search
​
Table-valued-function that returns results from a Sourcegraph search.
Column | Type |
---|---|
__typename | TEXT |
results | TEXT |
__typename
will be one of Repository
, CommitSearchResult
, or FileMatch
.
results
will be the JSON value of a search result (will match what's returned from the API)
Params:
query
- a sourcegraph search query (docs)
SELECT sourcegraph_search('mergestat');