No project description provided
Project description
All rights are reserved to Name.
data
get a data
check if a data exist
get (select)
parameters : valueName(str), Category(optional(str))
if value is None value will return None
import namedb
print(f'Price : {namedb.get("price")}')
error handling
exemple :
import namedb
try:
namedb.get('a world without taxes')
except namedb.ValueNotExist:
print('Damn it')
Mutli-tasking select more then one thing using || to separate them
return a list of all of the arugments instanid of just the argument
exemple :
import namedb
thing = namedb.get('a life|| a world without taxes')
print(thing[0])
print(thing[1])
search (exist)
parameters : valueName(str), Category(optional(str))
if value exist it will return True (bool)
else False
import namedb
var = namedb.search('price')
if var:
print('Give me your money!')
mutli-tasking separate differents ellement with ||
return True is all the values exist else it return False
import namedb
var = namedb.search('price||due')
if var:
print('Give me your money!')
edit-data
add (aadd)
parameters : ValueName(str), Value(Any), Category(optional(str))
if worked it will return True else False
import namedb
namedb.add('price', 90)
error handling
exemple :
import namedb
try:
namedb.add('taxes', 0.19)
except namedb.ValueAlreadyExist:
print('Damn it')
edit (replace)
Big updates with edit
edit-value
parameters : valuename(str), value(any)
import namedb
namedb.edit('taxes', 'does not exist')
add to a number
parameters : valuename(str), add(int)
import namedb
namedb.edit('tomatostock', add=3)
minus to a number
parameters : valuename(str), minus(int)
import namedb
namedb.edit('tomatostock', minus=5)
append to a list
parameters : valuename(str), append(any)
import namedb
namedb.edit('product', append='tomato')
remove to a list
parameters : valuename(str), remove(any)
import namedb
namedb.edit('product', remove='tomato')
remove (delete)
parameters : ValueName(str), cache(optional(bool)), Category(optional(str))
if worked it will return True else False
stock the value in the cache if cache is true (false by default)
import namedb
namedb.remove('price')
error handling
exemple :
import namedb
try:
namedb.remove('a world without taxes')
except namedb.ValueNotExist:
print('Damn it')
mutli-tasking separate the values that you want to delete with ||
import namedb
namedb.remove('price||due')
json
just transfer json for now
transferjson (atransferjson)
parameters : Data(json), Category(optional(str))
if worked it will return True else False
import namedb
jsoncode = {
'price': 90,
'due': 60
}
namedb.transferjson(jsoncode)
print(f'{namedb.get("price")}')
prefix
find or edit data with a prefix
prefix (aprefix)
parameters : type(value or name), prefix(str), Category(optional(str))
return a list with all the files that starts with the prefix
import namedb
for costumer in namedb.prefix(type='value', 'costumersdue'):
print(f'Due : {costumer}')
error handling
exemple :
import namedb
try:
namedb.prefix('hi', 'taxes')
except ValueError:
print('Damn it')
clearprefix (cleanprefix)
parameters : prefix(str), Category(optional(str))
delete all the values that starts with the prefix
import namedb
namedb.clearprefix('due')
cache
Restore data or remove data with a prefix or without
restore (arestore)
parameters : valuename(str), Category(optional(str))
restore a value from the cache (and return it)
import namedb
namedb.remove('taxes')
print('too good to be real')
namedb.restore('taxes')
error handling
exemple :
import namedb
try:
namedb.restore('a world without taxes')
except namedb.ValueNotExist:
print('Damn it')
clearcache (cleancache)
parameters : None clear the cache
import namedb
namedb.remove('money')
namedb.clearcache()
clearcacheprefix (cleancacheprefix)
parameters : prefix(str), Category(optional(str)) clear the cache with a prefix
import namedb
namedb.remove('exemple2286')
namedb.clearcacheprefix('exemple')
category
create a category or remove it
We highly recommend using category
createcat (acreatecat)
Parameters : categoryname(str)
Create a category
import namedb
namedb.createcat('example')
deletecat (adeletecat)
Parameters : categoryname(str)
Delete a category
import namedb
namedb.deletecat('example')
listcat (alistcat)
parameters : catname(str), type(str ["name", "value"])
list all values or name
import namedb
for value in namedb.listcat('stock', 'name'):
print(value)
async
everything work the same just change the name of the fonction example :
import namedb
async def get_money(user_id: str):
value = await namedb.select(f'money{user_id}')
return value
setup
install setup.py and run it (answers the questions)
Directory path (example : C:/windows/desktop/my/project/) : C:/windows/Users/Me/Pycharm/project/
migrating from version 1.6
multi-tasking now exist
example:
import namedb
namedb.remove('taxes||bad things')
recommandation
Please use try: and except: if you run a constant code because this errors can make your code stop
We higly recommend using category
We aren't responsible for data lost.
bonus
This is one of the last versions of this database because I havte no ideas of what to do now except optimisation so don't expect big changes for the next versions it's probably be like backend optimisations
I will check to publish this as python package btw
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
Built Distribution
File details
Details for the file namedb-1.7.tar.gz
.
File metadata
- Download URL: namedb-1.7.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b398796b2b718d983ac2555477525915bc3e3bf8c6450665a58837e40de15b82 |
|
MD5 | 90884f0afed9d9f0a3eb43d126033cae |
|
BLAKE2b-256 | c671e8d1a4ec6af12e7d20f65d0e6ebc39de422653ac486725bbc9261d5d226f |
File details
Details for the file namedb-1.7-py3-none-any.whl
.
File metadata
- Download URL: namedb-1.7-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96df8f8ca06f4655e8fce197cb39dfd4b0dbc68dde73b9965a65960a518007a1 |
|
MD5 | 01d991e44952c9a3fd492b1a03e1b379 |
|
BLAKE2b-256 | c5b386743bc478373355be53c4ee791d2ab5c55b4afca642b47cb67651ccd9ca |