docs: Simplify auth examples with OUT parameter
The jwt_token type was not created consistently in all examples, which can be confusing when following those. To return an object with a single key named token, it's enough to have an OUT parameter to the function. Resolves https://github.com/PostgREST/postgrest-docs/issues/280
This commit is contained in:
committed by
Wolfgang Walther
parent
7c6c056e92
commit
9b1ff2235a
@@ -166,7 +166,7 @@ Another option is to define the function with the :code:`SECURITY DEFINER` optio
|
||||
-- login as a user wich has privileges on the private schemas
|
||||
|
||||
-- create a sample function
|
||||
create or replace function login(email text, pass text) returns jwt_token as $$
|
||||
create or replace function login(email text, pass text, out token text) as $$
|
||||
begin
|
||||
-- access to a private schema called 'auth'
|
||||
select auth.user_role(email, pass) into _role;
|
||||
|
||||
Reference in New Issue
Block a user