https://github.com/syucream/firesql
A SQL-like interface to Google Cloud Firestore in Java
https://github.com/syucream/firesql
cloud-firestore java sql
Last synced: 5 months ago
JSON representation
A SQL-like interface to Google Cloud Firestore in Java
- Host: GitHub
- URL: https://github.com/syucream/firesql
- Owner: syucream
- License: mit
- Created: 2020-01-01T11:18:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-07T15:57:22.000Z (over 5 years ago)
- Last Synced: 2025-02-26T14:45:27.829Z (7 months ago)
- Topics: cloud-firestore, java, sql
- Language: Java
- Homepage:
- Size: 71.3 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FireSQL
[  ](https://bintray.com/syucream/maven/com.syucream.firesql/0.0.1/link)
A SQL-like interface to [Google Cloud Firestore](https://firebase.google.com/docs/firestore) in Java
# Synopsis
SDKs for Google Cloud Firestore provides high-level query builder stuff like:
```java
...
Firestore db = FirestoreClient.getFirestore();Query query = db
.collection("users")
.select("id", "name", "age")
.whereGreaterThanOrEqualTo("age", 30L)
.whereLessThan("age", 40L)
.orderBy("id", Query.Direction.ASCENDING)
.limit(100)
.offset(200);query.get();
...
```But SQL will be sometimes wanted, e.g. executing extraction queries periodically, non coders want to execute custom query on their operations, etc.
So that, FireSQL supports primitive SQL-like interface, like below:```java
...
Firestore db = FirestoreClient.getFirestore();FireSQL firesql = new FireSQL(db);
Query query = firesql.query("SELECT id, name, age FROM users WHERE age >= 30 AND age < 40 ORDER BY id LIMIT 100 OFFSET 200");query.get();
...
```# Limitations
- Only `SELECT` supported
- `JOIN`, `GROUP BY`, aggregation functions, sub queries are unsupported
- `NOT`, `IN` and some other expression are unsupported
- `array-contains` expression in Firestore query is unsuported for now# References
- JavaScript implementation https://github.com/jsayol/FireSQL