@Internal public interface Queryable<T>
Represents the queryable objects, e.g. Java collections
T
- the type of Queryable elementModifiers | Name | Description |
---|---|---|
class |
Queryable.Order |
Represents an order rule |
Type Params | Return Type | Name and description |
---|---|---|
<U> |
public U |
agg(Function<? super Queryable<? extends T>, ? extends U> mapper) The most powerful aggregate function in GINQ, it will receive the grouped result(Queryable instance) and apply any processing |
|
public BigDecimal |
avg(Function<? super T, ? extends Number> mapper) Aggregate function avg , similar to SQL's avg |
|
public Long |
count() Aggreate function count , similar to SQL's count |
<U> |
public Long |
count(Function<? super T, ? extends U> mapper) Aggregate function count , similar to SQL's count
Note: if the chosen field is null , the field will not be counted |
<U> |
public Queryable<Tuple2<T, U>> |
crossJoin(Queryable<? extends U> queryable) Cross join another Queryable instance, similar to SQL's cross join |
|
public Queryable<T> |
distinct() Eliminate duplicated records, similar to SQL's distinct |
|
public boolean |
exists() Check if the result is empty, similar to SQL's exists |
<T> |
public static Queryable<T> |
from(Iterable<T> iterable) Factory method to create Queryable instance |
<T> |
public static Queryable<T> |
from(T[] array) Factory method to create Queryable instance |
<T> |
public static Queryable<T> |
from(Stream<T> sourceStream) Factory method to create Queryable instance |
<T> |
public static Queryable<T> |
from(Queryable<T> queryable) Returns the original Queryable instance directly |
<U> |
public Queryable<Tuple2<T, U>> |
fullJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Full join another Queryable instance, similar to SQL's full join |
<K> |
public Queryable<Tuple2<K, Queryable<T>>> |
groupBy(Function<? super T, ? extends K> classifier, Predicate<? super Tuple2<? extends K, Queryable<? extends T>>> having) Group by Queryable instance, similar to SQL's group by |
<K> |
public Queryable<Tuple2<K, Queryable<T>>> |
groupBy(Function<? super T, ? extends K> classifier) Group by Queryable instance without having clause, similar to SQL's group by |
<U> |
public Queryable<Tuple2<T, U>> |
innerJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Inner join another Queryable instance, similar to SQL's inner join |
|
public Queryable<T> |
intersect(Queryable<? extends T> queryable) Intersect another Queryable instance, similar to SQL's intersect |
<U> |
public Queryable<Tuple2<T, U>> |
leftJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Left join another Queryable instance, similar to SQL's left join |
|
public Queryable<T> |
limit(long offset, long size) Paginate Queryable instance, similar to MySQL's limit |
|
public Queryable<T> |
limit(long size) Paginate Queryable instance, similar to MySQL's limit |
<U extends Comparable<? super U>> |
public U |
max(Function<? super T, ? extends U> mapper) Aggregate function max , similar to SQL's max |
<U extends Comparable<? super U>> |
public U |
min(Function<? super T, ? extends U> mapper) Aggregate function min , similar to SQL's min |
|
public Queryable<T> |
minus(Queryable<? extends T> queryable) Minus another Queryable instance, similar to SQL's minus |
<U extends Comparable<? super U>> |
public Queryable<T> |
orderBy(Order<? super T, ? extends U> orders) Sort Queryable instance, similar to SQL's order by |
<U> |
public Queryable<Tuple2<T, U>> |
rightJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Right join another Queryable instance, similar to SQL's right join |
<U> |
public Queryable<U> |
select(Function<? super T, ? extends U> mapper) Project Queryable instance, similar to SQL's select |
|
public long |
size() Returns the count of elements of the Queryable instance |
|
public Stream<T> |
stream() Create Stream<T> object for the Queryable instance |
|
public BigDecimal |
sum(Function<? super T, ? extends Number> mapper) Aggregate function sum , similar to SQL's sum |
|
public List<T> |
toList() Convert the Queryable instance to List<T> instance |
|
public Queryable<T> |
union(Queryable<? extends T> queryable) Union another Queryable instance, similar to SQL's union |
|
public Queryable<T> |
unionAll(Queryable<? extends T> queryable) Union all another Queryable instance, similar to SQL's union all |
|
public Queryable<T> |
where(Predicate<? super T> filter) Filter Queryable instance via some condition, similar to SQL's where |
The most powerful aggregate function in GINQ, it will receive the grouped result(Queryable instance) and apply any processing
mapper
- map the grouped result(Queryable instance) to aggregate resultU
- the type aggregate result Aggregate function avg
, similar to SQL's avg
mapper
- choose the field to calculate the average Aggreate function count
, similar to SQL's count
Aggregate function count
, similar to SQL's count
Note: if the chosen field is null
, the field will not be counted
mapper
- choose the field to count Cross join another Queryable instance, similar to SQL's cross join
queryable
- another Queryable instanceU
- the type of element from another Queryable instance Eliminate duplicated records, similar to SQL's distinct
Check if the result is empty, similar to SQL's exists
true
if result is not empty, otherwise false
Factory method to create Queryable instance
iterable
- iterable object, e.g. ListT
- the type of elementFactory method to create Queryable instance
array
- array objectT
- the type of elementFactory method to create Queryable instance
sourceStream
- stream objectT
- the type of elementReturns the original Queryable instance directly
queryable
- queryable objectT
- the type of element Full join another Queryable instance, similar to SQL's full join
queryable
- another Queryable instancejoiner
- join conditionU
- the type of element from another Queryable instance Group by Queryable instance, similar to SQL's group by
classifier
- the classifier for group byhaving
- the filter conditionK
- the type of group key Group by Queryable instance without having
clause, similar to SQL's group by
classifier
- the classifier for group byK
- the type of group key Inner join another Queryable instance, similar to SQL's inner join
queryable
- another Queryable instancejoiner
- join conditionU
- the type of element from another Queryable instance Intersect another Queryable instance, similar to SQL's intersect
queryable
- the other Queryable instance Left join another Queryable instance, similar to SQL's left join
queryable
- another Queryable instancejoiner
- join conditionU
- the type of element from another Queryable instance Paginate Queryable instance, similar to MySQL's limit
offset
- the start positionsize
- the size to take Paginate Queryable instance, similar to MySQL's limit
size
- the size to take Aggregate function max
, similar to SQL's max
mapper
- choose the field to find the maximumU
- the field type Aggregate function min
, similar to SQL's min
mapper
- choose the field to find the minimumU
- the field type Minus another Queryable instance, similar to SQL's minus
queryable
- the other Queryable instance Sort Queryable instance, similar to SQL's order by
orders
- the order rules for sortingU
- the type of field to sort Right join another Queryable instance, similar to SQL's right join
queryable
- another Queryable instancejoiner
- join conditionU
- the type of element from another Queryable instance Project Queryable instance, similar to SQL's select
mapper
- project fieldsU
- the type of project recordReturns the count of elements of the Queryable instance
Create Stream<T> object for the Queryable instance
Aggregate function sum
, similar to SQL's sum
mapper
- choose the field to sumConvert the Queryable instance to List<T> instance
Union another Queryable instance, similar to SQL's union
queryable
- the other Queryable instance Union all another Queryable instance, similar to SQL's union all
queryable
- the other Queryable instance