I'm sorry in advance for my English, it is not my native speaking language. I'm running this in Python
I have a XML-RPC function and, as part of its parameters, there are some filters that you can pass to retrieve specific information. It goes something like this:
function(arg1,arg2,[[[condition1],[condition2],[condition3]]])
The conditions are optional, but I want to know if there is a way to pass n-amount of conditionals according to user request. For example, if the user wants the information from a specific day, it would go in [condition1], but if they want also the info from another non-adjacent day, they would pass that as [[[condition1],[condition2]]]. Furthermore, each condition would be a specific that but those two dates might have a lot of info, so it would be slow if it retrieve info in two different processes and also if it wants a lot of days the server might block the consult so it would be better to add parameters according what the user wants.
The user won't pass things directly to the filter, rather, they would use the filter through a UI and then the values will be parsed. I have implemented it this way to limit the possibility of a user breaking my database.
In the dates scenario, I've tried to check the distance between dates and use and if to try to retrieve the info with as few calls as possible, but when the user passes other parameters like a name, a boolean or a combination of them it gets more tricky to solve it with an if.
I thought maybe something like checking the filters the user wants, arranging the correctly in a string, and finally using it as the parameter might work, but I don't know how to parse it. Something like this:
The User input will be
date: 2019/03/28
Published: True
price: > 850
So then the function would be written as:
function(arg1,arg2,[[[date='2019/03/28'],[Published=True],[price>850]]])
But if the user only wants two filters, the function needs to be written like this:
function(arg1,arg,[[[Published=True],[price>850]]])
So I don't know how to add n parameters corresponding the n filters the user want