Update readme

This commit is contained in:
Adrien Bouvais 2024-09-12 20:20:49 +02:00
parent 87e11188d2
commit 07f09e463d

View File

@ -14,33 +14,29 @@ From here, you can create a new engine by running `schema build`. It will get th
using zig that the CLI will then use to manipulate data. You then interact with the engine by using `run "My query go here"` or using zig that the CLI will then use to manipulate data. You then interact with the engine by using `run "My query go here"` or
by directly using the engine binary. by directly using the engine binary.
## Why Zippon ? ### Why Zippon ?
I first started ZipponDB to learn, but I think that in order to learn, you need to build something real, so I chose to do a database - Open-source and written 100% in Zig with 0 dependency
as I try to become an expert in it.
Now for Zippon advantages:
- Open-source and 100% in Zig with 0 dependencies
- Relational database - Relational database
- Small, fast and implementable everywhere - Small, fast and implementable everywhere
# Declare a schema # Declare a schema
ZipponDB need a schema to work. A schema is a way to define how your data will be store. Compared to SQL, you can see it as a ZipponDB need a schema to work. A schema is a way to define how your data will be store.
file where you declare all table name, columns name, data type and relationship. But here you declare struct. A struct have a name and
members. A member is one data or link and have a type associated. Here a simple example for a user: Compared to SQL, you can see it as a file where you declare all table name, columns name, data type and relationship.
But here you declare struct. A struct have a name and members. A member is one data or link and have a type associated. Here a simple example for a user:
``` ```
User ( User (
name: str, name: str,
email: str, email: str,
best_friend: User, best_friend: User,
friends: []User,
) )
``` ```
In this example each user have a name and email as a string. But also one best friend as a link. [] mean that there is a In this example each user have a name and email as a string. But also one best friend as a link.
list of this value. Note that all value can be null exept list, they can be empty.
Here a more advance example with multiple struct: Here a more advance example with multiple struct:
``` ```
@ -49,9 +45,9 @@ User {
email: str, email: str,
friends: []User, friends: []User,
posts: []Post, posts: []Post,
liked_post: []Post, liked_posts: []Post,
comments: []Comment, comments: []Comment,
liked_com: []Comment, liked_coms: []Comment,
} }
Post { Post {
@ -72,13 +68,11 @@ Comment {
} }
``` ```
Note: data not yet implemented. Note: [] are list of value.
# ZipponQL # ZipponQL
Zippon have it's own query language. Why ? Idk, I wanted to do it. Zippon have it's own query language. Here the keys point to remember:
The language itself is fairly easy in my opinion. Here the basic:
- {} Are filters - {} Are filters
- [] Are how much; what data - [] Are how much; what data
@ -89,53 +83,52 @@ The language itself is fairly easy in my opinion. Here the basic:
### Some examples ### Some examples
`GRAB User` `GRAB User`
Get all users Get all users
`GRAB User { name = 'Adrien' }` `GRAB User { name = 'Adrien' }`
Get all user named Adrien Get all user named Adrien
`GRAB User [1; email]` `GRAB User [1; email]`
Get one user email Get one user email
`GRAB User | ASCENDING name |` `GRAB User | ASCENDING name |`
Get all users ordered by name Get all users ordered by name
`GRAB User [name] { age > 10 AND name != 'Adrien' } | DECENDING age |` `GRAB User [name] { age > 10 AND name != 'Adrien' } | DECENDING age |`
Get just the name of all users that are more than 10 years old and not named Adrien Get just the name of all users that are more than 10 years old and not named Adrien
`GRAB User [1] { bestfriend = { name = 'Adrien' } }` `GRAB User [1] { bestfriend = { name = 'Adrien' } }`
Get one user that have a best friend named Adrien Get one user that have a best friend named Adrien
`GRAB User [10; friends [1]] { age > 10 } | ASC name |` `GRAB User [10; friends [1]] { age > 10 } | ASC name |`
Get one friend of the 10 first user above 10 years old in ascending name. Get one friend of the 10 first user above 10 years old in ascending name.
### Not yet implemented ### Not yet implemented
`GRAB Message [100; comments [ date ] ] { .writter = { name = 'Adrien' }.bestfriend }` `GRAB Message [100; comments [ date ] ] { .writter = { name = 'Adrien' }.bestfriend }`
Get the date of 100 comments written by the best friend of a user named Adrien Get the date of 100 comments written by the best friend of a user named Adrien
`GRAB User { IN Message { date > '12-01-2014' }.writter }` `GRAB User { IN Message { date > '12-01-2014' }.writter }`
Get all users that sended a message after the 12 january 2014 Get all users that sended a message after the 12 january 2014
`GRAB User { !IN Comment { }.writter }` `GRAB User { !IN Comment { }.writter }`
Get all user that didn't wrote a comment Get all user that didn't wrote a comment
`GRAB User { IN User { name = 'Adrien' }.friends }` `GRAB User { IN User { name = 'Adrien' }.friends }`
Get all user that are friends with an Adrien Get all user that are friends with an Adrien
`UPDATE User [1] { name = 'Adrien' } => ( email = 'new@email.com' )` `UPDATE User [1] { name = 'Adrien' } => ( email = 'new@email.com' )`
`REMOVE User { id = '000-000' }` `REMOVE User { id = '000-000' }`
`ADD User ( name = 'Adrien', email = 'email', age = 40 )`
`ADD User ( name = 'Adrien', email = 'email', age = 40 )`
# Integration # Integration
For now there is only a python intregration, but because it is just 2-3 command, it is easy to implement with other language. For now there is only a python intregration, but because it is just 2-3 command, it is easy to implement with other language.
## Python ### Python
```python ```python
import zippondb as zdb import zippondb as zdb
@ -152,12 +145,14 @@ for user in users:
# Roadmap # Roadmap
[ ] Beta without link [X] CLI
[ ] Relationships/links [ ] Beta without link
[ ] Multi threading [ ] Relationships/links
[ ] Transaction [ ] Multi threading
[ ] Docker image [ ] Transaction
[ ] Migration of schema [ ] Docker image
[ ] Dump/Bump data [ ] Migration of schema
[ ] In memory option [ ] Dump/Bump data
[ ] Archives [ ] In memory option
[ ] Archives
[ ] Date value type