From c97562b736e19ac442fcf37d593277e3dc371364 Mon Sep 17 00:00:00 2001 From: Aradhya Date: Fri, 8 Jul 2022 21:05:42 +0530 Subject: [PATCH] feat: Added Timestamp support --- frappe/query_builder/functions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frappe/query_builder/functions.py b/frappe/query_builder/functions.py index c1c7657b86..824de7fbf5 100644 --- a/frappe/query_builder/functions.py +++ b/frappe/query_builder/functions.py @@ -20,6 +20,14 @@ class Locate(Function): super().__init__("LOCATE", *terms, **kwargs) +class Timestamp(Function): + def __init__(self, term: str, time=None, alias=None): + if time: + super().__init__("TIMESTAMP", term, time, alias=alias) + else: + super().__init__("TIMESTAMP", term, alias=alias) + + GroupConcat = ImportMapper({db_type_is.MARIADB: GROUP_CONCAT, db_type_is.POSTGRES: STRING_AGG}) Match = ImportMapper({db_type_is.MARIADB: MATCH, db_type_is.POSTGRES: TO_TSVECTOR}) @@ -96,6 +104,7 @@ class SqlFunctions(Enum): Max = "max" Min = "min" Abs = "abs" + Timestamp = "timestamp" def _max(dt, fieldname, filters=None, **kwargs):