Interface Query<T extends BaseDataEntity<String>>

Type Parameters:
T - the entity type
All Known Implementing Classes:
QueryImpl

public interface Query<T extends BaseDataEntity<String>>
Fluent query builder for data entities. Provides a readable DSL for filtering, ordering, and paginating results.

Usage example:


 HomeEntity home = plugin.getDataOperator(HomeEntity.class)
     .query()
     .where("playerId").eq(uuid)
     .and("name").eq("base")
     .first();
 
  • Method Details

    • where

      Query<T> where(String column)
      Start a where condition on a column.
      Parameters:
      column - the column name
      Returns:
      this query for chaining
    • and

      Query<T> and(String column)
      Add an AND condition on a column.
      Parameters:
      column - the column name
      Returns:
      this query for chaining
    • eq

      Query<T> eq(Object value)
      Equal to.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • ne

      Query<T> ne(Object value)
      Not equal to.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • gt

      Query<T> gt(Object value)
      Greater than.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • lt

      Query<T> lt(Object value)
      Less than.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • gte

      Query<T> gte(Object value)
      Greater than or equal to.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • lte

      Query<T> lte(Object value)
      Less than or equal to.
      Parameters:
      value - the value to compare
      Returns:
      this query for chaining
    • like

      Query<T> like(String pattern)
      SQL LIKE pattern matching.
      Parameters:
      pattern - the LIKE pattern (use % for wildcard)
      Returns:
      this query for chaining
    • in

      Query<T> in(Collection<?> values)
      Value is in the given collection.
      Parameters:
      values - the collection of allowed values
      Returns:
      this query for chaining
    • orderBy

      Query<T> orderBy(String column)
      Order results by column ascending.
      Parameters:
      column - the column to order by
      Returns:
      this query for chaining
    • orderByDesc

      Query<T> orderByDesc(String column)
      Order results by column descending.
      Parameters:
      column - the column to order by
      Returns:
      this query for chaining
    • limit

      Query<T> limit(int count)
      Limit the number of results.
      Parameters:
      count - the maximum number of results
      Returns:
      this query for chaining
    • offset

      Query<T> offset(int start)
      Skip a number of results.
      Parameters:
      start - the number of results to skip
      Returns:
      this query for chaining
    • list

      List<T> list()
      Execute the query and return all matching results.
      Returns:
      list of matching entities
    • first

      T first()
      Execute the query and return the first matching result, or null if none.
      Returns:
      the first matching entity, or null
    • exists

      boolean exists()
      Check if any results match the query.
      Returns:
      true if at least one result exists
    • count

      long count()
      Count the number of matching results.
      Returns:
      the count of matching results
    • delete

      int delete()
      Delete all matching results and return the count of deleted rows.
      Returns:
      the count of deleted rows