Files
sqlpage--sqlpage/examples/custom form component/basic.sql
T
wehub-resource-sync d718c5a372
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / hurl (${{ matrix.example }}) (push) Has been skipped
CI / docker_push (duckdb) (push) Has been cancelled
CI / docker_push (minimal) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:57 +08:00

40 lines
1.4 KiB
SQL

select
'dynamic' as component,
sqlpage.run_sql ('shell.sql') as properties;
-- this does the same thing as index.sql, but uses the normal form component instead of our fancy dual-list component
select
'form' as component,
'form_action.sql' as action;
select
'select' as type,
true as searchable,
true as multiple,
'selected_items[]' as name,
'Users in this group' as label,
-- JSON_MERGE combines two JSON documents:
-- 1. A JSON object with an empty label
-- 2. An array of user objects created by JSON_ARRAYAGG
JSON_MERGE (
-- Creates a simple JSON object with a single empty property {"label": ""}
JSON_OBJECT ('label', ''),
-- JSON_ARRAYAGG takes multiple rows and combines them into a JSON array
-- Each element in the array is a JSON object created by json_object()
JSON_ARRAYAGG (
-- Creates a JSON object for each user with:
-- - {"label": "the user's name", "value": "the user's ID", "selected": true } (if the user is in the group)
json_object (
'label',
users.name,
'value',
users.id,
'selected',
group_members.group_id is not null -- the left join creates NULLs for users not in the group
)
)
) as options
from
users
left join group_members on users.id = group_members.user_id
and group_members.group_id = 1;