I have a stored function named custom_sort
in a postgresql database.
Is it possible at all to call that function from ecto in a order_by
clause? Something similiar to the following (which is - of course - not working):
Authorization
|> order_by([m], fragment("custom_sort (ARRAY['MANAGER', 'ADMIN', 'USER'], ?)", ^m.selection))
|> select([m],m.selection})
|> Repo.all()
From what I’ve read so far order_by might not be able to handle this.
What other solution might help?
Thanks for any hint/ideas