123456789101112131415161718192021 |
- const jsonApi = require('./postgresJsonApi');
- const ObjectionToKnexConvertingOperation = require('../ObjectionToKnexConvertingOperation');
- class WhereJsonPostgresOperation extends ObjectionToKnexConvertingOperation {
- onBuildKnex(knexBuilder) {
- const rawArgs = jsonApi.whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(
- this.args[0],
- this.opt.operator,
- this.args[1],
- this.opt.prefix
- );
- if (this.opt.bool === 'or') {
- knexBuilder.orWhereRaw.apply(knexBuilder, rawArgs);
- } else {
- knexBuilder.whereRaw.apply(knexBuilder, rawArgs);
- }
- }
- }
- module.exports = WhereJsonPostgresOperation;
|