Update README and example with more detailed information

This commit is contained in:
Michal Szczepanski 2020-08-17 17:26:08 +02:00
parent 3d42d8d574
commit 7bf32f7966
2 changed files with 33 additions and 1 deletions

View File

@ -5,9 +5,12 @@ redistructures ?
Dictionary, List, Set, Queue, Counter implemented in python with redis data store under the hood
### Examples
All examples in `example/structures.py`
Dictionary example :
```python
from redistructures import Struct
d = Struct.dictionary()
d = Struct.dictionary('hey')
d['x'] = 'y'
d['w'] = 'v'
print(d['x'])
@ -20,3 +23,26 @@ for v in d.values():
for k, v in d.items():
print(k, v)
```
output
```
b'y'
True
False
b'dict:x'
b'dict:w'
b'y'
b'v'
b'dict:x' b'y'
b'dict:w' b'v'
```
After next run
```
d = Struct.dictionary('hey')
for k, v in d.items():
print(k, v)
```
output
```
b'dict:x' b'y'
b'dict:w' b'v'
```

View File

@ -69,9 +69,15 @@ def test_list():
print(e)
print('-'*50)
def test_dict2():
d = Struct.dictionary()
for k, v in d.items():
print(k, v)
if __name__ == '__main__':
test_dict()
test_set()
test_counter()
test_queue()
test_list()
test_dict2()