ExtendedSQL (ESQL) is a programming language designed to link simple backend requests directly to the database layer of the stack.
Clone the repository into a folder with either
- https:
git clone https://github.com/ThomasNotTom/ExtendedSQL.git
- SSH:
git clone [email protected]:ThomasNotTom/ExtendedSQL.git
Go into the created folder
cd ExtendedSQL
Build with
cargo build
Run with
cargo run {input_file}.esql
replacing {input_file}.esql
, with the file you'd like to open
The complete installation process using SSH looks like this
git clone [email protected]:ThomasNotTom/ExtendedSQL.git
cd ExtendedSQL
cargo build
cargo run ./examples/example1.esql
To install you can either (a) add the binary in your /usr/bin/
or (b) add it to your path.
First you need to build with the --release
flag.
cargo build --release
Then you need to move the binary to your /usr/bin/
folder.
sudo mv ./target/release/extended_sql /usr/bin/
Add the output binary to your path
- For zsh:
echo 'export PATH="$(pwd)/target/release/build/:$PATH"' >> ~/.zshrc
source ~/.zshrc
- For bash:
echo 'export PATH="$(pwd)/target/release/build/:$PATH"' >> ~/.bashrc
source ~/.bashrc
(syntax subject to change)
CREATE SERVER server;
INSERT INTO SERVER server (
6543, // The port number
)
CREATE TABLE users (
user_id INT PRIMARY_KEY,
first_name STRING,
last_name STRING,
age INT NOT_NULL,
);
Server ON GET TO "/get_user" WITH QUERY (
user_id INT,
) RETURN (
USER (SELECT * FROM users WHERE users.user_id=HEADER.user_id)
);
Given a user exists with user_id
1234
and a GET request to /get_user?user_id=1234
on port 6543
would return
{
user: {
user_id: 1234,
first_name: 'John',
last_name: 'Doe',
age: 40
}
}
CREATE DATABASE MyDatabase;
CREATE TABLE MyDatabase.users;
CREATE TABLE MyDatabase.items;
CREATE TABLE MyDatabase.transactions;
ESQL is not designed to be a replacement to a backend or database, however is intended to be used as a temporary placeholder for both. This is particularly useful for programmers who want to quickly spin up a backend/database, and have it be configured quickly so other functionality (mainly frontend) can be worked on.