From 6e3e1344daebb2eefb46e3521c41d2aa1a6a7862 Mon Sep 17 00:00:00 2001 From: Ophir Lojkine Date: Sat, 28 Nov 2026 23:46:34 +0000 Subject: [PATCH] Move JSON and RSS feed references to Markdown --- .../official-site/content/components/json.md | 39 +++ .../components/json/examples/01-array.md | 30 ++ .../components/json/examples/02-jsonlines.md | 30 ++ .../json/examples/03-custom-response.md | 42 +++ .../json/examples/04-server-sent-events.md | 25 ++ .../official-site/content/components/rss.md | 128 ++++++++ .../rss/examples/01-news-channel.md | 31 ++ .../sqlpage/migrations/11_json.sql | 211 ------------- .../sqlpage/migrations/37_rss.sql | 287 ------------------ .../migrations/82_reference_catalog.sql | 12 - 10 files changed, 325 insertions(+), 510 deletions(-) create mode 100644 examples/official-site/content/components/json.md create mode 100644 examples/official-site/content/components/json/examples/01-array.md create mode 100644 examples/official-site/content/components/json/examples/02-jsonlines.md create mode 100644 examples/official-site/content/components/json/examples/03-custom-response.md create mode 100644 examples/official-site/content/components/json/examples/04-server-sent-events.md create mode 100644 examples/official-site/content/components/rss.md create mode 100644 examples/official-site/content/components/rss/examples/01-news-channel.md delete mode 100644 examples/official-site/sqlpage/migrations/11_json.sql delete mode 100644 examples/official-site/sqlpage/migrations/37_rss.sql diff --git a/examples/official-site/content/components/json.md b/examples/official-site/content/components/json.md new file mode 100644 index 000000000..81c48edce --- /dev/null +++ b/examples/official-site/content/components/json.md @@ -0,0 +1,39 @@ +--- +icon: code +since: 0.9.0 +category: http-responses +summary: Return query results as JSON for an API. +top: + - name: contents + type: TEXT + description: A single JSON payload to send. You can use your database's built-in json functions to build + the value to enter here. If not provided, the contents will be taken from the next SQL statements and + rendered as a JSON array. + - name: type + type: TEXT + description: |- + The type of the JSON payload to send: "array", "jsonlines", or "sse". + In "array" mode, each query result is rendered as a JSON object in a single top-level array. + In "jsonlines" mode, results are rendered as JSON objects in separate lines, without a top-level array. + In "sse" mode, results are rendered as JSON objects in separate lines, prefixed by "data: ", which allows you to read the results as server-sent events in real-time from javascript. +--- + +Converts SQL query results into the JSON machine-readable data format. Ideal to quickly build APIs for interfacing with external systems. + +**JSON** is a widely used data format for programmatic data exchange. +For example, you can use it to integrate with web services written in different languages, +with mobile or desktop apps, or with [custom client-side components](/custom_components.sql) inside your SQLPage app. + +Use it when your application needs to expose data to external systems. +If you only need to render standard web pages, +and do not need other software to access your data, +you can ignore this component. + +This component **must appear at the top of your SQL file**, before any other data has been sent to the browser. +An HTTP response can have only a single datatype, and it must be declared in the headers. +So if you have already called the `shell` component, or another traditional HTML component, +you cannot use this component in the same file. + +SQLPage can also return JSON or JSON Lines when the incoming request says it prefers them with an HTTP `Accept` header, so the same `/users.sql` page can show a table in a browser but return raw data to `curl -H "Accept: application/json" http://localhost:8080/users.sql`. + +Use this component when you want to control the payload or force JSON output even for requests that would normally get HTML. diff --git a/examples/official-site/content/components/json/examples/01-array.md b/examples/official-site/content/components/json/examples/01-array.md new file mode 100644 index 000000000..8510c9305 --- /dev/null +++ b/examples/official-site/content/components/json/examples/01-array.md @@ -0,0 +1,30 @@ +## Send query results as a single JSON array: `'array' as type` + +The default `array` mode sends the query results as a single JSON array. + +If a query returns an error, the array will contain an object with an `error` property. + +If multiple queries are executed, all query results will be concatenated into a single array +of heterogeneous objects. + +### SQL + +```sql +select 'json' AS component; +select * from users; +``` + +### Result + +```json +[ + {"username":"James","userid":1}, + {"username":"John","userid":2} +] +``` + +Clients can also receive JSON or JSON Lines automatically by requesting the same SQL file with an HTTP `Accept` header such as `application/json` or `application/x-ndjson` when the component is omitted, for example: + +``` +curl -H "Accept: application/json" http://localhost:8080/users.sql +``` diff --git a/examples/official-site/content/components/json/examples/02-jsonlines.md b/examples/official-site/content/components/json/examples/02-jsonlines.md new file mode 100644 index 000000000..13357699b --- /dev/null +++ b/examples/official-site/content/components/json/examples/02-jsonlines.md @@ -0,0 +1,30 @@ +## Send one JSON object per row: `'jsonlines' as type` + +In `jsonlines` mode, each query result is rendered as a JSON object in a separate line, +without a top-level array. + +If there are no rows, the response body is empty. If there is a single row, the response is a JSON object. +If there are multiple query results, you will need to parse each line of the response as a separate JSON object. + +If a query returns an error, the response will be a JSON object with an `error` property. + +### SQL + +The following SQL creates an API endpoint that takes a `user_id` URL parameter +and returns a single JSON object containing the user's details, with one json object key per column in the `users` table. + +```sql +select 'json' AS component, 'jsonlines' AS type; +select * from users where id = $user_id LIMIT 1; +``` + +> Note the `LIMIT 1` clause. The `jsonlines` type will send one JSON object per result row, +> separated only by a single newline character (\n). +> So if your query returns multiple rows, the result will not be a single valid JSON object, +> like most JSON parsers expect. + +### Result + +```json +{ "username":"James", "userid":1 } +``` diff --git a/examples/official-site/content/components/json/examples/03-custom-response.md b/examples/official-site/content/components/json/examples/03-custom-response.md new file mode 100644 index 000000000..53ef56fbf --- /dev/null +++ b/examples/official-site/content/components/json/examples/03-custom-response.md @@ -0,0 +1,42 @@ +## Create a complex API endpoint: the `'contents'` property + +You can create an API endpoint that will return a JSON value in any format you want, +to implement a complex API. + +You should use [the json functions provided by your database](/blog.sql?post=JSON%20in%20SQL%3A%20A%20Comprehensive%20Guide) to form the value you pass to the `contents` property. +To build a json array out of rows from the database, you can use: + - `json_group_array()` in SQLite, + - `json_agg()` in Postgres, or + - `JSON_ARRAYAGG()` in MySQL. + - `FOR JSON PATH` in SQL Server. + + +```sql +SELECT 'json' AS component, + JSON_OBJECT( + 'users', ( + SELECT JSON_GROUP_ARRAY( + JSON_OBJECT( + 'username', username, + 'userid', id + ) + ) FROM users + ) + ) AS contents; +``` + +This will return a JSON response that looks like this: + +```json +{ + "users" : [ + { "username":"James", "userid":1 } + ] +} +``` + +If you want to handle custom API routes, like `POST /api/users/:id`, +you can use + - the [`404.sql` file](/your-first-sql-website/custom_urls.sql) to handle the request despite the URL not matching any file, + - the [`request_method` function](/functions.sql?function=request_method#function) to differentiate between GET and POST requests, + - and the [`path` function](/functions.sql?function=path#function) to extract the `:id` parameter from the URL. diff --git a/examples/official-site/content/components/json/examples/04-server-sent-events.md b/examples/official-site/content/components/json/examples/04-server-sent-events.md new file mode 100644 index 000000000..d2c4c6a4e --- /dev/null +++ b/examples/official-site/content/components/json/examples/04-server-sent-events.md @@ -0,0 +1,25 @@ +## Access query results in real-time with server-sent events: `'sse' as type` + +Using server-sent events, you can stream large query results to the client in real-time, +row by row. + +This allows building sophisticated dynamic web applications that will start processing and displaying +the first rows of data in the browser while the database server is still processing the end of the query. + +### SQL + +```sql +select 'json' AS component, 'sse' AS type; +select * from users; +``` + +### JavaScript + +```javascript +const eventSource = new EventSource("users.sql"); +eventSource.onmessage = function (event) { + const user = JSON.parse(event.data); + console.log(user.username); +} +eventSource.onerror = () => eventSource.close(); // do not reconnect after reading all the data +``` diff --git a/examples/official-site/content/components/rss.md b/examples/official-site/content/components/rss.md new file mode 100644 index 000000000..e4c00061d --- /dev/null +++ b/examples/official-site/content/components/rss.md @@ -0,0 +1,128 @@ +--- +icon: rss +since: 0.20.0 +category: http-responses +summary: Publish an RSS feed from query results. +top: + - name: author + type: TEXT + description: Defines the group, person, or people responsible for creating the channel. + - name: category + type: TEXT + description: Defines the category of the channel. The value should be a string representing the category + (e.g., "News", "Technology", etc.). + - name: complete + type: BOOLEAN + description: Specifies that a channel is complete and will not post any more items in the future. + - name: copyright + type: TEXT + description: Provides the copyright details for the channel. + - name: description + type: TEXT + required: true + description: Describes the channel. + - name: explicit + type: BOOLEAN + description: Indicates whether the channel contains explicit content. The value can be either TRUE or FALSE. + - name: funding_text + type: TEXT + description: The text to display with the donation/funding link. Ignored unless "funding_url" is also set. + - name: funding_url + type: URL + description: Specifies the donation/funding links for the channel. The content of the tag is the recommended + string to be used with the link. + - name: guid + type: TEXT + description: The globally unique identifier (GUID) for a channel. The value is a UUIDv5. + - name: image_url + type: URL + description: Provides a URL linking to the artwork for the channel. + - name: language + type: TEXT + description: Defines the language of the channel, specified in the ISO 639 format. For example, "en" for + English, "fr" for French. + - name: link + type: URL + required: true + description: Defines the hyperlink to the channel. + - name: locked + type: BOOLEAN + description: Tells podcast hosting platforms whether they are allowed to import this feed. + - name: self_link + type: URL + description: URL of the RSS feed. + - name: sub_category + type: TEXT + description: Defines a sub-category, nested inside the "category". Ignored unless "category" is also set. + - name: title + type: TEXT + required: true + description: Defines the title of the channel. + - name: type + type: TEXT + description: Specifies the channel as either episodic or serial. The value can be either "episodic" or + "serial". +row: + - name: block + type: BOOLEAN + description: Prevents a specific item from appearing in podcast listening applications. + - name: date + type: TEXT + description: Indicates when the item was published (RFC-822 date-time). + - name: description + type: TEXT + required: true + description: Describes the item + - name: duration + type: INTEGER + description: The duration of an item in seconds. + - name: enclosure_length + type: INTEGER + description: The length in bytes of the audio/video episode content. + - name: enclosure_type + type: TEXT + description: The MIME media type of the audio/video episode content (e.g., "audio/mpeg", "audio/m4a", "video/m4v", + "video/mp4"). + - name: enclosure_url + type: URL + description: For podcast episodes, provides a URL linking to the audio/video episode content, in mp3, m4a, + m4v, or mp4 format. + - name: episode + type: INTEGER + description: The chronological number that is associated with an item. + - name: episode_type + type: TEXT + description: Defines the type of content for a specific item. The value can be either "full", "trailer", + or "bonus". + - name: explicit + type: BOOLEAN + description: Indicates whether the item contains explicit content. The value can be either TRUE or FALSE. + - name: guid + type: TEXT + description: The globally unique identifier (GUID) for an item. + - name: image_url + type: URL + description: Provides a URL linking to the artwork for the item. + - name: link + type: URL + required: true + description: Defines the hyperlink to the item (blog post URL, etc.). + - name: season + type: INTEGER + description: The chronological number associated with an item's season. + - name: title + type: TEXT + required: true + description: Defines the title of the feed item (episode name, blog post title, etc.). + - name: transcript_type + type: TEXT + description: The type of the transcript or closed captions file for the item (e.g., "text/plain", "text/html", + "text/vtt", "application/json", "application/x-subrip"). + - name: transcript_url + type: URL + description: A link to a transcript or closed captions file for the item. +--- + +Produces a data flow in the RSS format. +Can be used to generate a podcast feed. +To use this component, you must first return an HTTP header with the "application/rss+xml" content type (see http_header component). Next, you must use the shell-empty component to avoid that SQLPage generates HTML code. diff --git a/examples/official-site/content/components/rss/examples/01-news-channel.md b/examples/official-site/content/components/rss/examples/01-news-channel.md new file mode 100644 index 000000000..0e0c8d291 --- /dev/null +++ b/examples/official-site/content/components/rss/examples/01-news-channel.md @@ -0,0 +1,31 @@ +### An RSS channel about SQLPage latest news. + +```sql +select 'http_header' as component, 'application/rss+xml' as content_type; +select 'shell-empty' as component; +select + 'rss' as component, + 'SQLPage blog' as title, + 'https://sql-page.com/blog.sql' as link, + 'latest news about SQLpage' as description, + 'en' as language, + 'Technology' as category, + FALSE as explicit, + 'https://sql-page.com/favicon.ico' as image_url, + 'Ophir Lojkine' as author, + 'https://github.com/sponsors/lovasoa' as funding_url, + 'episodic' as type; +select + 'Hello everyone !' as title, + 'https://sql-page.com/blog.sql?post=Come%20see%20me%20build%20twitter%20live%20on%20stage%20in%20Prague' as link, + 'If some of you european SQLPagers are around Prague this december, I will be giving a talk about SQLPage at pgconf.eu on December 14th.' as description, + 'http://127.0.0.1:8080/sqlpage_introduction_video.mp4' as enclosure_url, + 123456789 as enclosure_length, + 'video/mp4' as enclosure_type, + '2023-12-04' as date; +``` + +Once you have your rss feed ready, you can submit it to podcast directories like +[Apple Podcasts](https://podcastsconnect.apple.com/my-podcasts), +[Spotify](https://podcasters.spotify.com/), +[Google Podcasts](https://podcastsmanager.google.com/)... diff --git a/examples/official-site/sqlpage/migrations/11_json.sql b/examples/official-site/sqlpage/migrations/11_json.sql deleted file mode 100644 index 5c6010819..000000000 --- a/examples/official-site/sqlpage/migrations/11_json.sql +++ /dev/null @@ -1,211 +0,0 @@ -INSERT INTO - component (name, description, icon, introduced_in_version) -VALUES - ( - 'json', - 'Converts SQL query results into the JSON machine-readable data format. Ideal to quickly build APIs for interfacing with external systems. - -**JSON** is a widely used data format for programmatic data exchange. -For example, you can use it to integrate with web services written in different languages, -with mobile or desktop apps, or with [custom client-side components](/custom_components.sql) inside your SQLPage app. - -Use it when your application needs to expose data to external systems. -If you only need to render standard web pages, -and do not need other software to access your data, -you can ignore this component. - -This component **must appear at the top of your SQL file**, before any other data has been sent to the browser. -An HTTP response can have only a single datatype, and it must be declared in the headers. -So if you have already called the `shell` component, or another traditional HTML component, -you cannot use this component in the same file. - -SQLPage can also return JSON or JSON Lines when the incoming request says it prefers them with an HTTP `Accept` header, so the same `/users.sql` page can show a table in a browser but return raw data to `curl -H "Accept: application/json" http://localhost:8080/users.sql`. - -Use this component when you want to control the payload or force JSON output even for requests that would normally get HTML. -', - 'code', - '0.9.0' - ); - --- Insert the parameters for the http_header component into the parameter table -INSERT INTO - parameter ( - component, - name, - description, - type, - top_level, - optional - ) -VALUES - ( - 'json', - 'contents', - 'A single JSON payload to send. You can use your database''s built-in json functions to build the value to enter here. If not provided, the contents will be taken from the next SQL statements and rendered as a JSON array.', - 'TEXT', - TRUE, - TRUE - ), - ( - 'json', - 'type', - 'The type of the JSON payload to send: "array", "jsonlines", or "sse". -In "array" mode, each query result is rendered as a JSON object in a single top-level array. -In "jsonlines" mode, results are rendered as JSON objects in separate lines, without a top-level array. -In "sse" mode, results are rendered as JSON objects in separate lines, prefixed by "data: ", which allows you to read the results as server-sent events in real-time from javascript.', - 'TEXT', - TRUE, - TRUE - ); - --- Insert an example usage of the http_header component into the example table -INSERT INTO - example (component, description) -VALUES - ( - 'json', - ' -## Send query results as a single JSON array: `''array'' as type` - -The default `array` mode sends the query results as a single JSON array. - -If a query returns an error, the array will contain an object with an `error` property. - -If multiple queries are executed, all query results will be concatenated into a single array -of heterogeneous objects. - -### SQL - -```sql -select ''json'' AS component; -select * from users; -``` - -### Result - -```json -[ - {"username":"James","userid":1}, - {"username":"John","userid":2} -] -``` - -Clients can also receive JSON or JSON Lines automatically by requesting the same SQL file with an HTTP `Accept` header such as `application/json` or `application/x-ndjson` when the component is omitted, for example: - -``` -curl -H "Accept: application/json" http://localhost:8080/users.sql -``` - ' - ), - ( - 'json', - ' -## Send one JSON object per row: `''jsonlines'' as type` - -In `jsonlines` mode, each query result is rendered as a JSON object in a separate line, -without a top-level array. - -If there are no rows, the response body is empty. If there is a single row, the response is a JSON object. -If there are multiple query results, you will need to parse each line of the response as a separate JSON object. - -If a query returns an error, the response will be a JSON object with an `error` property. - -### SQL - -The following SQL creates an API endpoint that takes a `user_id` URL parameter -and returns a single JSON object containing the user''s details, with one json object key per column in the `users` table. - -```sql -select ''json'' AS component, ''jsonlines'' AS type; -select * from users where id = $user_id LIMIT 1; -``` - -> Note the `LIMIT 1` clause. The `jsonlines` type will send one JSON object per result row, -> separated only by a single newline character (\n). -> So if your query returns multiple rows, the result will not be a single valid JSON object, -> like most JSON parsers expect. - -### Result - -```json -{ "username":"James", "userid":1 } -``` -' - ), - ( - 'json', - ' -## Create a complex API endpoint: the `''contents''` property - -You can create an API endpoint that will return a JSON value in any format you want, -to implement a complex API. - -You should use [the json functions provided by your database](/blog.sql?post=JSON%20in%20SQL%3A%20A%20Comprehensive%20Guide) to form the value you pass to the `contents` property. -To build a json array out of rows from the database, you can use: - - `json_group_array()` in SQLite, - - `json_agg()` in Postgres, or - - `JSON_ARRAYAGG()` in MySQL. - - `FOR JSON PATH` in SQL Server. - - -```sql -SELECT ''json'' AS component, - JSON_OBJECT( - ''users'', ( - SELECT JSON_GROUP_ARRAY( - JSON_OBJECT( - ''username'', username, - ''userid'', id - ) - ) FROM users - ) - ) AS contents; -``` - -This will return a JSON response that looks like this: - -```json -{ - "users" : [ - { "username":"James", "userid":1 } - ] -} -``` - -If you want to handle custom API routes, like `POST /api/users/:id`, -you can use - - the [`404.sql` file](/your-first-sql-website/custom_urls.sql) to handle the request despite the URL not matching any file, - - the [`request_method` function](/functions.sql?function=request_method#function) to differentiate between GET and POST requests, - - and the [`path` function](/functions.sql?function=path#function) to extract the `:id` parameter from the URL. -' - ), - ( - 'json', - ' -## Access query results in real-time with server-sent events: `''sse'' as type` - -Using server-sent events, you can stream large query results to the client in real-time, -row by row. - -This allows building sophisticated dynamic web applications that will start processing and displaying -the first rows of data in the browser while the database server is still processing the end of the query. - -### SQL - -```sql -select ''json'' AS component, ''sse'' AS type; -select * from users; -``` - -### JavaScript - -```javascript -const eventSource = new EventSource("users.sql"); -eventSource.onmessage = function (event) { - const user = JSON.parse(event.data); - console.log(user.username); -} -eventSource.onerror = () => eventSource.close(); // do not reconnect after reading all the data -``` -' - ); diff --git a/examples/official-site/sqlpage/migrations/37_rss.sql b/examples/official-site/sqlpage/migrations/37_rss.sql deleted file mode 100644 index 0a3e70bb8..000000000 --- a/examples/official-site/sqlpage/migrations/37_rss.sql +++ /dev/null @@ -1,287 +0,0 @@ --- Documentation for the RSS component -INSERT INTO component (name, description, icon, introduced_in_version) VALUES ( - 'rss', - 'Produces a data flow in the RSS format. -Can be used to generate a podcast feed. -To use this component, you must first return an HTTP header with the "application/rss+xml" content type (see http_header component). Next, you must use the shell-empty component to avoid that SQLPage generates HTML code.', - 'rss', - '0.20.0' -); - -INSERT INTO parameter (component,name,description,type,top_level,optional) VALUES ( - 'rss', - 'title', - 'Defines the title of the channel.', - 'TEXT', - TRUE, - FALSE -),( - 'rss', - 'link', - 'Defines the hyperlink to the channel.', - 'URL', - TRUE, - FALSE -),( - 'rss', - 'description', - 'Describes the channel.', - 'TEXT', - TRUE, - FALSE -),( - 'rss', - 'language', - 'Defines the language of the channel, specified in the ISO 639 format. For example, "en" for English, "fr" for French.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'category', - 'Defines the category of the channel. The value should be a string representing the category (e.g., "News", "Technology", etc.).', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'sub_category', - 'Defines a sub-category, nested inside the "category". Ignored unless "category" is also set.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'explicit', - 'Indicates whether the channel contains explicit content. The value can be either TRUE or FALSE.', - 'BOOLEAN', - TRUE, - TRUE -),( - 'rss', - 'image_url', - 'Provides a URL linking to the artwork for the channel.', - 'URL', - TRUE, - TRUE -),( - 'rss', - 'author', - 'Defines the group, person, or people responsible for creating the channel.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'copyright', - 'Provides the copyright details for the channel.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'self_link', - 'URL of the RSS feed.', - 'URL', - TRUE, - TRUE -),( - 'rss', - 'funding_url', - 'Specifies the donation/funding links for the channel. The content of the tag is the recommended string to be used with the link.', - 'URL', - TRUE, - TRUE -),( - 'rss', - 'funding_text', - 'The text to display with the donation/funding link. Ignored unless "funding_url" is also set.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'type', - 'Specifies the channel as either episodic or serial. The value can be either "episodic" or "serial".', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'complete', - 'Specifies that a channel is complete and will not post any more items in the future.', - 'BOOLEAN', - TRUE, - TRUE -),( - 'rss', - 'locked', - 'Tells podcast hosting platforms whether they are allowed to import this feed.', - 'BOOLEAN', - TRUE, - TRUE -),( - 'rss', - 'guid', - 'The globally unique identifier (GUID) for a channel. The value is a UUIDv5.', - 'TEXT', - TRUE, - TRUE -),( - 'rss', - 'title', - 'Defines the title of the feed item (episode name, blog post title, etc.).', - 'TEXT', - FALSE, - FALSE -),( - 'rss', - 'link', - 'Defines the hyperlink to the item (blog post URL, etc.).', - 'URL', - FALSE, - FALSE -),( - 'rss', - 'description', - 'Describes the item', - 'TEXT', - FALSE, - FALSE -),( - 'rss', - 'date', - 'Indicates when the item was published (RFC-822 date-time).', - 'TEXT', - FALSE, - TRUE -),( - 'rss', - 'enclosure_url', - 'For podcast episodes, provides a URL linking to the audio/video episode content, in mp3, m4a, m4v, or mp4 format.', - 'URL', - FALSE, - TRUE -),( - 'rss', - 'enclosure_length', - 'The length in bytes of the audio/video episode content.', - 'INTEGER', - FALSE, - TRUE -),( - 'rss', - 'enclosure_type', - 'The MIME media type of the audio/video episode content (e.g., "audio/mpeg", "audio/m4a", "video/m4v", "video/mp4").', - 'TEXT', - FALSE, - TRUE -),( - 'rss', - 'guid', - 'The globally unique identifier (GUID) for an item.', - 'TEXT', - FALSE, - TRUE -),( - 'rss', - 'episode', - 'The chronological number that is associated with an item.', - 'INTEGER', - FALSE, - TRUE -),( - 'rss', - 'season', - 'The chronological number associated with an item''s season.', - 'INTEGER', - FALSE, - TRUE -),( - 'rss', - 'episode_type', - 'Defines the type of content for a specific item. The value can be either "full", "trailer", or "bonus".', - 'TEXT', - FALSE, - TRUE -),( - 'rss', - 'block', - 'Prevents a specific item from appearing in podcast listening applications.', - 'BOOLEAN', - FALSE, - TRUE -),( - 'rss', - 'explicit', - 'Indicates whether the item contains explicit content. The value can be either TRUE or FALSE.', - 'BOOLEAN', - FALSE, - TRUE -),( - 'rss', - 'image_url', - 'Provides a URL linking to the artwork for the item.', - 'URL', - FALSE, - TRUE -),( - 'rss', - 'duration', - 'The duration of an item in seconds.', - 'INTEGER', - FALSE, - TRUE -),( - 'rss', - 'transcript_url', - 'A link to a transcript or closed captions file for the item.', - 'URL', - FALSE, - TRUE -),( - 'rss', - 'transcript_type', - 'The type of the transcript or closed captions file for the item (e.g., "text/plain", "text/html", "text/vtt", "application/json", "application/x-subrip").', - 'TEXT', - FALSE, - TRUE -); - --- Insert example(s) for the component -INSERT INTO example (component, description) -VALUES ( - 'rss', - ' -### An RSS channel about SQLPage latest news. - -```sql -select ''http_header'' as component, ''application/rss+xml'' as content_type; -select ''shell-empty'' as component; -select - ''rss'' as component, - ''SQLPage blog'' as title, - ''https://sql-page.com/blog.sql'' as link, - ''latest news about SQLpage'' as description, - ''en'' as language, - ''Technology'' as category, - FALSE as explicit, - ''https://sql-page.com/favicon.ico'' as image_url, - ''Ophir Lojkine'' as author, - ''https://github.com/sponsors/lovasoa'' as funding_url, - ''episodic'' as type; -select - ''Hello everyone !'' as title, - ''https://sql-page.com/blog.sql?post=Come%20see%20me%20build%20twitter%20live%20on%20stage%20in%20Prague'' as link, - ''If some of you european SQLPagers are around Prague this december, I will be giving a talk about SQLPage at pgconf.eu on December 14th.'' as description, - ''http://127.0.0.1:8080/sqlpage_introduction_video.mp4'' as enclosure_url, - 123456789 as enclosure_length, - ''video/mp4'' as enclosure_type, - ''2023-12-04'' as date; -``` - -Once you have your rss feed ready, you can submit it to podcast directories like -[Apple Podcasts](https://podcastsconnect.apple.com/my-podcasts), -[Spotify](https://podcasters.spotify.com/), -[Google Podcasts](https://podcastsmanager.google.com/)... -'); \ No newline at end of file diff --git a/examples/official-site/sqlpage/migrations/82_reference_catalog.sql b/examples/official-site/sqlpage/migrations/82_reference_catalog.sql index dfa7865bf..615ed04e6 100644 --- a/examples/official-site/sqlpage/migrations/82_reference_catalog.sql +++ b/examples/official-site/sqlpage/migrations/82_reference_catalog.sql @@ -25,18 +25,6 @@ ALTER TABLE sqlpage_functions ADD COLUMN catalog_category TEXT REFERENCES refere ALTER TABLE sqlpage_functions ADD COLUMN catalog_summary TEXT; ALTER TABLE sqlpage_function_parameters ADD COLUMN optional BOOLEAN NOT NULL DEFAULT FALSE; -WITH copy(name, category, summary) AS (VALUES - - - - - ('json', 'http-responses', 'Return query results as JSON for an API.'), - ('rss', 'http-responses', 'Publish an RSS feed from query results.') - -) -UPDATE component SET (catalog_category, catalog_summary) = (copy.category, copy.summary) -FROM copy WHERE component.name = copy.name; - -- The catalog, topic navigation, and reference pages use the same entries and links. CREATE VIEW reference_entry AS WITH entries AS (