Skip to content

Commit c2ce9d5

Browse files
committed
easier navigation in the functions documentation
1 parent aef70fb commit c2ce9d5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

examples/official-site/component.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ select 'dynamic' as component, json_patch(json_extract(properties, '$[0]'), json
1111
)) as properties
1212
FROM example WHERE component = 'shell' LIMIT 1;
1313

14-
select
15-
'breadcrumb' as component;
14+
select 'breadcrumb' as component;
1615
select 'SQLPage' as title, '/' as link, 'Home page' as description;
1716
select 'Components' as title, '/documentation.sql' as link, 'List of all components' as description;
1817
select $component as title, '/component.sql?component=' || sqlpage.url_encode($component) as link;

examples/official-site/functions.sql

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
select 'dynamic' as component,
2-
json_set(
3-
properties,
4-
'$[0].title',
5-
'SQLPage functions' || COALESCE(': ' || $function, ' documentation')
6-
) as properties
1+
select 'dynamic' as component, properties
72
FROM example WHERE component = 'shell' LIMIT 1;
83

4+
select 'breadcrumb' as component;
5+
select 'SQLPage' as title, '/' as link, 'Home page' as description;
6+
select 'Functions' as title, '/functions.sql' as link, 'List of all functions' as description;
7+
select $function as title, sqlpage.link('functions.sql', json_object('function', $function)) as link where $function IS NOT NULL;
8+
99
select 'text' as component, 'SQLPage built-in functions' as title where $function IS NULL;
1010
select '
1111
In addition to normal SQL functions supported by your database,
@@ -28,10 +28,8 @@ from sqlpage_functions
2828
where $function IS NULL
2929
order by name;
3030

31-
select 'text' as component,
32-
'The sqlpage.' || $function || ' function' as title,
33-
'function' as id
34-
where $function IS NOT NULL;
31+
select 'text' as component, 'sqlpage.' || $function || '(' || string_agg(name, ', ') || ')' as title, 'function' as id
32+
from sqlpage_function_parameters where $function IS NOT NULL and "function" = $function;
3533

3634
select 'text' as component;
3735
select 'Introduced in SQLPage ' || introduced_in_version || '.' as contents, 1 as size from sqlpage_functions where name = $function;

0 commit comments

Comments
 (0)