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
-
and
-
eq
-
ne
-
gt
-
lt
-
gte
-
lte
-
like
-
in
Value is in the given collection.- Parameters:
values- the collection of allowed values- Returns:
- this query for chaining
-
orderBy
-
orderByDesc
-
limit
-
offset
-
list
-
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
-