Git Query Language (GQL)

Overview

GQL - Git Query Language


GQL is a query language with a syntax very similar to SQL with a tiny engine to perform queries on .git files instance of database files, the engine executes the query on the fly without the need to create database files or convert .git files into any other format.

animated


Samples

select * from commits
select name, email from commits
select name, email from commits order by name
select name, email from commits where name contains "gmail" order by name
select * from commits where name.lower = "amrdeveloper"

select * from branches
select * from branches where ishead = "true"
select * from branches where name ends_with "master"
select * from branches where name contains "origin"

select * from tags
select * from tags offset 1 limit 1

Build and run

To build and run GQL you need to have rust installed on your system and then use run command with folder that contains .git files

cargo run <repository_path>

Documentation:

Select from

Select keyword used to select all of some fields from specific table


Tables and Fields

  • commits { name, email, title, message, time }
  • branches { name, ishead, isremote }
  • tags { name }

String Comparisons

  • = used to check if field equal to expected value.
  • ! used to check if field not equal to expected value.
  • > used to check if field greater than expected value.
  • >= used to check if field greater than or equals expected value.
  • < used to check if field less than expected value.
  • <= used to check if field less than or equals expected value.

String checks

  • contains used to check that field contains value.
  • starts_with used to check that field starts with value.
  • ends_with used to check that field ends with value.
  • matches used to check that field matches regex format.

Logical Expressions

  • | or or: used to calculate or between two booleans,
  • & or and: used to calculate and between two booleans,
  • ^ or xor: used to calculate xor between two booleans,

Unary Expressions

  • !: used as prefix for expression to perform bang expression

Group Expressions

Group expression is an expresion inside ( and ) used to give high precedence for expression.


Sorting

To sort the result you need to use order by keyword followed by field name.


Limit

limit statement take n as integer to limit the result number.


Offset

offset statement take n as integer to ignore the first n result.


Transformations

Transformations are functions with 0 arguments used to apply transformation on values

  • lower convert the value to be lower case.
  • upper convert the value to be upper case.
  • trim remote leading and trailing whitespace.
  • length return the length as a string.

License

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.
You might also like...
Diesel - ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

Rust library to parse, deparse and normalize SQL queries using the PostgreSQL query parser

This Rust library uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.

rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

rust_arango enables you to connect with ArangoDB server, access to database, execute AQL query, manage ArangoDB in an easy and intuitive way, both async and plain synchronous code with any HTTP ecosystem you love.

Type-safe SQL query wrappers

fnsql   The fnsql crate provides simple type-safe optional wrappers around SQL queries. Instead of calling type-less .query() and .execute(), you call

A Toy Query Engine & SQL interface
A Toy Query Engine & SQL interface

Naive Query Engine (Toy for Learning) 😄 This is a Query Engine which support SQL interface. And it is only a Toy for learn query engine only. You can

XLite - query Excel (.xlsx, .xls) and Open Document spreadsheets (.ods) as SQLite virtual tables

XLite - query Excel (.xlsx, .xls) and Open Document spreadsheets (.ods) as SQLite virtual tables XLite is a SQLite extension written in Rust. The main

Query system statistics with SQL.

pg_stat_sysinfo Collects system statistics. ---- CREATE EXTENSION pg_stat_sysinfo; CREATE EXTENSION ---- SELECT * FROM pg_stat_sysinfo_collect();

ReefDB is a minimalistic, in-memory and on-disk database management system written in Rust, implementing basic SQL query capabilities and full-text search.
ReefDB is a minimalistic, in-memory and on-disk database management system written in Rust, implementing basic SQL query capabilities and full-text search.

ReefDB ReefDB is a minimalistic, in-memory and on-disk database management system written in Rust, implementing basic SQL query capabilities and full-

Query is a Rust server for your remote SQLite databases and a CLI to manage them.

Query Query is a Rust server for your remote SQLite databases and a CLI to manage them. Table Of Contents Run A Query Server CLI Install Use The Insta

Comments
  • Releases with binary assets?

    Releases with binary assets?

    Any chance to get releases with binary assets, so one can download the compiled binary instead of needing to setup the toolchain and all that?

    The rye release workflow looks nice: https://github.com/mitsuhiko/rye/blob/main/.github/workflows/release.yml

    If there is a new tag, the workflow would create a draft release, compile all the assets (different architectures) and upload them to the release. The final step is then for somone to (manually) add the release description (if you have any) and publish the release.

    (Creating only a draft and only publish when the description is filled is nice because upon publish, GitHub send out an email with the current content. If the release is created without a description, the email has no info :⁠-⁠()

    opened by jankatins 1
Owner
Amr Hesham
Software Engineer interested in Programming Languages and Tools development
Amr Hesham
Bind the Prisma ORM query engine to any programming language you like ❤️

Prisma Query Engine C API Bind the Prisma ORM query engine to any programming language you like ❤️ Features Rust bindings for the C API Static link li

Prisma ORM for community 10 Dec 15, 2022
Bind the Prisma ORM query engine to any programming language you like ❤️

Prisma Query Engine C API Bind the Prisma ORM query engine to any programming language you like ❤️ Features Rust bindings for the C API Static link li

Odroe 6 Sep 9, 2022
A safe, extensible ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

Diesel 9.7k Jan 3, 2023
Query LDAP and AD with SQL

SQLDAP Ever wanted to query AD or LDAP with SQL like queries ? I'm going to answer this question myself: yes ! Why ? Because I never could remember al

null 9 Nov 15, 2022
A Rust SQL query builder with a pleasant fluent API closely imitating actual SQL

Scooby An SQL query builder with a pleasant fluent API closely imitating actual SQL. Meant to comfortably build dynamic queries with a little bit of s

Aleksei Voronov 100 Nov 11, 2022
A query builder that builds and typechecks queries at compile time

typed-qb: a compile-time typed "query builder" typed-qb is a compile-time, typed, query builder. The goal of this crate is to explore the gap between

ferrouille 3 Jan 22, 2022
Fully typed SQL query builder for Rust [deprecated]

What is Deuterium? Deuterium is a fancy SQL builder for Rust. It's designed to provide a DSL to easily build SQL queries in safe and typed way. Like R

Stanislav Panferov 169 Nov 20, 2022
Gh-sql - Query GitHub Projects (beta) with SQL

gh-sql: Query GitHub Projects (beta) with SQL Installation gh extension install KOBA789/gh-sql Features SELECT items DELETE items UPDATE item fields

Hidekazu Kobayashi 108 Dec 7, 2022
Diesel - A safe, extensible ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust API Documentation: latest release – master branch Homepage Diesel gets rid of the boilerplate for da

Takayuki Maeda 0 Aug 31, 2020
Qoo - Query Object Oriented. Pronunciation is Kuu.

qoo Query Object Oriented. Pronunciation is Kuu. demo use qoo::base::*; use qoo::select::*; use qoo::insert::*; use qoo::update::*; use qoo::delete::*

Ochi Daiki 2 May 13, 2022