#查询语言 #SQL 查询 #Git #语言 #SQL #查询引擎 #gql

app gitql

一种类似于 SQL 的查询语言,用于对 .git 文件进行查询

24 个重大版本发布

0.26.0 2024 年 8 月 17 日
0.25.0 2024 年 7 月 9 日
0.24.0 2024 年 6 月 21 日
0.16.0 2024 年 3 月 15 日
0.4.1 2023 年 7 月 19 日

#739 in 命令行工具

Download history 7/week @ 2024-05-05 143/week @ 2024-05-12 294/week @ 2024-05-19 148/week @ 2024-05-26 172/week @ 2024-06-02 437/week @ 2024-06-09 222/week @ 2024-06-16 36/week @ 2024-06-23 35/week @ 2024-06-30 148/week @ 2024-07-07 15/week @ 2024-07-14 3/week @ 2024-07-21 29/week @ 2024-07-28 5/week @ 2024-08-04 128/week @ 2024-08-11 75/week @ 2024-08-18

每月 238 次下载

MIT 许可证

400KB
10K SLoC

GQL - Git 查询语言


Crates.io Deps Release Docs GitHub release GitHub issues GitHub GitHub all releases

GQL 是一种语法与 SQL 非常相似的查询语言,具有一个小型引擎,用于在 .git 文件上执行查询,而不是数据库文件。该引擎会即时执行查询,无需创建数据库文件或将 .git 文件转换为其他任何格式。

animated


示例

请注意,GQL 中的所有关键词都是不区分大小写的,类似于 SQL。

SELECT 1
SELECT 1 + 2
SELECT LEN("Git Query Language")
SELECT "One" IN ("One", "Two", "Three")
SELECT "Git Query Language" LIKE "%Query%"

SET @arr = [1, 2, 3];
SELECT [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
SELECT @arr[1], @arr[2], @arr[3], ARRAY_LENGTH(@arr);
SELECT @arr[1:2], @arr[2:], @arr[:2];

SELECT DISTINCT title AS tt FROM commits
SELECT author_name, COUNT(author_name) AS commit_num FROM commits GROUP BY author_name, author_email ORDER BY commit_num DESC LIMIT 10
SELECT commit_count FROM branches WHERE commit_count BETWEEN 0 .. 10

SELECT * FROM refs WHERE type = "branch"
SELECT * FROM refs ORDER BY type

SELECT * FROM commits
SELECT author_name, author_email FROM commits
SELECT author_name, author_email FROM commits ORDER BY author_name DESC, author_email ASC
SELECT author_name, author_email FROM commits WHERE name LIKE "%gmail%" ORDER BY author_name
SELECT * FROM commits WHERE LOWER(name) = "amrdeveloper"
SELECT author_name FROM commits GROUP By author_name
SELECT author_name FROM commits GROUP By author_name having author_name = "AmrDeveloper"

SELECT * FROM branches
SELECT * FROM branches WHERE is_head = true
SELECT name, LEN(name) FROM branches

SELECT * FROM tags
SELECT * FROM tags OFFSET 1 LIMIT 1

文档


许可证

MIT License

Copyright (c) 2023 Amr Hesham

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

依赖项

~20–33MB
~576K SLoC