|
|
|
@ -35,17 +35,8 @@ const pg = {
|
|
|
|
|
}, |
|
|
|
|
DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
|
return knex.raw( |
|
|
|
|
`CASE
|
|
|
|
|
WHEN CAST(${fn(pt.arguments[0])} AS text) LIKE '%:%' THEN |
|
|
|
|
${fn(pt.arguments[0])} + INTERVAL '${fn(pt.arguments[1])}
|
|
|
|
|
${String(fn(pt.arguments[2])).replace( |
|
|
|
|
/["']/g, |
|
|
|
|
'' |
|
|
|
|
)}' |
|
|
|
|
ELSE |
|
|
|
|
${fn(pt.arguments[0])} + INTERVAL '${fn(pt.arguments[1])}
|
|
|
|
|
${String(fn(pt.arguments[2])).replace(/["']/g, '')}' |
|
|
|
|
END${colAlias}` |
|
|
|
|
`${fn(pt.arguments[0])} + (${fn(pt.arguments[1])} ||
|
|
|
|
|
'${String(fn(pt.arguments[2])).replace(/["']/g, '')}')::interval${colAlias}` |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|