4 ms·
When I look at the Tiny Twitter example and see the code below, I'm curious if there is a more "SQL" way to implement it. ``` select 'checkbox' as component,
by tomhallett 3y ago
When I look at the Tiny Twitter example and see the code below, I'm curious if there is a more "SQL" way to implement it.
```
select 'checkbox' as component,
'Terms and conditions' as label,
true as required;
```
I'm thinking "What would the workflow of a sql-enthusiast be, to build that page".
I think they'd want todo this first:
```
select * from sqlpage.components;
```
which would list the `name` of each component. Which then takes me to:
```
INSERT INTO sqlpage.dom
SET name = 'checkbox',
label = 'Terms and conditions ',
required = TRUE
FROM sqlpage.components
```
(or VALUES syntax for INSERT)
This would allow you to re-order your dom, update dom entries, etc. Very similar to jsx, but instead of jsx creating in-memory javascript objects, it's sqlpage's sql creating rows in a postgres table. Then the SQLPage virtualdom gets transformed into actual html.
Just a thought, :)
- lovasoa 3y agoI'm not sure what you mean here? The "select 'checkbox' as component" is just an example, but nothing prevents you from creating a my_form table and writing it as "select * from my_form" instead. You don't need any special feature from SQLPage for that.