Make SQLBeautify synchronous
This commit is contained in:
parent
e5d732d494
commit
194dbbd59d
@ -3,7 +3,7 @@
|
|||||||
* @copyright Crown Copyright 2016
|
* @copyright Crown Copyright 2016
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
import { format } from "sql-formatter";
|
||||||
import Operation from "../Operation.mjs";
|
import Operation from "../Operation.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,12 +34,10 @@ class SQLBeautify extends Operation {
|
|||||||
/**
|
/**
|
||||||
* @param {string} input
|
* @param {string} input
|
||||||
* @param {Object[]} args
|
* @param {Object[]} args
|
||||||
* @returns {Promise<string>}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
async run(input, args) {
|
run(input, args) {
|
||||||
const indentStr = args[0];
|
const indentStr = args[0];
|
||||||
// Lazy import of sql-formatter for performance
|
|
||||||
const {format}= await import("sql-formatter");
|
|
||||||
// Extract and replace bind variables like :Bind1 with __BIND_0__
|
// Extract and replace bind variables like :Bind1 with __BIND_0__
|
||||||
const bindRegex = /:\w+/g;
|
const bindRegex = /:\w+/g;
|
||||||
const bindMap = {};
|
const bindMap = {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user