Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 4a4521f

Browse files
All Utils
1 parent 51f6d3e commit 4a4521f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

quickmongo/Util.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Util Class
2+
# Some functions which are different from Base
3+
4+
class Util():
5+
6+
# Startswith filter
7+
def startswith(self, data, query: str):
8+
result = []
9+
10+
for doc in data:
11+
if(doc['key'].startswith(query)):
12+
result.append(doc)
13+
14+
return result
15+
16+
# To make dict to an object
17+
18+
class AttrDict():
19+
20+
def __init__(self, paramdict: dict):
21+
for key in paramdict:
22+
setattr(self, key, paramdict[key])

0 commit comments

Comments
 (0)