Interface TokenSubQuery

All Known Subinterfaces:
TokenQuery
All Known Implementing Classes:
TokenQueryImpl, TokenQueryJooq

public interface TokenSubQuery
  • Method Details

    • or

      Add an OR group to your query. The statements in this group will be OR-ed together.

      Example:

      
       query.or(or -> or.eq(Person::getName, "Bob").eq(Person::getAge, 42));
       
      Will result into the following SQL: `WHERE (name = 'Bob' OR age = 42)`

      Parameters:
      orGroup - uses temporary TokenSubQuery 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:

      
       query.or(or -> or.eq(Person::getName, "Alice").and(and -> and.eq(Person::getName, "Bob").eq(Person::getAge, 42)));
       
      Will result into the following SQL: `WHERE (name = 'Alice OR (name = 'Bob' AND age = 42))`.

      Parameters:
      andGroup - uses temporary TokenSubQuery to specify statements in the AND group
      Returns:
      this query, for chaining
    • eq

      TokenSubQuery eq(Token field, Object value)
      Match if the value of a field equals the specified value. If you want to match null values, you have to use TokenQuery.isNull(Token).

      Example:

      
       query.eq(Token.get("name"), "Bob")
       

      This will match people with the name "Bob".

      Parameters:
      field - the field to match
      value - the value to match
      Returns:
      the query, for chaining
    • eq

      default TokenSubQuery eq(String field, Object value)
      Match if the value of a field equals the specified value. If you want to match null values, you have to use TokenQuery.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) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to match
      Returns:
      the query, for chaining
    • notEq

      TokenSubQuery notEq(Token field, Object value)
      Match if the value of a field does not equal the specified value. If you want to match non-null values, you have to use TokenQuery.isNotNull(Token).

      Example:

      
       query.notEq(Token.get("name"), "Bob")
       

      This will match people whose name is not "Bob".

      Parameters:
      field - the field to match
      value - the value to match
      Returns:
      the query, for chaining
    • notEq

      default TokenSubQuery notEq(String field, Object value)
      Match if the value of a field does not equal the specified value. If you want to match non-null values, you have to use TokenQuery.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) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to match
      Returns:
      the query, for chaining
    • in

      TokenSubQuery in(Token field, Collection<?> values)
      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 match
      values - the values to match
      Returns:
      the query, for chaining
    • in

      default TokenSubQuery in(String field, Collection<?> values)
      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) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      values - the values to match
      Returns:
      the query, for chaining
    • in

      TokenSubQuery in(Token field, Object... values)
      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 match
      values - the values to match
      Returns:
      the query, for chaining
    • in

      default TokenSubQuery in(String field, Object... values)
      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...) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      values - the values to match
      Returns:
      the query, for chaining
    • like

      TokenSubQuery like(Token field, String value)
      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 match
      value - the pattern to match
      Returns:
      the query, for chaining
    • like

      default TokenSubQuery like(String field, String value)
      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) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the pattern to match
      Returns:
      the query, for chaining
    • notLike

      TokenSubQuery notLike(Token field, String value)
      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 match
      value - the pattern to match
      Returns:
      the query, for chaining
    • notLike

      default TokenSubQuery notLike(String field, String value)
      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) with Token.literal(String)

      Parameters:
      field - the field to match, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the pattern to match
      Returns:
      the query, for chaining
    • gt

      TokenSubQuery gt(Token field, Object value)
      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 compare
      value - the value to compare to
      Returns:
      the query, for chaining
    • gt

      default TokenSubQuery gt(String field, Object value)
      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) with Token.literal(String)

      Parameters:
      field - the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to compare to
      Returns:
      the query, for chaining
    • gte

      TokenSubQuery gte(Token field, Object value)
      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 compare
      value - the value to compare to
      Returns:
      the query, for chaining
    • gte

      default TokenSubQuery gte(String field, Object value)
      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) with Token.literal(String)

      Parameters:
      field - the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to compare to
      Returns:
      the query, for chaining
    • lt

      TokenSubQuery lt(Token field, Object value)
      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 compare
      value - the value to compare to
      Returns:
      the query, for chaining
    • lt

      default TokenSubQuery lt(String field, Object value)
      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) with Token.literal(String)

      Parameters:
      field - the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to compare to
      Returns:
      the query, for chaining
    • lte

      TokenSubQuery lte(Token field, Object value)
      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 compare
      value - the value to compare to
      Returns:
      the query, for chaining
    • lte

      default TokenSubQuery lte(String field, Object value)
      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) with Token.literal(String)

      Parameters:
      field - the field to compare, will be tokenized, for example "fullName" will reference column "full_name" for MariaDb
      value - the value to compare to
      Returns:
      the query, for chaining
    • isNull

      TokenSubQuery isNull(Token field)
      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

      default TokenSubQuery isNull(String field)
      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) with Token.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

      TokenSubQuery isNotNull(Token field)
      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

      default TokenSubQuery isNotNull(String field)
      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) with Token.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