-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:stac-utils/pgstac into main
- Loading branch information
Showing
7 changed files
with
1,634 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""PyPGStac Version.""" | ||
__version__ = "0.3.0" | ||
__version__ = "0.3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SET SEARCH_PATH to pgstac, public; | ||
set check_function_bodies = off; | ||
|
||
CREATE OR REPLACE FUNCTION pgstac.sort_sqlorderby(_search jsonb DEFAULT NULL::jsonb, reverse boolean DEFAULT false) | ||
RETURNS text | ||
LANGUAGE sql | ||
AS $function$ | ||
WITH sorts AS ( | ||
SELECT | ||
(items_path(value->>'field')).path as key, | ||
parse_sort_dir(value->>'direction', reverse) as dir | ||
FROM jsonb_array_elements( | ||
'[]'::jsonb | ||
|| | ||
coalesce(_search->'sortby','[{"field":"datetime", "direction":"desc"}]') | ||
|| | ||
'[{"field":"id","direction":"desc"}]'::jsonb | ||
) | ||
) | ||
SELECT array_to_string( | ||
array_agg(concat(key, ' ', dir)), | ||
', ' | ||
) FROM sorts; | ||
$function$ | ||
; | ||
|
||
|
||
|
||
INSERT INTO migrations (version) VALUES ('0.3.1'); |
Oops, something went wrong.