Skip to content

Commit ae7cbf0

Browse files
Merge pull request #3 from fadhly-permata/dev
Overhaul README with enhanced documentation and examples
2 parents 5f6ad43 + 72b5097 commit ae7cbf0

File tree

1 file changed

+124
-2
lines changed

1 file changed

+124
-2
lines changed

README.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,124 @@
1-
# JQL.Net
2-
JQL.Net: A lightweight SQL-like Query Engine for JSON in .NET. Execute complex queries, joins, and aggregations on JSON data without a database. Supports SELECT, JOIN, WHERE, and GROUP BY on dynamic JObjects.
1+
# 🚀 JQL.Net (JSON Query Language for .NET)
2+
3+
[![NuGet](https://img.shields.io/nuget/v/JQL.Net.svg)](https://www.nuget.org/packages/JQL.Net/)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
**Bring the power of SQL to your JSON!** 🎯
7+
8+
JQL.Net is a lightweight, high-performance query engine that lets you search, join, and aggregate raw JSON data using familiar SQL-like syntax. Perfect for those moments when you have complex JSON structures but don't want the overhead of a database.
9+
10+
---
11+
12+
## ✨ Features
13+
14+
- 🔍 **SQL-Like Syntax**: Use `SELECT`, `FROM`, `WHERE`, `JOIN`, `GROUP BY`, `HAVING`, and `ORDER BY`.
15+
- 🤝 **Advanced Joins**: Support for multiple conditions in `ON` using `AND` / `OR` logic.
16+
- 🧮 **Aggregations**: Built-in support for `SUM`, `COUNT`, `AVG`, `MIN`, and `MAX`.
17+
- ☁️ **Case-Insensitive**: Keywords like `select` or `SELECT`? We don't judge. It just works.
18+
- 🏷️ **Alias Support**: Use `AS` to keep your results clean and readable.
19+
-**Lightweight**: Zero database dependencies. Just you and your JSON.
20+
21+
---
22+
23+
## 📦 Installation
24+
25+
Grab it on **NuGet**:
26+
27+
```bash
28+
dotnet add package JQL.Net
29+
```
30+
31+
---
32+
33+
## 🚀 Quick Start
34+
35+
Using JQL.Net is as easy as ordering pizza. Check this out:
36+
37+
```csharp
38+
using JQL.Net.Extensions;
39+
using Newtonsoft.Json.Linq;
40+
41+
// 1. Your raw JSON data
42+
var json = @"{
43+
'employees': [
44+
{ 'id': 1, 'name': 'John Doe', 'dept_id': 10, 'salary': 8000 },
45+
{ 'id': 2, 'name': 'Jane Smith', 'dept_id': 10, 'salary': 9500 }
46+
],
47+
'departments': [
48+
{ 'id': 10, 'name': 'IT', 'budget': 20000 }
49+
]
50+
}";
51+
52+
var data = JObject.Parse(json);
53+
54+
// 2. Write your 'SQL'
55+
string query = @"
56+
SELECT e.name, d.name AS DeptName
57+
FROM $.employees AS e
58+
JOIN $.departments AS d ON e.dept_id == d.id
59+
WHERE e.salary > 5000";
60+
61+
// 3. Execute!
62+
var results = data.Query(query);
63+
64+
foreach (var row in results) {
65+
Console.WriteLine($"{row["name"]} works in {row["DeptName"]}");
66+
}
67+
```
68+
69+
---
70+
71+
## 💡 Cool Examples
72+
73+
### Complex Joins (The 'AND/OR' Power) 🦾
74+
Need to link data with multiple rules? No problem:
75+
```sql
76+
SELECT e.name, p.proj_name
77+
FROM $.employees AS e
78+
JOIN $.projects AS p ON e.proj_id == p.id AND p.status == 'Active'
79+
```
80+
81+
### Aggregations & Having 📊
82+
Want to find big-spending departments?
83+
```sql
84+
SELECT d.name, SUM(salary) AS total_cost
85+
FROM $.employees AS e
86+
JOIN $.departments AS d ON dept_id == id
87+
GROUP BY d.name
88+
HAVING total_cost > d.budget
89+
```
90+
91+
---
92+
93+
## 🛠️ Supported Keywords
94+
95+
| Keyword | Description |
96+
| :--- | :--- |
97+
| `SELECT` | Choose which fields to return (supports Aliases). |
98+
| `FROM` | Define the JSON path (default is `$`). |
99+
| `JOIN` | Combine two JSON arrays with `ON` logic. |
100+
| `WHERE` | Filter results with `==`, `!=`, `>`, `<`, etc. |
101+
| `GROUP BY`| Bundle results by specific fields. |
102+
| `HAVING` | Filter aggregated groups. |
103+
| `ORDER BY`| Sort your output. |
104+
105+
---
106+
107+
## 🤝 Contributing
108+
109+
Got a cool idea or found a bug? 🐛
110+
1. Fork it!
111+
2. Create your feature branch (`git checkout -b feature/cool-stuff`)
112+
3. Commit your changes (`git commit -m 'Add some cool stuff'`)
113+
4. Push to the branch (`git push origin feature/cool-stuff`)
114+
5. Open a Pull Request.
115+
116+
---
117+
118+
## 📄 License
119+
120+
This project is licensed under the **MIT License**.
121+
122+
---
123+
124+
**Made with ❤️ for the .NET Community.** *If you find JQL.Net useful, give it a ⭐ on GitHub!*

0 commit comments

Comments
 (0)