Interface TokenSubQuery
- All Known Subinterfaces:
TokenQuery
- All Known Implementing Classes:
TokenQueryImpl
,TokenQueryJooq
-
Method Summary
Modifier and TypeMethodDescriptionand
(Consumer<TokenSubQuery> andGroup) Add an AND group to your query.Match if the value of a field equals the specified value.default TokenSubQuery
Match if the value of a field equals the specified value.Match if the value of a field is greater than the specified value.default TokenSubQuery
Match if the value of a field is greater than the specified value.Match if the value of a field is greater than or equal to the specified value.default TokenSubQuery
Match if the value of a field is greater than or equal to the specified value.Match if the value of a field is in the specified collection of values.in
(Token field, Collection<?> values) Match if the value of a field is in the specified collection of values.default TokenSubQuery
Match if the value of a field is in the specified collection of values.default TokenSubQuery
in
(String field, Collection<?> values) Match if the value of a field is in the specified collection of values.Match if the value of a field is not null.default TokenSubQuery
Match if the value of a field is not null.Match if the value of a field is null.default TokenSubQuery
Match if the value of a field is null.Match if the value of a field matches the specified pattern.default TokenSubQuery
Match if the value of a field matches the specified pattern.Match if the value of a field is less than the specified value.default TokenSubQuery
Match if the value of a field is less than the specified value.Match if the value of a field is less than or equal to the specified value.default TokenSubQuery
Match if the value of a field is less than or equal to the specified value.Match if the value of a field does not equal the specified value.default TokenSubQuery
Match if the value of a field does not equal the specified value.Match if the value of a field does not match the specified pattern.default TokenSubQuery
Match if the value of a field does not match the specified pattern.or
(Consumer<TokenSubQuery> orGroup) Add an OR group to your query.
-
Method Details
-
or
Add an OR group to your query. The statements in this group will be OR-ed together.Example:
Will result into the following SQL: `WHERE (name = 'Bob' OR age = 42)`query.or(or -> or.eq(Person::getName, "Bob").eq(Person::getAge, 42));
- Parameters:
orGroup
- uses temporaryTokenSubQuery
to specify statements in the OR group- Returns:
- this query, for chaining
-
and
Add an AND group to your query. The statements in this group will be AND-ed together. Note that statements are AND-ed by default, this method is meant to be used inside an OR group.Example:
Will result into the following SQL: `WHERE (name = 'Alice OR (name = 'Bob' AND age = 42))`.query.or(or -> or.eq(Person::getName, "Alice").and(and -> and.eq(Person::getName, "Bob").eq(Person::getAge, 42)));
- Parameters:
andGroup
- uses temporaryTokenSubQuery
to specify statements in the AND group- Returns:
- this query, for chaining
-
eq
Match if the value of a field equals the specified value. If you want to match null values, you have to useTokenQuery.isNull(Token)
.Example:
query.eq(Token.get("name"), "Bob")
This will match people with the name "Bob".
- Parameters:
field
- the field to matchvalue
- the value to match- Returns:
- the query, for chaining
-
eq
Match if the value of a field equals the specified value. If you want to match null values, you have to useTokenQuery.isNull(String)
.Example:
query.eq("name", "Bob")
This will match people with the name "Bob".
Note: to specify non-standard column names, use
TokenQuery.eq(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to match- Returns:
- the query, for chaining
-
notEq
Match if the value of a field does not equal the specified value. If you want to match non-null values, you have to useTokenQuery.isNotNull(Token)
.Example:
query.notEq(Token.get("name"), "Bob")
This will match people whose name is not "Bob".
- Parameters:
field
- the field to matchvalue
- the value to match- Returns:
- the query, for chaining
-
notEq
Match if the value of a field does not equal the specified value. If you want to match non-null values, you have to useTokenQuery.isNotNull(String)
.Example:
query.notEq("name", "Bob")
This will match people whose name is not "Bob".
Note: to specify non-standard column names, use
TokenQuery.notEq(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to match- Returns:
- the query, for chaining
-
in
Match if the value of a field is in the specified collection of values.Example:
query.in(Token.get("name"), List.of("Bob", "Alice"))
This will match people with the name "Bob" or "Alice".
- Parameters:
field
- the field to matchvalues
- the values to match- Returns:
- the query, for chaining
-
in
Match if the value of a field is in the specified collection of values.Example:
query.in("name", List.of("Bob", "Alice"))
This will match people with the name "Bob" or "Alice".
Note: to specify non-standard column names, use
TokenQuery.in(Token, Collection)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalues
- the values to match- Returns:
- the query, for chaining
-
in
Match if the value of a field is in the specified collection of values.Example:
query.in(Token.get("name"), "Bob", "Alice")
This will match people with the name "Bob" or "Alice".
- Parameters:
field
- the field to matchvalues
- the values to match- Returns:
- the query, for chaining
-
in
Match if the value of a field is in the specified collection of values.Example:
query.in("name", "Bob", "Alice")
This will match people with the name "Bob" or "Alice".
Note: to specify non-standard column names, use
TokenQuery.in(Token, Object...)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalues
- the values to match- Returns:
- the query, for chaining
-
like
Match if the value of a field matches the specified pattern.Example:
query.like(Token.get("name"), "%ed")
This will match people whose name ends with "ed".
- Parameters:
field
- the field to matchvalue
- the pattern to match- Returns:
- the query, for chaining
-
like
Match if the value of a field matches the specified pattern.Example:
query.like("name", "%ed")
This will match people whose name ends with "ed".
Note: to specify non-standard column names, use
TokenQuery.like(Token, String)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the pattern to match- Returns:
- the query, for chaining
-
notLike
Match if the value of a field does not match the specified pattern.Example:
query.notLike(Token.get("name"), "%ed")
This will match people whose name does not end with "ed".
- Parameters:
field
- the field to matchvalue
- the pattern to match- Returns:
- the query, for chaining
-
notLike
Match if the value of a field does not match the specified pattern.Example:
query.notLike("name", "%ed")
This will match people whose name does not end with "ed".
Note: to specify non-standard column names, use
TokenQuery.notLike(Token, String)
withToken.literal(String)
- Parameters:
field
- the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the pattern to match- Returns:
- the query, for chaining
-
gt
Match if the value of a field is greater than the specified value.Example:
query.gt(Token.get("age"), 18)
This will match people older than 18.
- Parameters:
field
- the field to comparevalue
- the value to compare to- Returns:
- the query, for chaining
-
gt
Match if the value of a field is greater than the specified value.Example:
query.gt("age", 18)
This will match people older than 18.
Note: to specify non-standard column names, use
TokenQuery.gt(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to compare to- Returns:
- the query, for chaining
-
gte
Match if the value of a field is greater than or equal to the specified value.Example:
query.gte(Token.get("age"), 18)
This will match people 18 or older.
- Parameters:
field
- the field to comparevalue
- the value to compare to- Returns:
- the query, for chaining
-
gte
Match if the value of a field is greater than or equal to the specified value.Example:
query.gte("age", 18)
This will match people 18 or older.
Note: to specify non-standard column names, use
TokenQuery.gte(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to compare to- Returns:
- the query, for chaining
-
lt
Match if the value of a field is less than the specified value.Example:
query.lt(Token.get("age"), 18)
This will match people younger than 18.
- Parameters:
field
- the field to comparevalue
- the value to compare to- Returns:
- the query, for chaining
-
lt
Match if the value of a field is less than the specified value.Example:
query.lt("age", 18)
This will match people younger than 18.
Note: to specify non-standard column names, use
TokenQuery.lt(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to compare to- Returns:
- the query, for chaining
-
lte
Match if the value of a field is less than or equal to the specified value.Example:
query.lte(Token.get("age"), 18)
This will match people 18 or younger.
- Parameters:
field
- the field to comparevalue
- the value to compare to- Returns:
- the query, for chaining
-
lte
Match if the value of a field is less than or equal to the specified value.Example:
query.lte("age", 18)
This will match people 18 or younger.
Note: to specify non-standard column names, use
TokenQuery.lte(Token, Object)
withToken.literal(String)
- Parameters:
field
- the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDbvalue
- the value to compare to- Returns:
- the query, for chaining
-
isNull
Match if the value of a field is null.Example:
query.isNull(Token.get("email"))
This will match people whose email is null.
Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNull will still match correctly based on the values in the database.
- Parameters:
field
- the field to check- Returns:
- the query, for chaining
-
isNull
Match if the value of a field is null.Example:
query.isNull("email")
This will match people whose email is null.
Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNull will still match correctly based on the values in the database.
Note: to specify non-standard column names, use
TokenQuery.isNull(Token)
withToken.literal(String)
- Parameters:
field
- the field to check, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb- Returns:
- the query, for chaining
-
isNotNull
Match if the value of a field is not null.Example:
query.isNotNull(Token.get("email"))
This will match people whose email is not null.
Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNotNull will still match correctly based on the values in the database.
- Parameters:
field
- the field to check- Returns:
- the query, for chaining
-
isNotNull
Match if the value of a field is not null.Example:
query.isNotNull("email")
This will match people whose email is not null.
Note: if the model class has fields of primitive type, they won't be null, even if the database contains NULL values. In this case isNotNull will still match correctly based on the values in the database.
Note: to specify non-standard column names, use
TokenQuery.isNotNull(Token)
withToken.literal(String)
- Parameters:
field
- the field to check, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb- Returns:
- the query, for chaining
-