michael 54d54f3b75 | ||
---|---|---|
README.md |
README.md
DSL Idea
How should it look?
# User class
# auto-handles `id`, `pwhash`, and 2FA
schema User auth
id int primary index
name string required
bio string required
email email required
created tzdate once`datetime.datetime.now()`
# foreign key relations are specified with `@<key>`
schema Friendship
id int primary index
u1_id int @user.id required
u2_id int @user.id required
# specify returned fields in brackets [field1 field2]
endpoint /user/{uid}
find User (id == uid) [name bio created]
# * this is a auth-protected endpoint
# * the `|` operator evaluates the next statement if the current one fails
endpoint /friends auth
find Friendship (u1id == auth.id or u2id == auth.id) one [u1id u2id] >>
find User (id == u1id) one [name bio]
| find User (id == u2id) one [name bio]