50 lines
1.2 KiB
Java
50 lines
1.2 KiB
Java
package eu.eudat.queryable;
|
|
|
|
|
|
import eu.eudat.entities.DataEntity;
|
|
import eu.eudat.queryable.predicates.OrderByPredicate;
|
|
import eu.eudat.queryable.predicates.SelectPredicate;
|
|
import eu.eudat.queryable.predicates.SinglePredicate;
|
|
|
|
import javax.persistence.criteria.Subquery;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
public interface QueryableList<T extends DataEntity<T>> {
|
|
QueryableList<T> where(SinglePredicate<T> predicate);
|
|
|
|
<R> List<R> select(SelectPredicate<T, R> predicate);
|
|
|
|
List<T> toList();
|
|
|
|
CompletableFuture<List<T>> toListAsync();
|
|
|
|
T getSingle();
|
|
|
|
CompletableFuture<T> getSingleAsync();
|
|
|
|
T getSingleOrDefault();
|
|
|
|
CompletableFuture<T> getSingleOrDefaultAsync();
|
|
|
|
QueryableList<T> skip(Integer offset);
|
|
|
|
QueryableList<T> take(Integer length);
|
|
|
|
QueryableList<T> distinct();
|
|
|
|
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
|
|
|
|
QueryableList<T> setHints(Set<String> hints);
|
|
|
|
QueryableList<T> withHint(String hint);
|
|
|
|
Long count();
|
|
|
|
CompletableFuture<Long> countAsync();
|
|
|
|
Subquery<T> subQuery(SinglePredicate<T> predicate,List<String> fields);
|
|
|
|
}
|