Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table github_search_code. Closes #100 #107

Merged
merged 5 commits into from
Dec 6, 2021
Merged

Add table github_search_code. Closes #100 #107

merged 5 commits into from
Dec 6, 2021

Conversation

c0d3r-arnab
Copy link
Contributor

@c0d3r-arnab c0d3r-arnab commented Nov 23, 2021

Example query results

Results
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'filename:table_github_my_organization RowsRemaining';
+---------------------------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                            | query                                               | html_url                                                                                                                               | sha                                      |
+---------------------------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| table_github_my_organization.go | filename:table_github_my_organization RowsRemaining | https://github.com/turbot/steampipe-plugin-github/blob/1993967bf512789c40cc5afc9dc7ef87d33d9e85/github/table_github_my_organization.go | e38c1f2983bac204f2b1dea07382c581a33731ad |
+---------------------------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'github_rate_limit path:docs/tables';
+----------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                 | query                              | html_url                                                                                                                         | sha                                      |
+----------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| github_rate_limit.md | github_rate_limit path:docs/tables | https://github.com/turbot/steampipe-plugin-github/blob/22c952dddb866245d3a2eba6a991cf492cb7c7c7/docs/tables/github_rate_limit.md | 47178d1bd5792de1cb498104031f72d767c49a39 |
+----------------------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'github_rate_limit path:docs/tables extension:md';
+----------------------+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                 | query                                           | html_url                                                                                                                         | sha                                      |
+----------------------+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| github_rate_limit.md | github_rate_limit path:docs/tables extension:md | https://github.com/turbot/steampipe-plugin-github/blob/22c952dddb866245d3a2eba6a991cf492cb7c7c7/docs/tables/github_rate_limit.md | 47178d1bd5792de1cb498104031f72d767c49a39 |
+----------------------+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'github_stargazer org:turbot extension:go';
+---------------------------+------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                      | query                                    | html_url                                                                                                                         | sha                                      |
+---------------------------+------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| plugin.go                 | github_stargazer org:turbot extension:go | https://github.com/turbot/steampipe-plugin-github/blob/15c07531167143bf7e5c3629307f50047ec416f5/github/plugin.go                 | db9862a0576cec4d2acde4df89ca631e754bccdd |
| table_github_stargazer.go | github_stargazer org:turbot extension:go | https://github.com/turbot/steampipe-plugin-github/blob/1993967bf512789c40cc5afc9dc7ef87d33d9e85/github/table_github_stargazer.go | 0fbf63c60db20d78465b29692cbee643f2fbcde2 |
+---------------------------+------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'Stargazers user:turbot extension:go';
+----------------------------+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                       | query                               | html_url                                                                                                                          | sha                                      |
+----------------------------+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| table_github_stargazer.go  | Stargazers user:turbot extension:go | https://github.com/turbot/steampipe-plugin-github/blob/1993967bf512789c40cc5afc9dc7ef87d33d9e85/github/table_github_stargazer.go  | 0fbf63c60db20d78465b29692cbee643f2fbcde2 |
| table_github_repository.go | Stargazers user:turbot extension:go | https://github.com/turbot/steampipe-plugin-github/blob/21c2082f7bf00ae7f5820701f8c5b02f8b8e7a93/github/table_github_repository.go | c7a2791651deef8eb11f8177eb4d0a07ce7e9955 |
+----------------------------+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'Stargazers repo:turbot/steampipe-plugin-github extension:go';
+----------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                       | query                                                       | html_url                                                                                                                          | sha                                      |
+----------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| table_github_stargazer.go  | Stargazers repo:turbot/steampipe-plugin-github extension:go | https://github.com/turbot/steampipe-plugin-github/blob/1993967bf512789c40cc5afc9dc7ef87d33d9e85/github/table_github_stargazer.go  | 0fbf63c60db20d78465b29692cbee643f2fbcde2 |
| table_github_repository.go | Stargazers repo:turbot/steampipe-plugin-github extension:go | https://github.com/turbot/steampipe-plugin-github/blob/21c2082f7bf00ae7f5820701f8c5b02f8b8e7a93/github/table_github_repository.go | c7a2791651deef8eb11f8177eb4d0a07ce7e9955 |
+----------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'github_tag org:turbot language:markdown';
+---------------+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name          | query                                   | html_url                                                                                                                  | sha                                      |
+---------------+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| CHANGELOG.md  | github_tag org:turbot language:markdown | https://github.com/turbot/steampipe-plugin-github/blob/d53c3b8d9d2c1262f987478b2fcef452977d6ed1/CHANGELOG.md              | dc14898d3e46831407dc4bef7f6dfdbc596eaf4f |
| github_tag.md | github_tag org:turbot language:markdown | https://github.com/turbot/steampipe-plugin-github/blob/21c2082f7bf00ae7f5820701f8c5b02f8b8e7a93/docs/tables/github_tag.md | 2d697c968ff8598504675b0db24973ced0d8ab7e |
+---------------+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'org:turbot size:>40000 language:markdown';
+--------------+------------------------------------------+-----------------------------------------------------------------------------------------------------------+------------------------------------------+
| name         | query                                    | html_url                                                                                                  | sha                                      |
+--------------+------------------------------------------+-----------------------------------------------------------------------------------------------------------+------------------------------------------+
| CHANGELOG.md | org:turbot size:>40000 language:markdown | https://github.com/turbot/steampipe-plugin-aws/blob/015615a3fda7340adc0a9db94725fa8206e859a5/CHANGELOG.md | ea52e780cd5a47c3317ce21d84145af5a9ccc7c2 |
+--------------+------------------------------------------+-----------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  query,
  html_url,
  sha
