Update README.md

This commit is contained in:
Maxim Svistunov 2024-02-05 23:49:05 +01:00
parent 3499dbcdf7
commit b7c16b4073

View file

@ -15,28 +15,29 @@
## Running the server ## Running the server
```bash ```bash
cargo run -p server -- [OPTIONS] --file <FILE> cargo run -p server -- [OPTIONS] --folder <FOLDER>
``` ```
``` ```
Options: Options:
-a, --address <ADDRESS> IP address for the server to listen on [default: 127.0.0.1] -a, --address <ADDRESS> IP address for the server to listen on [default: 127.0.0.1]
-p, --port <PORT> Port for the server to listen on [default: 5432] -p, --port <PORT> Port for the server to listen on [default: 5432]
-f, --file <FILE> Path to the data file -f, --folder <FOLDER> Path to the folder for database data
-t, --throttle <DELAY> Delay between rows in milliseconds
-h, --help Print help -h, --help Print help
``` ```
This will start the server listening on `<ADDRESS>:<PORT>` and load the state from `<FILE>`. This will start the server listening on `<ADDRESS>:<PORT>` and load the state from `<FOLDER>`.
If the `<FILE>` does not exist, it will be created. If the `<FOLDER>` does not exist, it will be created.
### Demo Database ### Demo Database
A database with demo data is available in `demo.json`. To run the server with this database, use: Commands that set up a database with demo data are available in `demo-1.sql`, `demo-2.sql`, and `demo-3.sql`.
```bash
cargo run -p server -- --file demo.json
```
This database contains two tables: These files showcase the following things:
- Table `users` with columns `id`, `name`, `surname`, `email` - `demo-1.sql`: small tables that handle Unicode and make use of the Optional type
- Table `cars` with columns `id`, `vid`, `brand`, `model`, `year` - `demo-2.sql`: a bigger (1000 rows) table with realistic data
- `demo-3.sql`: a big (10,000 rows) table with simple data (was easier to generate)
See comments in these files for details.
## Running the client ## Running the client
```bash ```bash
@ -56,7 +57,7 @@ SQL queries can be entered line by line. The client will print the result of eac
To exit the REPL client, enter `exit` or `quit`. To exit the REPL client, enter `exit` or `quit`.
# Features # Features
- SQL must be on single line, in **UPPERCASE** and end with `;`, as it should be - SQL must be on single line, in **UPPERCASE**, as it should be. The `;` at EOL is optional.
- Supported operations: `CREATE TABLE`, `CREATE INDEX`, `SELECT`, `INSERT`, `DELETE` - Supported operations: `CREATE TABLE`, `CREATE INDEX`, `SELECT`, `INSERT`, `DELETE`
- Supported data types: `UUID`, `STRING`, `INT`, `NUMBER` - Supported data types: `UUID`, `STRING`, `INT`, `NUMBER`
- Supported subset of PostgreSQL protocol, without authentication and simple query flow - Supported subset of PostgreSQL protocol, without authentication and simple query flow
@ -129,6 +130,7 @@ DELETE FROM users WHERE name = "Christina";
- `STRING` - string enclosed in double quotes, e.g. `"Hello World"` - `STRING` - string enclosed in double quotes, e.g. `"Hello World"`
- `INT` - integer, e.g. `12345` - `INT` - integer, e.g. `12345`
- `NUMBER` - floating point number, e.g. `123.45` - `NUMBER` - floating point number, e.g. `123.45`
- `Option(Something)` - optional type, e.g. `Some("james.stuart@gmail.com")` or `None`
## Testing with `psql` ## Testing with `psql`
Thanks to the subset of PostgreSQL protocol implemented in `proto`, the server can be tested with `psql`, Thanks to the subset of PostgreSQL protocol implemented in `proto`, the server can be tested with `psql`,