io.army.criteria.postgre.PostgreQuery Maven / Gradle / Ivy
package io.army.criteria.postgre;
import io.army.criteria.Expression;
import io.army.criteria.GroupByItem;
import io.army.criteria.Item;
import io.army.criteria.Query;
import io.army.criteria.dialect.Window;
import io.army.criteria.impl.Postgres;
import io.army.criteria.impl.SQLs;
import javax.annotation.Nullable;
import java.util.function.*;
/**
*
* This interface representing postgre SELECT statement.
*
* @see Postgre SELECT syntax
* @since 1.0
*/
public interface PostgreQuery extends Query, PostgreStatement {
interface _UnionSpec extends _StaticUnionClause<_QueryWithComplexSpec>,
_StaticIntersectClause<_QueryWithComplexSpec>,
_StaticExceptClause<_QueryWithComplexSpec>,
_AsQueryClause {
}
interface _UnionFetchSpec extends _QueryFetchClause<_AsQueryClause>, _AsQueryClause {
}
interface _UnionOffsetSpec extends _QueryOffsetClause<_UnionFetchSpec>, _UnionFetchSpec {
}
interface _UnionLimitSpec extends _RowCountLimitAllClause<_UnionOffsetSpec>, _UnionOffsetSpec {
}
interface _UnionOrderByCommaSpec extends _OrderByCommaClause<_UnionOrderByCommaSpec>,
_UnionLimitSpec {
}
interface _UnionOrderBySpec extends _StaticOrderByClause<_UnionOrderByCommaSpec>,
_DynamicOrderByClause<_UnionLimitSpec>,
_UnionLimitSpec,
_UnionSpec {
}
interface _PostgreStaticLockStrengthClause extends _MinLockStrengthClause {
R forNoKeyUpdate();
R forKeyShare();
}
interface _DynamicLockOfTableSpec extends _LockOfTableAliasClause<_MinLockWaitOptionClause- >,
_MinLockWaitOptionClause
- {
}
interface _PostgreDynamicLockStrengthClause extends Item {
_DynamicLockOfTableSpec update();
_DynamicLockOfTableSpec share();
_DynamicLockOfTableSpec noKeyUpdate();
_DynamicLockOfTableSpec keyShare();
}
interface _LockWaitOptionSpec extends _MinLockWaitOptionClause<_LockSpec>, _LockSpec {//TODO validate multi-lock clause
}
interface _LockOfTableSpec extends _LockOfTableAliasClause<_LockWaitOptionSpec>,
_LockWaitOptionSpec {
}
interface _LockSpec extends _PostgreStaticLockStrengthClause<_LockOfTableSpec>,
_DynamicLockClause<_PostgreDynamicLockStrengthClause, _LockSpec>,
_AsQueryClause {
}
interface _FetchSpec extends _QueryFetchClause<_LockSpec>, _LockSpec {
}
interface _OffsetSpec extends _QueryOffsetClause<_FetchSpec>, _LockSpec {
}
interface _LimitSpec extends _RowCountLimitAllClause<_OffsetSpec>, _OffsetSpec {
}
interface _OrderByCommaSpec extends _OrderByCommaClause<_OrderByCommaSpec>, _LimitSpec {
}
interface _OrderBySpec extends _StaticOrderByClause<_OrderByCommaSpec>,
_DynamicOrderByClause<_LimitSpec>,
_LimitSpec,
_UnionSpec {
}
interface _WindowCommaSpec extends _OrderBySpec {
Window._WindowAsClause
> comma(String name);
}
interface _WindowSpec extends Window._DynamicWindowClause>,
_OrderBySpec {
Window._WindowAsClause> window(String name);
}
interface _HavingAndSpec extends _HavingAndClause<_HavingAndSpec>, _WindowSpec {
}
interface _HavingSpec extends _StaticHavingClause<_HavingAndSpec>,
_DynamicHavingClause<_WindowSpec>,
_WindowSpec {
}
interface _GroupByCommaSpec extends _GroupByCommaClause<_GroupByCommaSpec>, _HavingSpec {
}
/**
* @see GROUP BY Clause
* @see The GROUP BY and HAVING Clauses
* @see GROUPING SETS, CUBE, and ROLLUP
*/
interface _GroupBySpec extends _StaticGroupByClause<_GroupByCommaSpec>,
_DynamicGroupByClause<_HavingSpec>,
_WindowSpec {
_GroupByCommaSpec groupBy(@Nullable SQLs.Modifier modifier, GroupByItem item);
_GroupByCommaSpec groupBy(@Nullable SQLs.Modifier modifier, GroupByItem item1, GroupByItem item2);
_GroupByCommaSpec groupBy(@Nullable SQLs.Modifier modifier, GroupByItem item1, GroupByItem item2, GroupByItem item3);
_GroupByCommaSpec groupBy(@Nullable SQLs.Modifier modifier, GroupByItem item1, GroupByItem item2, GroupByItem item3, GroupByItem item4);
_HavingSpec groupBy(@Nullable SQLs.Modifier modifier, Consumer> consumer);
_HavingSpec ifGroupBy(@Nullable SQLs.Modifier modifier, Consumer> consumer);
}
interface _WhereAndSpec extends _WhereAndClause<_WhereAndSpec>, _GroupBySpec {
}
interface _WhereSpec extends _QueryWhereClause<_GroupBySpec, _WhereAndSpec>,
_GroupBySpec {
}
interface _RepeatableOnClause extends _RepeatableClause<_OnClause<_JoinSpec>>,
_OnClause<_JoinSpec> {
}
interface _TableSampleOnSpec extends _StaticTableSampleClause<_RepeatableOnClause>,
_OnClause<_JoinSpec> {
}
interface _JoinSpec
extends _JoinModifierClause<_TableSampleOnSpec, _AsParensOnClause<_JoinSpec>>,
_PostgreJoinUndoneFuncClause<_OnClause<_JoinSpec>>,
_PostgreCrossClause<_TableSampleJoinSpec, _ParensJoinSpec>,
_PostgreCrossUndoneFuncClause<_JoinSpec>,
_JoinCteClause<_OnClause<_JoinSpec>>,
_CrossJoinCteClause<_JoinSpec>,
_PostgreJoinNestedClause<_OnClause<_JoinSpec>>,
_PostgreCrossNestedClause<_JoinSpec>,
_PostgreDynamicJoinCrossClause<_JoinSpec>,
_WhereSpec {
}
interface _ParensJoinSpec extends _OptionalParensStringClause<_JoinSpec>, _JoinSpec {
}
interface _RepeatableJoinClause extends _RepeatableClause<_JoinSpec>, _JoinSpec {
}
interface _TableSampleJoinSpec extends _StaticTableSampleClause<_RepeatableJoinClause>,
_JoinSpec {
}
interface _FromSpec
extends _PostgreFromClause<_TableSampleJoinSpec, _ParensJoinSpec>,
_PostgreFromUndoneFuncClause<_JoinSpec>,
_FromCteClause<_JoinSpec>,
_PostgreFromNestedClause<_JoinSpec>,
_UnionSpec {
}
interface _PostgreSelectCommaSpec extends _StaticSelectCommaClause<_PostgreSelectCommaSpec>,
_FromSpec {
}
interface _PostgreSelectClause
extends _ModifierSelectClause<_PostgreSelectCommaSpec>,
_DynamicModifierSelectClause>,
_DynamicDistinctOnExpClause<_PostgreSelectCommaSpec>,
_DynamicDistinctOnAndSelectsClause<_FromSpec> {
}
interface _CyclePathColumnClause {
I using(String cyclePathColumnName);
I using(Supplier supplier);
}
interface _CycleToMarkValueSpec extends _CyclePathColumnClause {
_CyclePathColumnClause to(Expression cycleMarkValue, SQLs.WordDefault wordDefault, Expression cycleMarkDefault);
_CyclePathColumnClause to(Consumer> consumer);
_CyclePathColumnClause ifTo(Consumer> consumer);
}
interface _SetCycleMarkColumnClause {
_CycleToMarkValueSpec set(String cycleMarkColumnName);
_CycleToMarkValueSpec set(Supplier supplier);
}
interface _CteCycleClause extends Item {
_SetCycleMarkColumnClause cycle(String firstColumnName, String... rest);
_SetCycleMarkColumnClause cycle(Consumer> consumer);
_SetCycleMarkColumnClause ifCycle(Consumer> consumer);
}
interface _SetSearchSeqColumnClause {
I set(String searchSeqColumnName);
I set(Supplier supplier);
}
interface _SearchFirstByClause {
_SetSearchSeqColumnClause firstBy(String firstColumnName, String... rest);
_SetSearchSeqColumnClause firstBy(Consumer> consumer);
}
interface _CteSearchClause {
_SearchFirstByClause searchBreadth();
_SearchFirstByClause searchDepth();
_SearchFirstByClause ifSearchBreadth(BooleanSupplier predicate);
_SearchFirstByClause ifSearchDepth(BooleanSupplier predicate);
}
interface _StaticCteAsClause {
> R as(Function, R> function);
> R as(@Nullable Postgres.WordMaterialized modifier,
Function, R> function);
}
interface _StaticCteParensSpec
extends _OptionalParensStringClause<_StaticCteAsClause>,
_StaticCteAsClause {
}
interface _PostgreStaticWithClause extends _StaticWithClause<_StaticCteParensSpec> {
}
interface _CteComma extends _StaticWithCommaClause<_StaticCteParensSpec>,
_StaticSpaceClause {
}
interface _StaticCteCycleSpec extends _CteCycleClause<_CteComma>, _CteComma {
}
interface _StaticCteSearchSpec extends _CteSearchClause<_StaticCteCycleSpec>,
_StaticCteCycleSpec {
}
interface _StaticCteSelectSpec extends PostgreQuery._PostgreSelectClause,
_DynamicParensRowSetClause<_StaticCteSelectSpec<_UnionOrderBySpec>, _UnionOrderBySpec> {
}
/**
*
* static sub-statement syntax forbid the WITH clause ,because it destroy the Readability of code.
*
*
* @since 1.0
*/
interface _StaticCteComplexCommandSpec
extends _StaticCteSelectSpec<_StaticCteSearchSpec>,
PostgreValues._PostgreValuesClause<_CteComma>,
PostgreInsert._StaticSubOptionSpec<_CteComma>,
PostgreUpdate._SingleUpdateClause<_CteComma, _CteComma>,
PostgreDelete._PostgreDeleteClause<_CteComma, _CteComma> {
}
interface _SelectSpec extends _PostgreSelectClause,
_DynamicParensRowSetClause<_WithSpec<_UnionOrderBySpec>, _UnionOrderBySpec> {
}
/**
*
* primary-statement syntax support static WITH clause,it's simple and clear and free
*
*
* @since 1.0
*/
interface _WithSpec extends _PostgreDynamicWithClause<_SelectSpec>,
_PostgreStaticWithClause<_SelectSpec>,
_SelectSpec {
}
interface _DynamicCteCycleSpec extends _CteCycleClause<_CommaClause>,
_CommaClause {
}
interface _DynamicCteSearchSpec extends _CteSearchClause<_DynamicCteCycleSpec>, _DynamicCteCycleSpec {
}
interface _QueryDynamicCteAsClause
extends _PostgreDynamicCteAsClause<_WithSpec<_DynamicCteSearchSpec>, _DynamicCteSearchSpec> {
}
interface _DynamicCteParensSpec extends _OptionalParensStringClause<_QueryDynamicCteAsClause>, _QueryDynamicCteAsClause {
}
interface _QueryComplexSpec extends _PostgreSelectClause,
PostgreValues._PostgreValuesClause,
_DynamicParensRowSetClause<_QueryWithComplexSpec<_UnionOrderBySpec>, _UnionOrderBySpec> {
}
interface _QueryWithComplexSpec extends _QueryComplexSpec,
_PostgreDynamicWithClause<_QueryComplexSpec>,
_PostgreStaticWithClause<_QueryComplexSpec> {
}
}