graphql-engine/server/testcases/update_ops.json
2018-06-28 00:32:00 +05:30

118 lines
2.5 KiB
JSON

{
"description": "json and jsonb column type test",
"depends": [],
"items": [
{
"name": "create_schema",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_table",
"body":
{
"primary_key": [
"id"
],
"name": "a",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "integer",
"name": "a"
},
{
"type": "timetz",
"name": "b",
"default": "03:21:55+00:00"
},
{
"type": "varchar",
"name": "c"
}
]
}
}
},
{
"name": "create entry",
"url": "/api/1/table/a/insert",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"objects": [
{
"a": 1,
"b": "04:21:55+00:00",
"c": "World"
}
]
}
},
{
"name": "inc and default update",
"url": "/api/1/table/a/update",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"response": {"returning":[{"a":21,"b":"03:21:55+00"}],"affected_rows":1},
"request": {
"where": {},
"$set": {"c": "Hello"},
"$inc": {
"a" : 20
},
"$default": ["b"],
"returning": ["a", "b"]
}
},
{
"name": "mul update",
"url": "/api/1/table/a/update",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"response": {"returning":[{"a":420,"b":"03:21:55+00"}],"affected_rows":1},
"request": {
"where": {},
"$mul": {
"a" : 20
},
"returning": ["a", "b"]
}
},
{
"name": "multiple column appearences",
"url": "/api/1/table/a/update",
"role": "admin",
"status_code": 400,
"method": "POST",
"user_id": "1",
"response": {"path":"$","error":"syntax error. \"multiple assignments to same column \\\"a\\\"\""},
"request": {
"where": {},
"$inc": {
"a" : 20
},
"$mul": {
"a" : 20
},
"returning": ["a", "b"]
}
}
]
}