libdb


Namelibdb JSON
Version 4.6.0 PyPI version JSON
download
home_pagehttps://github.com/libdb/libdb
SummaryEasy Management and Creation of Database Based on JSON Format with High Speed and Optimized
upload_time2024-07-31 18:31:18
maintainerNone
docs_urlNone
authorMmdrza
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # libdb

Easy Management and Creation of Database Based on JSON Format with High Speed and Optimized.

---
- [Installation](#installation)
  - [Install With pip in Windows](#install-with-pip-in-windows)
  - [Install With pip3 in Linux](#install-with-pip3-in-linux)
  - [Install With Git](#install-with-git)
    - [Windows (python)](#windows-python)
    - [Linux (python3)](#linux-python3)
- [Usage](#usage)
  - [Initializing the Database](#initializing-the-database)
  - [Creating a New Entry](#creating-a-new-entry)
  - [Bulk Creating Entries](#bulk-creating-entries)
  - [Updating an Entry](#updating-an-entry)
  - [Deleting an Entry](#deleting-an-entry)
  - [Listing All Keys](#listing-all-keys)
  - [Clearing the Database](#clearing-the-database)
  - [Searching for Entries](#searching-for-entries)
- [Running Tests](#running-tests)
---

## Installation
### Install With `pip` in Windows:
```bash
pip install libdb
```
### Install With `pip3` in Linux:
```bash
# if not installed pip3
sudo apt-get update&&sudo apt-get install python3-pip 
# Install With pip3 command
pip3 install libdb
```
### Install With Git
```bash
git clone https://github.com/libdb/libdb
cd libdb
```
### Git Option's

Windows (python)
```bash
# Install Libdb in windows
python install.py
# Just upgrade libdb in windows
python install.py upgrade
```
Linux (python3)
```bash
# Install Libdb in Linux
python3 install.py
# Just upgrade libdb in Linux
python3 install.py upgrade
```
## Usage

Here are some examples to demonstrate how to use the LibDB package.
### Initializing the Database:
```python
from libdb import JSONDatabase
# Initialize the database
db = JSONDatabase('mydb.json')
```
### Creating a New Entry

```python
db.create('name', 'Alice')
print(db.read('name'))  # Output: Alice
```
### Bulk Creating Entries
```python
items = {
    'name': 'Alice',
    'age': 30,
    'city': 'Wonderland'
}
db.bulk_create(items)
print(db.read('age'))  # Output: 30
print(db.read('city'))  # Output: Wonderland
```
### Updating an Entry
```python
db.update('name', 'Bob')
print(db.read('name'))  # Output: Bob
```

### Deleting an Entry
```python
db.delete('name')
print(db.read('name'))  # Output: None
```
### Listing All Keys
```python
list_keys = db.list_keys()
print(list_keys)  # Output: ['age', 'city']
```
### Clearing the Database
```python
db.clear()
print(db.list_keys())  # Output: []
```
### Searching for Entries
```python
users = {
    'user1': {'name': 'Alice', 'age': 30},
    'user2': {'name': 'Bob', 'age': 25},
    'user3': {'name': 'Charlie', 'age': 30}
}
db.bulk_create(users)
result = db.search('age', 30)
print(result)  # Output: {'user1': {'name': 'Alice', 'age': 30}, 'user3': {'name': 'Charlie', 'age': 30}}
```
## Running Tests
You can run the tests to ensure everything is working correctly:
```bash
python -m unittest discover tests
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/libdb/libdb",
    "name": "libdb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Mmdrza",
    "author_email": "Pymmdrza@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/10/2d/512e029a5b9595fcba2a3197785ff238de3e059fcfd553e9043f0111c59f/libdb-4.6.0.tar.gz",
    "platform": null,
    "description": "# libdb\n\nEasy Management and Creation of Database Based on JSON Format with High Speed and Optimized.\n\n---\n- [Installation](#installation)\n  - [Install With pip in Windows](#install-with-pip-in-windows)\n  - [Install With pip3 in Linux](#install-with-pip3-in-linux)\n  - [Install With Git](#install-with-git)\n    - [Windows (python)](#windows-python)\n    - [Linux (python3)](#linux-python3)\n- [Usage](#usage)\n  - [Initializing the Database](#initializing-the-database)\n  - [Creating a New Entry](#creating-a-new-entry)\n  - [Bulk Creating Entries](#bulk-creating-entries)\n  - [Updating an Entry](#updating-an-entry)\n  - [Deleting an Entry](#deleting-an-entry)\n  - [Listing All Keys](#listing-all-keys)\n  - [Clearing the Database](#clearing-the-database)\n  - [Searching for Entries](#searching-for-entries)\n- [Running Tests](#running-tests)\n---\n\n## Installation\n### Install With `pip` in Windows:\n```bash\npip install libdb\n```\n### Install With `pip3` in Linux:\n```bash\n# if not installed pip3\nsudo apt-get update&&sudo apt-get install python3-pip \n# Install With pip3 command\npip3 install libdb\n```\n### Install With Git\n```bash\ngit clone https://github.com/libdb/libdb\ncd libdb\n```\n### Git Option's\n\nWindows (python)\n```bash\n# Install Libdb in windows\npython install.py\n# Just upgrade libdb in windows\npython install.py upgrade\n```\nLinux (python3)\n```bash\n# Install Libdb in Linux\npython3 install.py\n# Just upgrade libdb in Linux\npython3 install.py upgrade\n```\n## Usage\n\nHere are some examples to demonstrate how to use the LibDB package.\n### Initializing the Database:\n```python\nfrom libdb import JSONDatabase\n# Initialize the database\ndb = JSONDatabase('mydb.json')\n```\n### Creating a New Entry\n\n```python\ndb.create('name', 'Alice')\nprint(db.read('name'))  # Output: Alice\n```\n### Bulk Creating Entries\n```python\nitems = {\n    'name': 'Alice',\n    'age': 30,\n    'city': 'Wonderland'\n}\ndb.bulk_create(items)\nprint(db.read('age'))  # Output: 30\nprint(db.read('city'))  # Output: Wonderland\n```\n### Updating an Entry\n```python\ndb.update('name', 'Bob')\nprint(db.read('name'))  # Output: Bob\n```\n\n### Deleting an Entry\n```python\ndb.delete('name')\nprint(db.read('name'))  # Output: None\n```\n### Listing All Keys\n```python\nlist_keys = db.list_keys()\nprint(list_keys)  # Output: ['age', 'city']\n```\n### Clearing the Database\n```python\ndb.clear()\nprint(db.list_keys())  # Output: []\n```\n### Searching for Entries\n```python\nusers = {\n    'user1': {'name': 'Alice', 'age': 30},\n    'user2': {'name': 'Bob', 'age': 25},\n    'user3': {'name': 'Charlie', 'age': 30}\n}\ndb.bulk_create(users)\nresult = db.search('age', 30)\nprint(result)  # Output: {'user1': {'name': 'Alice', 'age': 30}, 'user3': {'name': 'Charlie', 'age': 30}}\n```\n## Running Tests\nYou can run the tests to ensure everything is working correctly:\n```bash\npython -m unittest discover tests\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easy Management and Creation of Database Based on JSON Format with High Speed and Optimized",
    "version": "4.6.0",
    "project_urls": {
        "Homepage": "https://github.com/libdb/libdb"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4a231f4ce4b722087c7f497b4eb2ecf57168dc8125302135878601a1584f916",
                "md5": "d21b2d3d99e402e24acc89c3f931b85b",
                "sha256": "b6cd9aef48e0be09387a760a82535861225871e002494858fbaf8508c5dabd9f"
            },
            "downloads": -1,
            "filename": "libdb-4.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d21b2d3d99e402e24acc89c3f931b85b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4719,
            "upload_time": "2024-07-31T18:31:16",
            "upload_time_iso_8601": "2024-07-31T18:31:16.902274Z",
            "url": "https://files.pythonhosted.org/packages/e4/a2/31f4ce4b722087c7f497b4eb2ecf57168dc8125302135878601a1584f916/libdb-4.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "102d512e029a5b9595fcba2a3197785ff238de3e059fcfd553e9043f0111c59f",
                "md5": "5abd94be60798e12a00984ca151c10c5",
                "sha256": "665aa59b5a97cc192d2dd91d37ea476801406af927c93d16d2fbef953b5e73d8"
            },
            "downloads": -1,
            "filename": "libdb-4.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5abd94be60798e12a00984ca151c10c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4551,
            "upload_time": "2024-07-31T18:31:18",
            "upload_time_iso_8601": "2024-07-31T18:31:18.099014Z",
            "url": "https://files.pythonhosted.org/packages/10/2d/512e029a5b9595fcba2a3197785ff238de3e059fcfd553e9043f0111c59f/libdb-4.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-31 18:31:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "libdb",
    "github_project": "libdb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "libdb"
}
        
Elapsed time: 0.27632s