Skip to content

Commit 0bf739f

Browse files
committed
update examples
1 parent d9228e8 commit 0bf739f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/example.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# create instance
88
jb = JsonBox()
99

10-
data = [{"name": "David", "age": "25"}, {"name": "Alice", "age": "19"}]
10+
data = [{"name": "first", "age": 25}, {"name": "second", "age": 19}]
1111

1212
# write data
1313
result = jb.write(data, MY_BOX_ID)
@@ -24,6 +24,16 @@
2424
# read all records in box with sort
2525
print(jb.read(MY_BOX_ID, sort_by="age"))
2626

27+
# read records in box with sort matching query (see documentation for syntax)
28+
print(jb.read(MY_BOX_ID, query="name:firs*"))
29+
print(jb.read(MY_BOX_ID, query="age:=19"))
30+
31+
# read records with limit
32+
print(jb.read(MY_BOX_ID, limit=1))
33+
34+
# read records with skip
35+
print(jb.read(MY_BOX_ID, skip=1))
36+
2737
# update data
2838
data = {"name": "Bob", "age": "25"}
2939
jb.update(data, MY_BOX_ID, record_ids[0])

0 commit comments

Comments
 (0)