Skip to content

Consider adding a has_flag option to the comparison operators #822

Open
@gordon-matt

Description

@gordon-matt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions