The nil problem arises when the GET parameter ["policy"]["client_id"] is missing (not set in the request). My question, how to handle that? How to prevent this error? Basically I want that particular where sentence to be ignored if ["policy"]["client_id"] is empty.
Thank you. I understand that the use of multiple function definitions with various guards can cover all parameters’ possibilities. However, if I will be filtering by say 5 parameters then the list of possible combinations of those parameters will be big and that means I will have to write multiple function/guard definitions to catch all possibilities. I hope there is a simpler approach to run that Ecto query.