{"id":19307527,"url":"https://github.com/pgollangi/fireql","last_synced_at":"2025-04-22T12:36:48.254Z","repository":{"id":65127237,"uuid":"582231867","full_name":"pgollangi/FireQL","owner":"pgollangi","description":"Interactive CLI and Go library to query Google Firestore database using SQL syntax.","archived":false,"fork":false,"pushed_at":"2023-11-23T03:04:40.000Z","size":2588,"stargazers_count":31,"open_issues_count":8,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-21T15:58:55.382Z","etag":null,"topics":["database","firestore","firestore-collection","firestore-database","go","golang","google-firestore","sql"],"latest_commit_sha":null,"homepage":"https://pgollangi.github.io/FireQL/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgollangi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-26T06:51:05.000Z","updated_at":"2024-09-28T09:27:42.000Z","dependencies_parsed_at":"2023-11-23T04:27:12.262Z","dependency_job_id":null,"html_url":"https://github.com/pgollangi/FireQL","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2FFireQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2FFireQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2FFireQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2FFireQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgollangi","download_url":"https://codeload.github.com/pgollangi/FireQL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223896951,"owners_count":17221475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","firestore","firestore-collection","firestore-database","go","golang","google-firestore","sql"],"created_at":"2024-11-10T00:11:25.982Z","updated_at":"2024-11-10T00:11:26.846Z","avatar_url":"https://github.com/pgollangi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build](https://github.com/pgollangi/FireQL/actions/workflows/build.yml/badge.svg)](https://github.com/pgollangi/FireQL/actions/workflows/build.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/pgollangi/fireql)](https://app.codecov.io/gh/pgollangi/FireQL)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pgollangi/FireQL)](https://goreportcard.com/report/github.com/pgollangi/FireQL)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/pgollangi/FireQL)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/pgollangi/FireQL)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/pgollangi/FireQL)](https://pkg.go.dev/github.com/pgollangi/FireQL)\n![License: MIT](https://img.shields.io/github/license/pgollangi/FireQL)\n\n\u003c!-- [![codecov](https://codecov.io/gh/pgollangi/FireQL/branch/main/graph/badge.svg?token=3GKY3T9HYF)](https://codecov.io/gh/pgollangi/FireQL) --\u003e\n\n# FireQL\n\n`FireQL` is the Golang library and interactive CLI tool to query the Google Firestore database using SQL syntax.\n\nIt is built on top of the official [Google Firestore Client SDK](https://pkg.go.dev/cloud.google.com/go/firestore) that will allow running queries Cloud Firestore database using SQL syntax. Inspired by [Firebase FireSQL](https://firebaseopensource.com/projects/jsayol/firesql/).\n\n\n[![fireql](examples/fireql_help.png)](https://asciinema.org/a/548756?cols=150\u0026rows=50)\n\n## Usage\n\n`FireQL` can be used as Go library or interactive command-line tool.\n\n### Go Library\nAn example of querying collections using SQL syntax:\n```go\nimport (\n    \"github.com/pgollangi/fireql\"\n)\n\nfunc main() {\n    fql, err := fireql.New(\"\u003cGCP_PROJECT_ID\u003e\")\n    //OR\n    fql, err = fireql.New(\"\u003cGCP_PROJECT_ID\u003e\", fireql.OptionServiceAccount(\"\u003cSERVICE_ACCOUNT_JSON\u003e\"))\n    if err != nil {\n        panic(err)\n    }\n    \n\t// Now, execute SELECT query\n    result, err := fql.Execute(\"SELECT * `users` order by id desc limit 10\")\n    if err != nil {\n        panic(err)\n    }\n    _ = result\n}\n```\n\n### Command-Line\n```bash\nfireql [flags]\n```\n#### Example\n```bash\n$ fireql --project $PROJECT_ID\nWelcome! Use SQL to query Firestore.\nUse Ctrl+D, type \"exit\" to exit.\nVisit github.com/pgollangi/FireQL for more details.\nfireql\u003eselect id, name from users limit 2\n+------+------------+\n|  ID  |    NAME    |\n+------+------------+\n| 1046 | bob        |\n| 1047 | smith      |\n+------+------------+\n(2 rows)\nfireql\u003e\n```\nRead the [documentation](https://pgollangi.github.io/FireQL/) for more information on CLI usage.\n\n## Examples\nSome cool `SELECT` queries that are possible with `FireQL`:\n```sql\nselect * from users\nselect * from `[contacts]` // To query collection group. enclose subcollect name in square brackets.\nselect *, id as user_id from users\nselect id, email as email_address, `address.city` AS city from `users`\nselect * from users order by 'address.city' desc limit 10\nselect * from `users` where id \u003e 50\nselect id, LENGTH(contacts) as total_contacts from `users`\nselect id, (age \u003e 100) as centenarian as total_contacts from `users`\nselect __name__ from users // to select document id\n```\n\n`FireQL` depend on [govaluate](https://github.com/Knetic/govaluate) to evaluate expressions in `SELECT`. See list of possible expressions and operators [here](https://github.com/Knetic/govaluate/blob/master/MANUAL.md#operators). \n\nSee [Wiki](https://github.com/pgollangi/FireQL/wiki) for more examples.\n\n### Authentication\n\n`fireql.New` assume Google [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials) to authenticate to Firestore database if `serverAccount` not passed. Otherwise use service account for authentication.\n\n## Installation\n\n### Homebrew\n```bash\nbrew install pgollangi/tap/fireql\n```\nUpdating:\n```bash\nbrew upgrade fireql\n```\n\n### Scoop (for windows)\n```sql\nscoop bucket add pgollangi-bucket https://github.com/pgollangi/scoop-bucket.git\nscoop install fireql\n```\n\n### Docker\n```bash\ndocker run pgollangi/fireql\n```\n\n### Go\n\n```bash\ngo install github.com/pgollangi/fireql@latest\n```\n\n### Manual\nYou can alternately download a suitable binary for your OS at the [releases page](https://github.com/pgollangi/fireql/releases).\n\n## Limitations\nAll of [firestore query limitations](https://firebase.google.com/docs/firestore/query-data/queries#query_limitations) are applicable when running queries using `FireQL`.\n\nIn addition to that:\n\n- Only `SELECT` queries for now. Support for `INSERT`, `UPDATE`, and `DELETE` might come in the future.\n- Only `AND` conditions supported in `WHERE` clause. \n- No support for `JOIN`s.\n- `LIMIT` doesn't accept an `OFFSET`, only a single number.\n- No support of `GROUP BY` and aggregate function `COUNT`.\n\n## Future scope\n\n- [x] Create an interactive command-line shell to run queries\n- [ ] Expand support for all logical conditions in `WHERE` clause by internally issuing multiple query requests to Firestore and merging results locally before returning.\n- [ ] `GROUP BY` support\n- [ ] Support other DML queries: `INSERT`, `UPDATE`, and `DELETE`\n\n\n## Run\n\n### Tests\n\n```shell\n$ go test ./...\n```\n\n## Contributing\nThanks for considering contributing to this project!\n\nPlease read the [Contributions](https://github.com/pgollangi/.github/blob/main/CONTRIBUTING.md) and [Code of conduct](https://github.com/pgollangi/.github/blob/main/CODE_OF_CONDUCT.md).\n\nFeel free to open an issue or submit a pull request!\n\n## Licence\n\n`FireQL` is open-sourced software licensed under the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgollangi%2Ffireql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgollangi%2Ffireql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgollangi%2Ffireql/lists"}