litestar-org / advanced-alchemy

A carefully crafted, thoroughly tested, optimized companion library for SQLAlchemy
http://docs.advanced-alchemy.litestar.dev/
MIT License
243 stars 30 forks source link

Enhancement: add MultipleColumnsSearchFilter #215

Closed scherbakovx closed 4 months ago

scherbakovx commented 4 months ago

Summary

There is SearchFilter which accepts both searchField and searchValue. But I want to have another filter which accepts searchValue from request and then constructs OR-query with specified value against pre-defined fields in ModelT.

Basic Example

/accounts?searchValue=Anton should be converted to SELECT * FROM accounts WHERE first_name LIKE %Anton% OR last_name LIKE %Anton% or address.street_name LIKE %Anton%

first_name, last_name and address.street_name come from attribute in Account model.

Drawbacks and Impact

No response

Unresolved questions

I'm not sure if this filter is required and there is no other way to implement what I need, but I'm 100% ready to implement it and make PR, so shall I?

scherbakovx commented 4 months ago

Closing because it was added in v0.13.0: https://github.com/litestar-org/advanced-alchemy/releases/tag/v0.13.0