Closed Jaymon closed 3 years ago
Another approach would be to have get_<FIELDNAME>
check the <FIELDNAME>
against all the aliases and if it gets it then it would run one()
against that field name.
If it didn't find it would check if the last character was an s
, if it is it would strip it and do the check again, but use in_<FIELDNAME>
to build the query instead.
If the endswith("s")
check failed then it would try endswith("es")
and do the same as above.
value_*
and values_*
can also be added to this list
So we currently have
get_pk()
that acts as an alias forQuery.is_pk(pk).one()
but we should generic that, so you can do it for any field, theget_*
version would return an iterator, and theone_*
version would return the first match