Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wynwxst/jsonscript
modern database :)
https://github.com/wynwxst/jsonscript
Last synced: 8 days ago
JSON representation
modern database :)
- Host: GitHub
- URL: https://github.com/wynwxst/jsonscript
- Owner: wynwxst
- Created: 2021-11-26T09:41:58.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-09T01:14:14.000Z (about 3 years ago)
- Last Synced: 2024-11-13T04:34:01.745Z (2 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JsonScript
modern database :)A modern database based on sql
### Purpose
Learning multiple ways to use databases is annoying and a waste of timeThe main advantage would be the fact that it is cross language and cross platform
The requirements a language must fullfil are:
- Can read and write files (for better customisation)
- Can access shell (bare minimum)For example, bash
```bash
touch example.jsc
echo "CREATE exampletwo" > example.jsc
jsc example.jsc
```Python
```python
import os
os.system("touch example.jsc")
with open("example.jsc","w") as x:
x.write("CREATE exampletwo")
os.system("jsc example.jsc")
```You may also add or make wrappers for example,
Python:
```python
#jsc.py
import os
class JsonScript:
def CREATE(name,tocreate):
files = []
for file in os.listdir(f"{os.getcwd()}"):
files.append(file)
os.system(f"touch {name}")
with open("example.jsc","w") as x:
x.write(f"CREATE {tocreate}")
```You may then call it by:
```python
from jsc import JsonScript
JsonScript.CREATE("example","exampletwo")
```and so on and so on
The aim of JsonScript is also to imitate the ways of sql but for json as sql is easier to understand in .sql files
This is because it looks something like this
```sql
SELECT x
USE example;
```Meanwhile JsonScript
```
SELECT hello
USE example
```Selecting multiple
```
SELECT hello, hi
SELECT hola,hey
USE example
```If the value is not just one away
eg.
the json:
```json
{"hello":{"hi":"I need hi","bye":"don't need this"}}
```
the JsonScript:
```
SELECT hello:hi
USE example
SHOW
```
output:
```json
{"hello":{"hi":"I need hi"}}
```To show the database in json simply add
```
SELECT hello
USE example
SHOW
```To create a database:
```
CREATE example
```
If the file already exists it will be ignoredTo delete a database:
```
DELETE example
```
If the file doesn't exists it passes overTo insert values:
json:
```json
{}
```JsonScript:
```
USE example
INSERT this:is AS an example
SHOW example
```Output:
```json
{"this":{"is":"an example"}}
```Leave blank for the most previously defined USE to show
### TODO :
[-] SELECT, USE and SHOW[-] INSERT
[ ] GET