@jakub.knejzlik/ts-query
Version:
TypeScript implementation of SQL builder
45 lines (44 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SQLTarget = void 0;
/**
* SQL Target - wraps existing ISQLFlavor system for backward compatibility.
* This target compiles queries to SQL strings using the provided SQL flavor.
*/
class SQLTarget {
constructor(flavor, options) {
this.flavor = flavor;
this.options = options;
}
/**
* Get the underlying SQL flavor
*/
getFlavor() {
return this.flavor;
}
/**
* Get the sequelizable options
*/
getOptions() {
return this.options;
}
/**
* Create a new SQLTarget with different options
*/
withOptions(options) {
return new SQLTarget(this.flavor, options);
}
compileSelect(query) {
return query.toSQL(this.flavor, this.options);
}
compileInsert(mutation) {
return mutation.toSQL(this.flavor, this.options);
}
compileUpdate(mutation) {
return mutation.toSQL(this.flavor, this.options);
}
compileDelete(mutation) {
return mutation.toSQL(this.flavor, this.options);
}
}
exports.SQLTarget = SQLTarget;