from
  github_search_code
where
  query = 'Stargazers org:turbot in:file,path extension:go';
+----------------------------+-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| name                       | query                                           | html_url                                                                                                                          | sha                                      |
+----------------------------+-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
| table_github_repository.go | Stargazers org:turbot in:file,path extension:go | https://github.com/turbot/steampipe-plugin-github/blob/21c2082f7bf00ae7f5820701f8c5b02f8b8e7a93/github/table_github_repository.go | c7a2791651deef8eb11f8177eb4d0a07ce7e9955 |
| table_github_stargazer.go  | Stargazers org:turbot in:file,path extension:go | https://github.com/turbot/steampipe-plugin-github/blob/1993967bf512789c40cc5afc9dc7ef87d33d9e85/github/table_github_stargazer.go  | 0fbf63c60db20d78465b29692cbee643f2fbcde2 |
+----------------------------+-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+
> select
  name,
  jsonb_pretty(match -> 'matches') as matches,
  match ->> 'fragment' as fragment,
  match ->> 'property' as property,
  match ->> 'object_url' as object_url,
  match ->> 'object_type' as object_type
from
  github_search_code,
  jsonb_array_elements(text_matches) as match
where
  query = 'filename:table_github_my_organization RowsRemaining';
+---------------------------------+-------------------------------------------------+------------------------------------------+----------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------+
| name                            | matches                                         | fragment                                 | property | object_url                                                                                                                                 | object_type |
+---------------------------------+-------------------------------------------------+------------------------------------------+----------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------+
| table_github_my_organization.go | [                                               |  d.QueryStatus.RowsRemaining(ctx) == 0 { | content  | https://api.github.com/repositories/331646306/contents/github/table_github_my_organization.go?ref=1993967bf512789c40cc5afc9dc7ef87d33d9e85 | FileContent |
|                                 |     {                                           |                 return nil, nil          |          |                                                                                                                                            |             |
|                                 |         "text": "RowsRemaining",                |             }                            |          |                                                                                                                                            |             |
|                                 |         "indices": [                            |         }                                |          |                                                                                                                                            |             |
|                                 |             15,                                 |                                          |          |                                                                                                                                            |             |
|                                 |             28                                  |         if resp.NextPage                 |          |                                                                                                                                            |             |
|                                 |         ]                                       |                                          |          |                                                                                                                                            |             |
|                                 |     }                                           |                                          |          |                                                                                                                                            |             |
|                                 | ]                                               |                                          |          |                                                                                                                                            |             |
| table_github_my_organization.go | [                                               | table_github_my_organization.go          | path     | https://api.github.com/repositories/331646306/contents/github/table_github_my_organization.go?ref=1993967bf512789c40cc5afc9dc7ef87d33d9e85 | FileContent |
|                                 |     {                                           |                                          |          |                                                                                                                                            |             |
|                                 |         "text": "table_github_my_organization", |                                          |          |                                                                                                                                            |             |
|                                 |         "indices": [                            |                                          |          |                                                                                                                                            |             |
|                                 |             0,                                  |                                          |          |                                                                                                                                            |             |
|                                 |             28                                  |                                          |          |                                                                                                                                            |             |
|                                 |         ]                                       |                                          |          |                                                                                                                                            |             |
|                                 |     }                                           |                                          |          |                                                                                                                                            |             |
|                                 | ]                                               |                                          |          |                                                                                                                                            |             |
+---------------------------------+-------------------------------------------------+------------------------------------------+----------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------+
> select
  name,
  repository -> 'id' as repo_id,
  repository ->> 'name' as repo_name,
  repository ->> 'url' as repo_url,
  jsonb_pretty(repository -> 'owner') as repo_owner
