Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
06d14662
Commit
06d14662
authored
2 months ago
by
Dan Notestein
Browse files
Options
Downloads
Patches
Plain Diff
speed up json checking
parent
442bef9b
No related branches found
No related tags found
2 merge requests
!827
Merge develop changes to master
,
!814
speed up json checking
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/db/sql_scripts/postgrest/home.sql
+11
-8
11 additions, 8 deletions
hive/db/sql_scripts/postgrest/home.sql
hive/db/sql_scripts/postgrest/utilities/check_general_json_format.sql
+2
-2
2 additions, 2 deletions
...scripts/postgrest/utilities/check_general_json_format.sql
with
13 additions
and
10 deletions
hive/db/sql_scripts/postgrest/home.sql
+
11
−
8
View file @
06d14662
...
...
@@ -8,13 +8,20 @@ $$
DECLARE
__request_data
JSON
=
$
1
;
__id
JSONB
;
__params
JSON
;
__params_jsonb
JSONB
;
__request_params
JSONB
;
BEGIN
__id
=
__request_data
->
'id'
;
__params
=
__request_data
->
'params'
;
IF
__params
is
NULL
THEN
RETURN
jsonb_build_object
(
'jsonrpc'
,
'2.0'
,
'error'
,
'no parameters passed'
,
'id'
,
__id
);
END
IF
;
__params_jsonb
=
__params
::
JSONB
;
__request_params
=
hivemind_postgrest_utilities
.
check_general_json_format
(
__request_data
->>
'jsonrpc'
,
__request_data
->>
'method'
,
(
__
request_data
->
'params'
)::
JSONB
,
__
params_jsonb
,
__id
);
RETURN
jsonb_build_object
(
...
...
@@ -22,17 +29,13 @@ BEGIN
'id'
,
__id
,
'result'
,
hivemind_postgrest_utilities
.
dispatch
(
__request_params
->>
'api_type'
,
__request_params
->>
'method_type'
,
__
request_params
->
'params'
__
params_jsonb
)
);
EXCEPTION
WHEN
raise_exception
THEN
RETURN
jsonb_build_object
(
'jsonrpc'
,
'2.0'
,
'error'
,
SQLERRM
::
JSONB
,
'id'
,
__id
);
RETURN
jsonb_build_object
(
'jsonrpc'
,
'2.0'
,
'error'
,
SQLERRM
::
JSONB
,
'id'
,
__id
);
END
$$
;
...
...
This diff is collapsed.
Click to expand it.
hive/db/sql_scripts/postgrest/utilities/check_general_json_format.sql
+
2
−
2
View file @
06d14662
...
...
@@ -28,8 +28,8 @@ BEGIN
__params
=
jsonb_build_object
(
'used_call_keyword'
,
True
,
'params'
,
__params
->
2
);
ELSE
SELECT
s
ubstring
(
__method
FROM
'^[^.]+'
)
INTO
__api_type
;
SELECT
s
ubstring
(
__method
FROM
'[^.]+$'
)
INTO
__method_type
;
SELECT
s
plit_part
(
__method
,
'.'
,
1
)
INTO
__api_type
;
SELECT
s
plit_part
(
__method
,
'.'
,
2
)
INTO
__method_type
;
END
IF
;
RETURN
jsonb_build_object
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment