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