|
|
@ -9,7 +9,6 @@ const pg = { |
|
|
|
MIN: 'least', |
|
|
|
MIN: 'least', |
|
|
|
MAX: 'greatest', |
|
|
|
MAX: 'greatest', |
|
|
|
CEILING: 'ceil', |
|
|
|
CEILING: 'ceil', |
|
|
|
ROUND: 'round', |
|
|
|
|
|
|
|
POWER: 'pow', |
|
|
|
POWER: 'pow', |
|
|
|
SQRT: 'sqrt', |
|
|
|
SQRT: 'sqrt', |
|
|
|
SEARCH: (args: MapFnArgs) => { |
|
|
|
SEARCH: (args: MapFnArgs) => { |
|
|
@ -35,6 +34,13 @@ const pg = { |
|
|
|
.raw(`CAST(${fn(pt.arguments[0])} as DOUBLE PRECISION)${colAlias}`) |
|
|
|
.raw(`CAST(${fn(pt.arguments[0])} as DOUBLE PRECISION)${colAlias}`) |
|
|
|
.wrap('(', ')'); |
|
|
|
.wrap('(', ')'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
ROUND: ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
|
|
|
|
return knex.raw( |
|
|
|
|
|
|
|
`ROUND((${fn(pt.arguments[0])})::numeric, ${ |
|
|
|
|
|
|
|
pt?.arguments[1] ? fn(pt.arguments[1]) : 0 |
|
|
|
|
|
|
|
}) ${colAlias}` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => { |
|
|
|
return knex.raw( |
|
|
|
return knex.raw( |
|
|
|
`${fn(pt.arguments[0])} + (${fn(pt.arguments[1])} ||
|
|
|
|
`${fn(pt.arguments[0])} + (${fn(pt.arguments[1])} ||
|
|
|
|