PostGraphile Function Gallery
Below you'll find some examples of various PostgreSQL functions, and their effects on PostGraphile.
This page is a WIP - sorry that it's hard to read right now, we will definitely be tidying it up! If you want to help with this, please pop into our discord chat and volunteer!
All these diffs are automatically produced using the functions as written.
- ▾ Custom queries
- Logged in user field
- ▸ Computed columns
- ▸ Custom mutations
create function viewer() returns users as $$ select * from users where id = current_user_id(); /* * current_user_id() is a function * that returns the logged in user's * id, e.g. by extracting from the JWT * or indicated via pgSettings. */ $$ language sql stable set search_path from current;
--- Original GraphQL Schema +++ Modified GraphQL Schema @@ -1467,6 +1467,7 @@ # Chosen by fair dice roll. Guaranteed to be random. XKCD#221 randomNumber: Int + viewer: User # Reads a single `Forum` using its globally unique `ID`. forum(