2021-01-07 02:04:10 +02:00
|
|
|
const {
|
|
|
|
columnize: columnize_,
|
|
|
|
wrap: wrap_,
|
|
|
|
} = require('./formatter/wrappingFormatter');
|
2015-05-09 13:58:18 -04:00
|
|
|
|
2019-06-04 00:37:17 +02:00
|
|
|
class Formatter {
|
2018-02-01 23:41:01 +01:00
|
|
|
constructor(client, builder) {
|
2018-07-09 08:10:34 -04:00
|
|
|
this.client = client;
|
|
|
|
this.builder = builder;
|
|
|
|
this.bindings = [];
|
2016-09-12 18:26:49 -04:00
|
|
|
}
|
2015-05-09 13:58:18 -04:00
|
|
|
|
|
|
|
// Accepts a string or array of columns to wrap as appropriate.
|
2016-05-06 13:28:50 +10:00
|
|
|
columnize(target) {
|
2021-01-07 02:04:10 +02:00
|
|
|
return columnize_(target, this.builder, this.client, this);
|
2016-09-12 18:26:49 -04:00
|
|
|
}
|
2015-05-09 13:58:18 -04:00
|
|
|
|
|
|
|
// Puts the appropriate wrapper around a value depending on the database
|
|
|
|
// engine, unless it's a knex.raw value, in which case it's left alone.
|
2019-10-29 04:38:01 +08:00
|
|
|
wrap(value, isParameter) {
|
2021-01-07 02:04:10 +02:00
|
|
|
return wrap_(value, isParameter, this.builder, this.client, this);
|
2016-09-12 18:26:49 -04:00
|
|
|
}
|
|
|
|
}
|
2019-06-04 00:37:17 +02:00
|
|
|
|
|
|
|
module.exports = Formatter;
|