Skip to main content

simple json database lib

Project description

jsodb

Mine database realization that uses .json files.

How to work with it?

Instalation: python3 -m pip install jsodb

Basic funcs:

import jdb
getkeyval("key") # returns key val
addkey(key=val) # adds keys to json
changekey("key", val) # changes key to new val
createjson("/path/to/file" """without .json""") # new .json file (without decorator)
addtokey("key", int) # key += int
subfromkey("key", int) # key -= int
addmultikey("key", key=val, key2=val2) # new multi key {key: {"key": "val", "key2", "val2"}}
@json("/path/to/file") # main decorator

To use all that functions you need function with decorator, json file will be: opened, edited, saved.

Basic usage:

@json("profile.json")
def func():
	print(getkeyval(balance)) ### 1
	changekey(balance, 10) ### {balance=10}
	addkey(deposit=100) ### {balance=10, deposit=100}
	print(f"{getkeyval(balance)}\n{getkeyval(deposit)}")
	"""
	10
	100
	"""

func() ### changes applied

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsodb-1.6.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

jsodb-1.6.0-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page