mistic100 / mistic100/jQuery-QueryBuilder
Consider adding a `has_flag` option to the comparison operators
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
Would you please consider adding a has_flag option to the comparison operators to support bitwise flags? For example, let's say one of our columns called, "ProductType" can hold a value representing one or more of the following flag values:
[Flags]
public enum ProductType
{
Flight = 1,
Hotel = 2,
Tour = 4,
Transfer = 8
//etc 16, 32, 64...
}
So if a booking record in my database has a value of 3 for the ProductType, this means it was a Flight + Hotel booking. Now if I want to query all records where there is a hotel component (for example), then I need to produce a query as follows:
SELECT *
FROM Bookings
WHERE ProductType & 2 <> 0
Having a has_flag operator would be good here. As for UI, we could use checkboxes. If multiple values are checked, you would produce multiple WHERE clauses.
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
The issue names no files, tests, or entry points, so start by locating the comparison-operator definitions and the UI configuration for operators. Review how SQL conditions are generated, using the ProductType & 2 <> 0 example as the expected behavior. Done means supporting a has_flag option and defining checkbox behavior for multiple selected flags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery, sql
- Domain
- databases, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100