Class PostgreSQLRDBMSWeekdayOfDateFunction

java.lang.Object
com.kingsrook.qqq.backend.module.postgres.fieldfunctions.PostgreSQLRDBMSWeekdayOfDateFunction
All Implemented Interfaces:
BackendFieldFunctionAdapterInterface, RDBMSFieldFunctionAdapterInterface, Serializable

public class PostgreSQLRDBMSWeekdayOfDateFunction extends Object implements RDBMSFieldFunctionAdapterInterface
PostgreSQL adapter for the WeekdayOfDateFunction that generates EXTRACT(ISODOW FROM col) SQL expressions.

PostgreSQL's ISODOW function naturally matches QQQ's ISO-8601 weekday standard (Monday=1 … Sunday=7), so no offset is needed.

See Also:
  • Constructor Details

    • PostgreSQLRDBMSWeekdayOfDateFunction

      public PostgreSQLRDBMSWeekdayOfDateFunction()
  • Method Details

    • wrapColumnName

      public String wrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String,String> fieldNameToColumnReference)
      Returns an EXTRACT(ISODOW FROM col) expression — PostgreSQL's ISODOW directly matches ISO-8601 (Monday=1 … Sunday=7).
      Specified by:
      wrapColumnName in interface RDBMSFieldFunctionAdapterInterface
      Parameters:
      escapedColumnName - a fully qualified and escaped SQL column name for the 'main' field that this function works with (e.g., FieldFunction#withFieldName(String). Looks like: `my_table`.`my_field`.
      fieldFunction - the function with arguments, being used.
      fieldNameToColumnReference - resolves a QQQ field name to its fully- qualified escaped SQL column reference (e.g., "timeZone"`t1`.`time_zone`). Useful when the function expression needs to reference additional columns on the same row.
    • wrapColumnNameForOrderBy

      public String wrapColumnNameForOrderBy(String escapedColumnName, FieldFunction fieldFunction, Function<String,String> fieldNameToColumnReference)
      Returns the ORDER BY expression; when sortSundayFirst is true, appends % 7 so Sunday (value 7) sorts as 0 before Monday.
      Specified by:
      wrapColumnNameForOrderBy in interface RDBMSFieldFunctionAdapterInterface