All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.streamx.fluent.SQL.PostgreSQL.SQL Maven / Gradle / Ivy

package co.streamx.fluent.SQL.PostgreSQL;

import java.sql.Timestamp;
import java.util.Date;
import java.util.EnumSet;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.function.Consumer;

import co.streamx.fluent.JPA.spi.SQLConfigurator;
import co.streamx.fluent.SQL.Record2;
import co.streamx.fluent.notation.Capability;
import co.streamx.fluent.notation.Function;
import co.streamx.fluent.notation.Literal;
import co.streamx.fluent.notation.Local;
import co.streamx.fluent.notation.Operator;
import co.streamx.fluent.notation.ParameterContext;

public interface SQL {

    @Function(omitParentheses = true)
    static  T LATERAL(T subQuery) {
        throw new UnsupportedOperationException();
    }

    // String

    @Function
    static String CHR(int charCode) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String CONVERT_FROM(String expression,
                               String sourceCharSet) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String CONVERT_TO(String expression,
                             String destinationCharSet) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String CONVERT(String expression,
                          String destinationCharSet,
                          String sourceCharSet) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String DECODE(String expression,
                         String format) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String ENCODE(String expression,
                         String format) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String FORMAT(String format,
                         Object... arguments) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String INITCAP(String expression) {
        throw new UnsupportedOperationException();
    }

    @Function
    static int LENGTH(String expression) {
        throw new UnsupportedOperationException();
    }

    @Function
    static int LENGTH(String expression,
                      String encoding) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String LPAD(String expression,
                       int length) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String LPAD(String expression,
                       int length,
                       String padWith) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String MD5(CharSequence expression) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static String REGEXP_REPLACE(String expression,
                                 String pattern,
                                 String replaceExpression) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static String REGEXP_REPLACE(String expression,
                                 String pattern,
                                 String replaceExpression,
                                 String flags) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String RPAD(String expression,
                       int length) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String RPAD(String expression,
                       int length,
                       String padWith) {
        throw new UnsupportedOperationException();
    }

    @Function(argumentsDelimiter = " IN")
    static int POSITION(String expressionToFind,
                        String expressionToSearch) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String REPEAT(String expression,
                         Number count) {
        throw new UnsupportedOperationException();
    }

    @Function
    static int STRPOS(String expressionToFind,
                       String expressionToSearch) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static int STARTS_WITH(String expression,
                           String prefix) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String SUBSTR(String expression,
                         int from,
                         int count) {
        throw new UnsupportedOperationException();
    }

    @Function
    static String SUBSTR(String expression,
                         int from) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static String TO_CHAR(Object expression,
                          String format) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static  T TO_DATE(String expression,
                                      String format) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static  String TO_HEX(T integralExpression) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static  T TO_NUMBER(String expression,
                                          String format) {
        throw new UnsupportedOperationException();
    }

    @Function(underscoresAsBlanks = false)
    static Timestamp TO_TIMESTAMP(String expression,
                                  String format) {
        throw new UnsupportedOperationException();
    }

    /**
     * Special EXCLUDED table is used to reference values originally proposed for insertion.
     * 
     * @see SQL INSERT
     * 
     *      
To use, cast it to the table being updated, e.g. * *
     * {@code
     *     Distributor excluded = EXCLUDED();
     *     // and later access it's properties as usual:
     *     excluded.getDname()
     * }
     * 
* *
*/ @Function(omitParentheses = true) static T EXCLUDED() { throw new UnsupportedOperationException(); } @SafeVarargs @Function static T GREATEST(T... expressions) { throw new UnsupportedOperationException(); } @SafeVarargs @Function static T LEAST(T... expressions) { throw new UnsupportedOperationException(); } @Function(omitParentheses = true, parameterContext = ParameterContext.SELECT) static void RETURNING(Object... expressions) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false, requiresAlias = true) static R GENERATE_SERIES(T start, T stop) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false, requiresAlias = true) static R GENERATE_SERIES(T start, T stop, T step) { throw new UnsupportedOperationException(); } @Function(omitParentheses = true) static void LIMIT(long rowCount) { throw new UnsupportedOperationException(); } // Math @Function static T DIV(T x, T y) { throw new UnsupportedOperationException(); } @Function static T LN(T numeric) { throw new UnsupportedOperationException(); } @Function static T MOD(T x, T y) { throw new UnsupportedOperationException(); } @Function static double RANDOM() { throw new UnsupportedOperationException(); } // Date / Time /** * 1970-01-01 00:00:00+00 (Unix system time zero) */ @Function(omitParentheses = true) static Date EPOCH() { throw new UnsupportedOperationException(); } /** * later than all other time stamps */ @Function(omitParentheses = true) static Date INFINITY() { throw new UnsupportedOperationException(); } /** * earlier than all other time stamps */ @Function(name = "-INFINITY", omitParentheses = true) static Date negativeINFINITY() { throw new UnsupportedOperationException(); } /** * current transaction's start time */ @Function static T NOW() { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false, omitParentheses = true) static T CURRENT_TIME() { throw new UnsupportedOperationException(); } @Function(omitParentheses = true) static T LOCALTIME() { throw new UnsupportedOperationException(); } @Function(omitParentheses = true) static Timestamp LOCALTIMESTAMP() { throw new UnsupportedOperationException(); } @Function(argumentsDelimiter = " FROM") static int EXTRACT(DatePart datePart, Date datetime) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static int DATE_TRUNC(@Literal DatePart datePart, Date datetime) { throw new UnsupportedOperationException(); } @Operator @Function(omitParentheses = true) static , T2 extends Record2> boolean OVERLAPS(T1 range1, T2 tange2) { throw new UnsupportedOperationException(); } @Operator @Function(omitParentheses = true) static boolean IS_DISTINCT_FROM(T expr1, T expr2) { throw new UnsupportedOperationException(); } // Aggregate / statistics @Function static double CORR(Object x, Object y) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double COVAR_POP(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double COVAR_SAMP(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_SLOPE(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_INTERCEPT(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static int REGR_COUNT(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_R2(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_AVGX(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_AVGY(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_SXX(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_SYY(double y, double x) { throw new UnsupportedOperationException(); } @Function(underscoresAsBlanks = false) static double REGR_SXY(double y, double x) { throw new UnsupportedOperationException(); } @Function static > T MODE() { throw new UnsupportedOperationException(); } // Sequence Manipulation Functions @Function static long CURRVAL(String sequence) { throw new UnsupportedOperationException(); } @Function static long LASTVAL() { throw new UnsupportedOperationException(); } @Function static long NEXTVAL(String sequence) { throw new UnsupportedOperationException(); } @Function static long SETVAL(String sequence, long value) { throw new UnsupportedOperationException(); } @Function static long SETVAL(String sequence, long value, boolean isCalled) { throw new UnsupportedOperationException(); } /** * Usage example:
*
* {@code registerVendorCapabilities(FluentJPA::setCapabilities);} */ @Local static void registerVendorCapabilities(Consumer> registrar) { registrar.accept( EnumSet.of(Capability.ALIAS_INSERT, Capability.ALIAS_UPDATE, Capability.ALIAS_DELETE, Capability.TABLE_AS_ALIAS)); ServiceLoader loader = ServiceLoader.load(SQLConfigurator.class); SQLConfigurator SQLConfig = loader.iterator().next(); SQLConfig.registerMethodSubstitution(String::length, SQL::LENGTH); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy