Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

mentalblood0/bottomless_ReJSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

123 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚿ bottomless_ReJSON

Library for seamless Redis database management. This version uses RedisJSON module


  • πŸ’€ No excess data reading/rewriting
  • πŸ—ƒ Integrated indexes support
  • β›“ Thread-safe operations
  • πŸ‘οΈ One-class interface
  • πŸͺ„ A lot of sugar

πŸ’Ώ Installation

python -m pip install bottomless_ReJSON

βœ’οΈ Usage

Here are just a few examples

Feel free to use the tests as a manual

Preparations

from bottomless_ReJSON import RedisInterface

db = RedisInterface(host='localhost', port='6379')

Dictionary-like interface

db.clear()
d = {
    '1': {
        '1': {
            '1': 'one.one.one'
        },
        '2': 'one.two'
    },
    '2': 'two'
}
db |= d
assert db() == d

db['2'] = d
assert db['2']() == d

db['1']['1'] = 'lalala'
assert db['1']['1'] == 'lalala'
assert db['1']['1']['1'] == None

List-like interface

db.clear()
db['key'] = []
db = db['key']

l = [1, 2, 3]
db += [1, 2, 3]

i = 0
for e in db:
    # e is RedisInterface instance,
    # so to get data you need to call it:
    assert e() == l[i]
    assert e() == db[i]
    i += 1

    assert list(db) == [1, 2, 3]

πŸ”¬ Testing

git clone https://codeberg.org/mentalblood/bottomless_ReJSON
cd bottomless_ReJSON
pytest tests

πŸ“ˆ Benchmarking

Using sharpener:

git clone https://codeberg.org/mentalblood/bottomless_ReJSON
cd bottomless_ReJSON
py -m sharpener run

Config for benchmarks can be found in benchmarks/benchmark_default.json

About

Library for seamless Redis database management

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages