/** * Truncate a date to the beginning of the day. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<Date> trunc(Date date) { return trunc(date, DatePart.DAY); }
/** * Truncate a date to the beginning of the day. */ @Support({ CUBRID, HSQLDB, POSTGRES }) public static Field<Date> trunc(Date date) { return trunc(date, DatePart.DAY); }
/** * Truncate a date or a timestamp to the beginning of the day. */ @Support({ CUBRID, HSQLDB, POSTGRES }) public static <T extends java.util.Date> Field<T> trunc(Field<T> date) { return trunc(date, DatePart.DAY); }
/** * Truncate a timestamp to the beginning of the day. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<Timestamp> trunc(Timestamp timestamp) { return trunc(timestamp, DatePart.DAY); }
/** * Truncate a timestamp to the beginning of the day. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<LocalDateTime> trunc(LocalDateTime timestamp) { return trunc(timestamp, DatePart.DAY); }
/** * Truncate a date or a timestamp to the beginning of the day. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static <T> Field<T> trunc(Field<T> date) { return trunc(date, DatePart.DAY); }
/** * Truncate a date to the beginning of the day. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<LocalDate> trunc(LocalDate date) { return trunc(date, DatePart.DAY); }
/** * Truncate a timestamp to the beginning of the day. */ @Support({ CUBRID, HSQLDB, POSTGRES }) public static Field<Timestamp> trunc(Timestamp timestamp) { return trunc(timestamp, DatePart.DAY); }
/** * Truncate a date to a given datepart. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<LocalDate> trunc(LocalDate date, DatePart part) { return trunc(Tools.field(date), part); }
/** * Truncate a date to a given datepart. */ @Support({ CUBRID, HSQLDB, POSTGRES }) public static Field<Date> trunc(Date date, DatePart part) { return trunc(Utils.field(date), part); }
/** * Truncate a timestamp to a given datepart. */ @Support({ CUBRID, HSQLDB, POSTGRES }) public static Field<Timestamp> trunc(Timestamp timestamp, DatePart part) { return trunc(Utils.field(timestamp), part); }
/** * Truncate a timestamp to a given datepart. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<LocalDateTime> trunc(LocalDateTime timestamp, DatePart part) { return trunc(Tools.field(timestamp), part); }
/** * Truncate a date to a given datepart. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<Date> trunc(Date date, DatePart part) { return trunc(Tools.field(date), part); }
/** * Truncate a timestamp to a given datepart. */ @Support({ CUBRID, H2, HSQLDB, POSTGRES }) public static Field<Timestamp> trunc(Timestamp timestamp, DatePart part) { return trunc(Tools.field(timestamp), part); }
/** * Truncate a number to a given number of decimals. * * @see #trunc(Field, Field) */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static <T extends Number> Field<T> trunc(Field<T> number, int decimals) { return trunc(nullSafe(number), inline(decimals)); }
/** * Truncate a number to a given number of decimals. * * @see #trunc(Field, Field) */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static <T extends Number> Field<T> trunc(T number, Field<Integer> decimals) { return trunc(Tools.field(number), nullSafe(decimals)); }
/** * Truncate a number to a given number of decimals. * * @see #trunc(Field, Field) */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static <T extends Number> Field<T> trunc(T number) { return trunc(Tools.field(number), inline(0)); }
/** * Truncate a number to a given number of decimals. * * @see #trunc(Field, Field) */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) public static <T extends Number> Field<T> trunc(T number, int decimals) { return trunc(Tools.field(number), inline(decimals)); }
private static final Field<?> parseFieldDateTruncIf(ParserContext ctx) { if (parseFunctionNameIf(ctx, "DATE_TRUNC")) { parse(ctx, '('); DatePart part = DatePart.valueOf(parseStringLiteral(ctx).toUpperCase()); parse(ctx, ','); Field<?> field = parseField(ctx, D); parse(ctx, ')'); return trunc(field, part); } return null; }
public List<ApiKeyEntry> poll(int days) { return txResult(tx -> tx.select(API_KEYS.KEY_ID, API_KEYS.KEY_NAME, API_KEYS.EXPIRED_AT, API_KEYS.USER_ID) .from(API_KEYS) .where(API_KEYS.EXPIRED_AT.isNotNull() .and(currentTimestamp().greaterOrEqual(trunc(API_KEYS.EXPIRED_AT).minus(days)) .and(API_KEYS.LAST_NOTIFIED_AT.isNull() .or(API_KEYS.LAST_NOTIFIED_AT.lessOrEqual(API_KEYS.EXPIRED_AT.minus(days)))))) .fetch(this::toEntry)); }