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 Summary
Modifier and TypeMethodDescriptionAdd an AND condition on a column.longcount()Count the number of matching results.intdelete()Delete all matching results and return the count of deleted rows.Equal to.booleanexists()Check if any results match the query.first()Execute the query and return the first matching result, or null if none.Greater than.Greater than or equal to.in(Collection<?> values) Value is in the given collection.SQL LIKE pattern matching.limit(int count) Limit the number of results.list()Execute the query and return all matching results.Less than.Less than or equal to.Not equal to.offset(int start) Skip a number of results.Order results by column ascending.orderByDesc(String column) Order results by column descending.Start a where condition on a column.
-
Method Details
-
where
Start a where condition on a column.- Parameters:
column- the column name- Returns:
- this query for chaining
-
and
Add an AND condition on a column.- Parameters:
column- the column name- Returns:
- this query for chaining
-
eq
Equal to.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
ne
Not equal to.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
gt
Greater than.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
lt
Less than.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
gte
Greater than or equal to.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
lte
Less than or equal to.- Parameters:
value- the value to compare- Returns:
- this query for chaining
-
like
SQL LIKE pattern matching.- Parameters:
pattern- the LIKE pattern (use % for wildcard)- Returns:
- this query for chaining
-
in
Value is in the given collection.- Parameters:
values- the collection of allowed values- Returns:
- this query for chaining
-
orderBy
Order results by column ascending.- Parameters:
column- the column to order by- Returns:
- this query for chaining
-
orderByDesc
Order results by column descending.- Parameters:
column- the column to order by- Returns:
- this query for chaining
-
limit
Limit the number of results.- Parameters:
count- the maximum number of results- Returns:
- this query for chaining
-
offset
Skip a number of results.- Parameters:
start- the number of results to skip- Returns:
- this query for chaining
-
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
-