loopbackio / loopbackio/loopback-next
Filter by the concatenation of two columns
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
Suggestion
It would be nice to be able to filter a Model by the concatenation of two columns.
I mean, to be able to replicate this type of SQL query:
SELECT * FROM User WHERE CONCAT(name, ' ', lastName) LIKE '%PARTIAL FULLNAME%'
Use Cases
The most common example is filtering a User model by its full name when it's stored in two columns (name, lastName).
Currently, the only way this is possible (AFAIK) is by sending the RAW query, which makes it almost incompatible with adding more filters.
Examples
Table example:
| id | name | lastName |
|---|---|---|
| 1 | Jackson | Bell |
| 2 | Sarah | Parker |
| 3 | Mason | Brown |
Example of one (possible) implementation of filter object:
{
"limit": 10,
"offset": 0,
"where": {
"leavingDate": null,
"concat": {
"eq": "%on B%",
"separator": " ",
"columns": [
"name",
"lastName"
]
}
}
}
Should return:
| id | name | lastName |
|---|---|---|
| 1 | Jackson | Bell |
| 3 | Mason | Brown |
Acceptance criteria
TBD - will be filled by the team.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed where.concat filter object and how repository filters currently handle raw queries. Clarify the acceptance criteria with the team, including supported columns, separators, comparison operators, and database behavior. Done means concatenation filtering works alongside other filters and has documented verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100