A library to make working with JSON files simpler
Project description
datajs
A library to make working with JSON files simpler
Hot to use
All you have to do is specify a JSON file, along with the database name and collection
import datajs
js = datajs.JS_file("data.json")
js.database = "data"
js.collection = "collect"
js.start()
Note
The JSON file must be in the same project file. If it is in another file, the path must be specified
How to fetch data
The library contains a function called find that enables you to add a specific condition from which to retrieve data
json_data = js.find({"age": 15}, "one")
How to add data
The library contains a function called insert that enables you to add the data you want
js.insert({"name": "ahmed", "age": 17})
How to update data
The library contains a function called update that allows you to add a condition to retrieve old data and change it
js.update({"age": 15}, {"name": "yassen"}, "all")
How to delete data
The library contains a function called delete that enables you to add a condition to delete the data you want
js.delete({"age": 15}, "all")
Note
In all the functions mentioned except for the insert function, there is something called option with two options. The first is "one", which means that the function works on the first data in the database, and the other is "all", which means that the function works on all the data according to the condition that you added
How to delete database
The library has a function called delete_database that allows you to delete the database you want
js.delete_database("database_name")
How to delete collection
The library has a function called delete_collection that allows you to delete the collection you want
js.delete_collection("collection_name")
How to get databases
The library has a function called get_database which allows you to find out your databases
databases = js.get_database()
How to get collection
The library has a function called get_collection which allows you to find out your collections
collections = js.get_collection()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file datajs-5.0.tar.gz.
File metadata
- Download URL: datajs-5.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9c1789ebef139f39dcae1afbf05a40f054b58ad39efa0e3039d3eef742e3219
|
|
| MD5 |
d2ae1ea57c91d6c295dd5c94de14d86b
|
|
| BLAKE2b-256 |
93ca3aa2993bd8171c837a3a1e05572f05fc772b22c111e107f6596eaa3e4910
|