mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-18 01:31:02 +02:00
Changed schema to add batching
This commit is contained in:
parent
1762ecaf90
commit
1b2de0c76f
4 changed files with 274 additions and 155 deletions
|
|
@ -32,9 +32,18 @@ print(json.dumps(resp, indent=4))
|
|||
|
||||
input = {
|
||||
"operation": "put",
|
||||
"type": "test",
|
||||
"key": "key1",
|
||||
"value": "value1"
|
||||
"values": [
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key1",
|
||||
"value": "value1"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key2",
|
||||
"value": "value2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
|
|
@ -57,9 +66,13 @@ print(json.dumps(resp, indent=4))
|
|||
|
||||
input = {
|
||||
"operation": "put",
|
||||
"type": "test",
|
||||
"key": "key2",
|
||||
"value": "testing 1 2 3"
|
||||
"values": [
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key3",
|
||||
"value": "testing 1 2 3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
|
|
@ -82,8 +95,16 @@ print(json.dumps(resp, indent=4))
|
|||
|
||||
input = {
|
||||
"operation": "get",
|
||||
"type": "test",
|
||||
"key": "key2",
|
||||
"keys": [
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key2"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
|
|
@ -150,7 +171,7 @@ print(json.dumps(resp, indent=4))
|
|||
############################################################################
|
||||
|
||||
input = {
|
||||
"operation": "getall",
|
||||
"operation": "getvalues",
|
||||
"type": "test"
|
||||
}
|
||||
|
||||
|
|
@ -172,3 +193,56 @@ print(json.dumps(resp, indent=4))
|
|||
|
||||
############################################################################
|
||||
|
||||
input = {
|
||||
"operation": "delete",
|
||||
"keys": [
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key1"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"key": "key3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
f"{url}config",
|
||||
json=input,
|
||||
)
|
||||
|
||||
if resp.status_code != 200:
|
||||
raise RuntimeError(f"Status code: {resp.status_code}")
|
||||
|
||||
resp = resp.json()
|
||||
|
||||
if "error" in resp:
|
||||
print(f"Error: {resp['error']}")
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps(resp, indent=4))
|
||||
|
||||
############################################################################
|
||||
|
||||
input = {
|
||||
"operation": "config"
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
f"{url}config",
|
||||
json=input,
|
||||
)
|
||||
|
||||
if resp.status_code != 200:
|
||||
raise RuntimeError(f"Status code: {resp.status_code}")
|
||||
|
||||
resp = resp.json()
|
||||
|
||||
if "error" in resp:
|
||||
print(f"Error: {resp['error']}")
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps(resp, indent=4))
|
||||
|
||||
############################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue