Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add conditional filterNot methods (filterNotIf/filterNotOpt) support #2701

@sebastianrozyczka

Description

@sebastianrozyczka

DESCRIPTION:
Currently, the filterNot method cannot be used like the filter method, controlling it with a logical condition or optional value (filterIf/filterOpt). It would be nice to be able to add a where not clause to a query by adding the method to the method call chain (relying on the input condition in the form of a boolean or option value).

EXPECTED RESULT:
Ability to use the filterNotIf(boolean condition)(f)/filterNotOpt(optional value)(f) method in the query builder method call chain.
Example:

Table.filter(_.column1 === "value1").filterNotIf(condition)(Table2.filter(_.column2 === "value2).exists)

ACTUAL RESULT:
Currently, it is necessary to assign a query to a variable, add a condition, e.g. in the form of an if, and use the filterNot method on a variable in one of the paths.
Example:

val query = Table.filter(_.column1 === "value1")
if (condition) query.filterNot(Table2.filter(_.column2 === "value2).exists) else query

I would be happy to contribute. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions