Interface Queryable<T>
- Type Parameters:
- T- the type of Queryable element
public interface Queryable<T>
Represents the queryable objects, e.g. Java collections
- Since:
- 4.0.0
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classQueryable.Order<T,U extends Comparable<? super U>> Represents an order rule
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescription<U> UThe most powerful aggregate function in GINQ, it will receive the grouped result(Queryableinstance) and apply any processingAggregate functionavg, similar to SQL'savgcount()Aggregate functioncount, similar to SQL'scount<U> LongAggregate functioncount, similar to SQL'scountNote: if the chosen field isnull, the field will not be countedCross join anotherQueryableinstance, similar to SQL'scross joindistinct()Eliminate duplicated records, similar to SQL'sdistinctstatic <T> Queryable<T>Returns the empty Queryable instancedefault booleanexists()Check if the result is empty, similar to SQL'sexistsstatic <T> Queryable<T>Factory method to createQueryableinstancestatic <T> Queryable<T>Factory method to createQueryableinstancestatic <T> Queryable<T>Returns the originalQueryableinstance directlystatic <T> Queryable<T>from(T[] array) Factory method to createQueryableinstancefullHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Full hash join anotherQueryableinstance, similar to SQL'sfull joinfullJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Full join anotherQueryableinstance, similar to SQL'sfull joingroupBy(Function<? super T, ?> classifier, Predicate<? super Tuple2<?, Queryable<? extends T>>> having) Group byQueryableinstance, similar to SQL'sgroup byinnerHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Inner hash join anotherQueryableinstance, similar to SQL'sinner hash join.innerJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Inner join anotherQueryableinstance, similar to SQL'sinner joinIntersect anotherQueryableinstance, similar to SQL'sintersectleftHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Left hash join anotherQueryableinstance, similar to SQL'sleft hash joinleftJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Left join anotherQueryableinstance, similar to SQL'sleft joinlimit(long size) PaginateQueryableinstance, similar to MySQL'slimitlimit(long offset, long size) PaginateQueryableinstance, similar to MySQL'slimit<U> List<U>Aggregate functionlist.<U extends Comparable<? super U>>
 UAggregate functionmax, similar to SQL'smaxAggregate functionmedian, similar to SQL'smedian<U extends Comparable<? super U>>
 UAggregate functionmin, similar to SQL'sminMinus anotherQueryableinstance, similar to SQL'sminusdefault <U extends Comparable<? super U>>
 Queryable<T>orderBy(List<? extends Queryable.Order<? super T, ? extends U>> orders) SortQueryableinstance, similar to SQL'sorder by<U extends Comparable<? super U>>
 Queryable<T>orderBy(Queryable.Order<? super T, ? extends U>... orders) SortQueryableinstance, similar to SQL'sorder by<U extends Comparable<? super U>>
 Window<T>Open window for current recordrightHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Right hash join anotherQueryableinstance, similar to SQL'sright joinrightJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Right join anotherQueryableinstance, similar to SQL'sright join<U> Queryable<U>select(BiFunction<? super T, ? super Queryable<? extends T>, ? extends U> mapper) ProjectQueryableinstance, similar to SQL'sselectlongsize()Returns the count of elements of theQueryableinstanceAggregate functionstdev, similar to SQL'sstdevAggregate functionstdevp, similar to SQL'sstdevpstream()Aggregate functionsum, similar to SQL'ssumtoList()Union anotherQueryableinstance, similar to SQL'sunionUnion all anotherQueryableinstance, similar to SQL'sunion allAggregate functionvar, similar to SQL'svarAggregate functionvarp, similar to SQL'svarpFilterQueryableinstance via some condition, similar to SQL'swhere
- 
Field Details- 
NULLRepresents null of GINQ, e.g. it could be used as the default group field- Since:
- 4.0.0
 
- 
EMPTY_QUERYABLERepresents the empty Queryable instance- Since:
- 4.0.0
 
 
- 
- 
Method Details- 
emptyQueryableReturns the empty Queryable instance- Type Parameters:
- T- the type of element
- Returns:
- the empty Queryable instance
- Since:
- 4.0.0
 
- 
fromFactory method to createQueryableinstance
- 
fromFactory method to createQueryableinstance- Type Parameters:
- T- the type of element
- Parameters:
- array- array object
- Returns:
- the Queryableinstance
- Since:
- 4.0.0
 
- 
fromFactory method to createQueryableinstance- Type Parameters:
- T- the type of element
- Parameters:
- sourceStream- stream object
- Returns:
- the Queryableinstance
- Since:
- 4.0.0
 
- 
fromReturns the originalQueryableinstance directly- Type Parameters:
- T- the type of element
- Parameters:
- queryable- queryable object
- Returns:
- the Queryableinstance
- Since:
- 4.0.0
 
- 
innerJoin<U> Queryable<Tuple2<T,U>> innerJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Inner join anotherQueryableinstance, similar to SQL'sinner join
- 
innerHashJoin<U> Queryable<Tuple2<T,U>> innerHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Inner hash join anotherQueryableinstance, similar to SQL'sinner hash join. Note: Inner hash join requires equijoin predicate, e.g.on a == b
- 
leftJoin<U> Queryable<Tuple2<T,U>> leftJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Left join anotherQueryableinstance, similar to SQL'sleft join
- 
leftHashJoin<U> Queryable<Tuple2<T,U>> leftHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Left hash join anotherQueryableinstance, similar to SQL'sleft hash join
- 
rightJoin<U> Queryable<Tuple2<T,U>> rightJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Right join anotherQueryableinstance, similar to SQL'sright join
- 
rightHashJoin<U> Queryable<Tuple2<T,U>> rightHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Right hash join anotherQueryableinstance, similar to SQL'sright join
- 
fullJoin<U> Queryable<Tuple2<T,U>> fullJoin(Queryable<? extends U> queryable, BiPredicate<? super T, ? super U> joiner) Full join anotherQueryableinstance, similar to SQL'sfull join
- 
fullHashJoin<U> Queryable<Tuple2<T,U>> fullHashJoin(Queryable<? extends U> queryable, Function<? super T, ?> fieldsExtractor1, Function<? super U, ?> fieldsExtractor2) Full hash join anotherQueryableinstance, similar to SQL'sfull join
- 
crossJoinCross join anotherQueryableinstance, similar to SQL'scross join
- 
whereFilterQueryableinstance via some condition, similar to SQL'swhere- Parameters:
- filter- the filter condition
- Returns:
- filter result
- Since:
- 4.0.0
 
- 
groupByQueryable<Tuple2<?,Queryable<T>>> groupBy(Function<? super T, ?> classifier, Predicate<? super Tuple2<?, Queryable<? extends T>>> having) Group byQueryableinstance, similar to SQL'sgroup by- Parameters:
- classifier- the classifier for group by
- having- the filter condition
- Returns:
- the result of group by
- Since:
- 4.0.0
 
- 
groupBy- Parameters:
- classifier- the classifier for group by
- Returns:
- the result of group by
- Since:
- 4.0.0
 
- 
orderBy<U extends Comparable<? super U>> Queryable<T> orderBy(Queryable.Order<? super T, ? extends U>... orders) SortQueryableinstance, similar to SQL'sorder by- Type Parameters:
- U- the type of field to sort
- Parameters:
- orders- the order rules for sorting
- Returns:
- the result of order by
- Since:
- 4.0.0
 
- 
orderBydefault <U extends Comparable<? super U>> Queryable<T> orderBy(List<? extends Queryable.Order<? super T, ? extends U>> orders) SortQueryableinstance, similar to SQL'sorder by- Type Parameters:
- U- the type of field to sort
- Parameters:
- orders- the order rules for sorting
- Returns:
- the result of order by
- Since:
- 4.0.0
 
- 
limitPaginateQueryableinstance, similar to MySQL'slimit- Parameters:
- offset- the start position
- size- the size to take
- Returns:
- the result of paginating
- Since:
- 4.0.0
 
- 
limitPaginateQueryableinstance, similar to MySQL'slimit- Parameters:
- size- the size to take
- Returns:
- the result of paginating
- Since:
- 4.0.0
 
- 
selectProjectQueryableinstance, similar to SQL'sselect- Type Parameters:
- U- the type of project record
- Parameters:
- mapper- project fields
- Returns:
- the result of projecting
- Since:
- 4.0.0
 
- 
existsdefault boolean exists()Check if the result is empty, similar to SQL'sexists- Returns:
- the result of checking, trueif result is not empty, otherwisefalse
 
- 
distinctEliminate duplicated records, similar to SQL'sdistinct- Returns:
- the distinct result
- Since:
- 4.0.0
 
- 
unionUnion anotherQueryableinstance, similar to SQL'sunion- Parameters:
- queryable- the other- Queryableinstance
- Returns:
- the union result
- Since:
- 4.0.0
 
- 
unionAllUnion all anotherQueryableinstance, similar to SQL'sunion all- Parameters:
- queryable- the other- Queryableinstance
- Returns:
- the union all result
- Since:
- 4.0.0
 
- 
intersectIntersect anotherQueryableinstance, similar to SQL'sintersect- Parameters:
- queryable- the other- Queryableinstance
- Returns:
- the intersect result
- Since:
- 4.0.0
 
- 
minusMinus anotherQueryableinstance, similar to SQL'sminus- Parameters:
- queryable- the other- Queryableinstance
- Returns:
- the minus result
- Since:
- 4.0.0
 
- 
countLong count()Aggregate functioncount, similar to SQL'scount- Returns:
- count result
- Since:
- 4.0.0
 
- 
countAggregate functioncount, similar to SQL'scountNote: if the chosen field isnull, the field will not be counted- Parameters:
- mapper- choose the field to count
- Returns:
- count result
- Since:
- 4.0.0
 
- 
sumAggregate functionsum, similar to SQL'ssum- Parameters:
- mapper- choose the field to sum
- Returns:
- sum result
- Since:
- 4.0.0
 
- 
avgAggregate functionavg, similar to SQL'savg- Parameters:
- mapper- choose the field to calculate the average
- Returns:
- avg result
- Since:
- 4.0.0
 
- 
minAggregate functionmin, similar to SQL'smin- Type Parameters:
- U- the field type
- Parameters:
- mapper- choose the field to find the minimum
- Returns:
- min result
- Since:
- 4.0.0
 
- 
maxAggregate functionmax, similar to SQL'smax- Type Parameters:
- U- the field type
- Parameters:
- mapper- choose the field to find the maximum
- Returns:
- min result
- Since:
- 4.0.0
 
- 
listAggregate functionlist. There is no equivalent in standard SQL but various databases support a similar concept named:list,listagg, orarray_agg.- Type Parameters:
- U- the field type
- Parameters:
- mapper- choose the field to include in the list
- Returns:
- aggregate list result
- Since:
- 4.0.14
 
- 
medianAggregate functionmedian, similar to SQL'smedian- Parameters:
- mapper- choose the field to median
- Returns:
- median result
- Since:
- 4.0.0
 
- 
stdevAggregate functionstdev, similar to SQL'sstdev- Parameters:
- mapper- choose the field to calculate the statistical standard deviation
- Returns:
- statistical standard deviation
- Since:
- 4.0.0
 
- 
stdevpAggregate functionstdevp, similar to SQL'sstdevp- Parameters:
- mapper- choose the field to calculate the statistical standard deviation for the population
- Returns:
- statistical standard deviation for the population
- Since:
- 4.0.0
 
- 
varAggregate functionvar, similar to SQL'svar- Parameters:
- mapper- choose the field to calculate the statistical variance
- Returns:
- statistical variance
- Since:
- 4.0.0
 
- 
varpAggregate functionvarp, similar to SQL'svarp- Parameters:
- mapper- choose the field to calculate the statistical variance for the population
- Returns:
- statistical variance for the population
- Since:
- 4.0.0
 
- 
aggThe most powerful aggregate function in GINQ, it will receive the grouped result(Queryableinstance) and apply any processing- Type Parameters:
- U- the type aggregate result
- Parameters:
- mapper- map the grouped result(- Queryableinstance) to aggregate result
- Returns:
- aggregate result
- Since:
- 4.0.0
 
- 
toList- Returns:
- the result list
- Since:
- 4.0.0
 
- 
sizelong size()Returns the count of elements of theQueryableinstance- Returns:
- the count of elements of the Queryableinstance
- Since:
- 4.0.0
 
- 
stream- Returns:
- the result stream
- Since:
- 4.0.0
 
- 
over<U extends Comparable<? super U>> Window<T> over(Tuple2<T, Long> currentRecord, WindowDefinition<T, U> windowDefinition) Open window for current record- Type Parameters:
- U- the type of window value
- Parameters:
- currentRecord- current record
- windowDefinition- window definition
- Returns:
- the window
 
 
-