Update README and example with more detailed information
This commit is contained in:
parent
3d42d8d574
commit
7bf32f7966
28
README.md
28
README.md
|
@ -5,9 +5,12 @@ redistructures ?
|
||||||
Dictionary, List, Set, Queue, Counter implemented in python with redis data store under the hood
|
Dictionary, List, Set, Queue, Counter implemented in python with redis data store under the hood
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
All examples in `example/structures.py`
|
||||||
|
|
||||||
|
Dictionary example :
|
||||||
```python
|
```python
|
||||||
from redistructures import Struct
|
from redistructures import Struct
|
||||||
d = Struct.dictionary()
|
d = Struct.dictionary('hey')
|
||||||
d['x'] = 'y'
|
d['x'] = 'y'
|
||||||
d['w'] = 'v'
|
d['w'] = 'v'
|
||||||
print(d['x'])
|
print(d['x'])
|
||||||
|
@ -20,3 +23,26 @@ for v in d.values():
|
||||||
for k, v in d.items():
|
for k, v in d.items():
|
||||||
print(k, v)
|
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'
|
||||||
|
```
|
||||||
|
|
|
@ -69,9 +69,15 @@ def test_list():
|
||||||
print(e)
|
print(e)
|
||||||
print('-'*50)
|
print('-'*50)
|
||||||
|
|
||||||
|
def test_dict2():
|
||||||
|
d = Struct.dictionary()
|
||||||
|
for k, v in d.items():
|
||||||
|
print(k, v)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_dict()
|
test_dict()
|
||||||
test_set()
|
test_set()
|
||||||
test_counter()
|
test_counter()
|
||||||
test_queue()
|
test_queue()
|
||||||
test_list()
|
test_list()
|
||||||
|
test_dict2()
|
||||||
|
|
Loading…
Reference in New Issue