from
  github_search_code
where
  query = 'filename:table_github_my_organization RowsRemaining';
+---------------------------------+-----------+-------------------------+-------------------------------------------------------------+------------------------------------------------------------------------------------+
| name                            | repo_id   | repo_name               | repo_url                                                    | repo_owner                                                                         |
+---------------------------------+-----------+-------------------------+-------------------------------------------------------------+------------------------------------------------------------------------------------+
| table_github_my_organization.go | 331646306 | steampipe-plugin-github | https://api.github.com/repos/turbot/steampipe-plugin-github | {                                                                                  |
|                                 |           |                         |                                                             |     "id": 38865304,                                                                |
|                                 |           |                         |                                                             |     "url": "https://api.github.com/users/turbot",                                  |
|                                 |           |                         |                                                             |     "type": "Organization",                                                        |
|                                 |           |                         |                                                             |     "login": "turbot",                                                             |
|                                 |           |                         |                                                             |     "node_id": "MDEyOk9yZ2FuaXphdGlvbjM4ODY1MzA0",                                 |
|                                 |           |                         |                                                             |     "html_url": "https://github.com/turbot",                                       |
|                                 |           |                         |                                                             |     "gists_url": "https://api.github.com/users/turbot/gists{/gist_id}",            |
|                                 |           |                         |                                                             |     "repos_url": "https://api.github.com/users/turbot/repos",                      |
|                                 |           |                         |                                                             |     "avatar_url": "https://avatars.githubusercontent.com/u/38865304?v=4",          |
|                                 |           |                         |                                                             |     "events_url": "https://api.github.com/users/turbot/events{/privacy}",          |
|                                 |           |                         |                                                             |     "site_admin": false,                                                           |
|                                 |           |                         |                                                             |     "gravatar_id": "",                                                             |
|                                 |           |                         |                                                             |     "starred_url": "https://api.github.com/users/turbot/starred{/owner}{/repo}",   |
|                                 |           |                         |                                                             |     "followers_url": "https://api.github.com/users/turbot/followers",              |
|                                 |           |                         |                                                             |     "following_url": "https://api.github.com/users/turbot/following{/other_user}", |
|                                 |           |                         |                                                             |     "organizations_url": "https://api.github.com/users/turbot/orgs",               |
|                                 |           |                         |                                                             |     "subscriptions_url": "https://api.github.com/users/turbot/subscriptions",      |
|                                 |           |                         |                                                             |     "received_events_url": "https://api.github.com/users/turbot/received_events"   |
|                                 |           |                         |                                                             | }                                                                                  |
+---------------------------------+-----------+-------------------------+-------------------------------------------------------------+------------------------------------------------------------------------------------+

@c0d3r-arnab c0d3r-arnab self-assigned this Nov 23, 2021
@c0d3r-arnab c0d3r-arnab linked an issue Nov 23, 2021 that may be closed by this pull request
@c0d3r-arnab c0d3r-arnab changed the title Add tables github_search_code Add table github_search_code. Closes #100 Nov 24, 2021
Copy link
Contributor

@ParthaI ParthaI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigdatasourav bigdatasourav merged commit 39d1c0a into main Dec 6, 2021
@bigdatasourav bigdatasourav deleted the issue-100 branch December 6, 2021 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table github_search_code.
3 participants