-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
46 lines (38 loc) · 1.29 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from hyperlite.collection import Collection
from hyperlite import *
from hyperlite.event import Event
from code import InteractiveConsole
connection = None
console = InteractiveConsole(globals())
import json
def onResponse(response: str):
data = json.loads(response)
data = json.dumps(data, indent=4, sort_keys=True)
print(data)
def onRequest(request: str):
if connection is not None:
connection.sendRequest(request)
if __name__ == '__main__':
connection = Connection(host='localhost', port=8989)
Event.on('response', onResponse)
connection.connect()
showDatabases()
showCollections('test.db')
cities = Collection('cities')
data = {
"name":"indore",
"state":"mp"
}
cities.insertAll([data,data,data,data,data])
# cities.insert({"name":"indore"})
# cities.execHyperQl("city")
# cities.execHyperQl("*, city &eq \"KETCHIKAN\"")
# cities.execHyperQl("*, city &eq \"KETCHIKAN\", state &eq \"AK\", $limit: 1, $skip: 1")
# cities.readAll()
# with open(r"C:\Users\Anikesh\Desktop\zips.json") as dataset:
# for object in dataset.readlines():
# pass
# if connection.connect():
# console.interact("Welcome to hyperShell", "Bye!")
# else:
# print("Server is not running")