@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 |
<T> |
public static Queryable<T> |
emptyQueryable() Returns the empty Queryable instance |
|
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>> |
fullHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Full hash join another Queryable instance, similar to SQL's full join |
<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 |
|
public Queryable<Tuple2<?, Queryable<T>>> |
groupBy(Function<? super T, ?> classifier, Predicate<? super Tuple2<?, Queryable<? extends T>>> having) Group by Queryable instance, similar to SQL's group by |
|
public Queryable<Tuple2<?, Queryable<T>>> |
groupBy(Function<? super T, ?> classifier) Group by Queryable instance without having clause, similar to SQL's group by |
<U> |
public Queryable<Tuple2<T, U>> |
innerHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Inner hash join another Queryable instance, similar to SQL's inner hash join .
|
<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>> |
leftHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Left hash join another Queryable instance, similar to SQL's left hash join |
<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 |
|
public BigDecimal |
median(Function<? super T, ? extends Number> mapper) Aggregate function median , similar to SQL's median |
<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 extends Comparable<? super U>> |
public Queryable<T> |
orderBy(List<? extends Order<? super T, ? extends U>> orders) Sort Queryable instance, similar to SQL's order by |
<U extends Comparable<? super U>> |
public Window<T> |
over(Tuple2<T, Long> currentRecord, WindowDefinition<T, U> windowDefinition) Open window for current record |
<U> |
public Queryable<Tuple2<T, U>> |
rightHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Right hash join another Queryable instance, similar to SQL's right join |
<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(BiFunction<? super T, ? super Queryable<? extends 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 BigDecimal |
stdev(Function<? super T, ? extends Number> mapper) Aggregate function stdev , similar to SQL's stdev |
|
public BigDecimal |
stdevp(Function<? super T, ? extends Number> mapper) Aggregate function stdevp , similar to SQL's stdevp |
|
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 BigDecimal |
var(Function<? super T, ? extends Number> mapper) Aggregate function var , similar to SQL's var |
|
public BigDecimal |
varp(Function<? super T, ? extends Number> mapper) Aggregate function varp , similar to SQL's varp |
|
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
Returns the empty Queryable instance
T
- the type of element 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 hash join another Queryable instance, similar to SQL's full join
queryable
- another Queryable instancefieldsExtractor1
- extract fields of one data sourcefieldsExtractor2
- extract fields of the other data sourceU
- the type of element from another Queryable instance 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 condition Group by Queryable instance without having
clause, similar to SQL's group by
classifier
- the classifier for group by Inner hash join another Queryable instance, similar to SQL's inner hash join
.
Note: Inner hash join requires equijoin predicate, e.g. on a == b
queryable
- another Queryable instancefieldsExtractor1
- extract fields of one data sourcefieldsExtractor2
- extract fields of the other data sourceU
- the type of element from another Queryable instance 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 hash join another Queryable instance, similar to SQL's left hash join
queryable
- another Queryable instancefieldsExtractor1
- extract fields of one data sourcefieldsExtractor2
- extract fields of the other data sourceU
- the type of element from another 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 median
, similar to SQL's median
mapper
- choose the field to median 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 Sort Queryable instance, similar to SQL's order by
orders
- the order rules for sortingU
- the type of field to sortOpen window for current record
currentRecord
- current recordwindowDefinition
- window definitionU
- the type of window value Right hash join another Queryable instance, similar to SQL's right join
queryable
- another Queryable instancefieldsExtractor1
- extract fields of one data sourcefieldsExtractor2
- extract fields of the other data sourceU
- the type of element from another Queryable instance 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
Aggregate function stdev
, similar to SQL's stdev
mapper
- choose the field to calculate the statistical standard deviation Aggregate function stdevp
, similar to SQL's stdevp
mapper
- choose the field to calculate the statistical standard deviation for the populationCreate 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 Aggregate function var
, similar to SQL's var
mapper
- choose the field to calculate the statistical variance Aggregate function varp
, similar to SQL's varp
mapper
- choose the field to calculate the statistical variance for the population