From 2e3e89d3dbacf5cbafeb7e5bf6dca861e19769c8 Mon Sep 17 00:00:00 2001 From: MrBounty Date: Tue, 26 Nov 2024 19:34:44 +0100 Subject: [PATCH] Update docs --- docs/Benchmark.md | 4 ++-- docs/Schema.md | 4 ++-- docs/ZiQL.md | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/Benchmark.md b/docs/Benchmark.md index 2c4f497..6862ba0 100644 --- a/docs/Benchmark.md +++ b/docs/Benchmark.md @@ -17,12 +17,12 @@ User ( ``` Here a user example: -``` +```lua run "ADD User (name = 'Diana Lopez',age = 2,email = 'allisonwilliams@example.org',scores=[37 85 90 71 88 85 68],friends = [],bday=1973/11/13,last_order=1979/07/18-15:05:26.590261,a_time=03:04:06.862213) ``` First let's do a query that parse all file but dont return anything, so we have the time to read and evaluate file but not writting and sending output. -``` +```lua run "GRAB User {name = 'asdfqwer'}" ``` diff --git a/docs/Schema.md b/docs/Schema.md index 79088fb..4f0481d 100644 --- a/docs/Schema.md +++ b/docs/Schema.md @@ -7,7 +7,7 @@ In ZipponDB, you use structures, or structs for short, and not tables to organiz ZipponDB use a seperate file to declare all structs to use in the database. Here an example of a file: -``` +```lua User ( name: str, email: str, @@ -18,7 +18,7 @@ User ( Note that `best_friend` is a link to another `User`. Here is a more advanced example with multiple structs: -``` +```lua User ( name: str, email: str, diff --git a/docs/ZiQL.md b/docs/ZiQL.md index ac147fb..b26d3c2 100644 --- a/docs/ZiQL.md +++ b/docs/ZiQL.md @@ -15,7 +15,7 @@ ZipponDB uses its own query language, ZipponQL or ZiQL for short. Here are the k ## Making errors When you make an error writing ZiQL, you should see something like this to help you understand where you made a mistake: -``` +```lua Error: Expected string GRAB User {name = Bob} ^^^ @@ -39,7 +39,7 @@ You can see it as `WHERE` in SQL. You can also link query. Each query returns a list of UUID of a specific struct. You can use it in the next query. Here an example where I create a new `Comment` that I then append to the list of comment of one specific `User`. -```js +```python ADD Comment (content='Hello world', at=NOW, like_by=[]) => added_comment => UPDATE User {id = '000'} TO (comments APPEND added_comment) ``` @@ -47,7 +47,7 @@ The name between `=>` is the variable name of the list of UUID used for the next You can also just use one `=>` but the list of UUID is discarded in that case. This can be use with GRAB too. So you can create variable before making the query. Here an example: -```js +```python GRAB User {name = 'Bob'} => bobs => GRAB User {age > 18} => adults => GRAB User {IN adults AND !IN bobs} @@ -68,32 +68,32 @@ The main action is `GRAB`, this will parse files and return data. Here's how to return all `User` entities without any filtering: -```js +```python GRAB User ``` To get all `User` entities above 30 years old: -```js +```python GRAB User {age > 30} ``` To return only the `name` member of `User` entities: -```js +```python GRAB User [name] {age > 30} ``` To return the 10 first `User` entities: -```js +```lua GRAB User [10] {age > 30} ``` You can combine these options: -```js +```lua GRAB User [10; name] {age > 30} ``` Use multiple conditions: -```js +```lua GRAB User {name = 'Bob' AND (age > 30 OR age < 10)} ``` @@ -213,7 +213,7 @@ GRAB Comment.like_by { at < '2024/01/01'} The `ADD` action adds one entity to the database. The syntax is similar to `GRAB`, but uses `()`. This signifies that the data is not yet in the database. Here's an example: -```js +```lua ADD User (name = 'Bob', age = 30, email = 'bob@email.com', scores = [1 100 44 82]) ```