Skip to content

Commit bb2f8cc

Browse files
committed
refactor: rename formatQuery() to formatQueryAsSingleLine()
1 parent 06a2f0c commit bb2f8cc

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/cli.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,11 @@ const createEndpoints = async (destDir, { lang }, config) => {
255255
},
256256

257257
// "SELECT *\n FROM foo WHERE id = :p.id" => "SELECT * FROM foo WHERE id = :id"
258-
"formatQuery": (query) => {
258+
"formatQueryAsSingleLine": (query) => {
259259
return removePlaceholders(flattenQuery(removeComments(query)))
260260
},
261261

262-
// Differs from formatQuery() as it doesn't flatten query (preserve original formatting)
263-
// and also use backticks for multiline strings
262+
// Uses backticks for multiline strings.
264263
// (used only with JS, TS, Golang)
265264
"formatQueryForJs": (query, indentLevel) => {
266265
const sql = removePlaceholders(removeComments(query))
@@ -273,8 +272,7 @@ const createEndpoints = async (destDir, { lang }, config) => {
273272
return `\n${indent}"${sql}"`
274273
},
275274

276-
// Differs from formatQuery() as it doesn't flatten query (preserve original formatting)
277-
// and also use """ for multiline strings
275+
// Uses """ for multiline strings.
278276
// (used only with Python)
279277
"formatQueryForPython": (query, indentLevel) => {
280278
const sql = removePlaceholders(removeComments(query))

src/templates/routes.go.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function query2dto(parser, method) {
9797
const queryAst = parser.astify(query)
9898
const props = extractProperties(queryAst)
9999
if (props.length === 0) {
100-
console.warn('Could not create DTO for query:', formatQuery(query))
100+
console.warn('Could not create DTO for query:', formatQueryAsSingleLine(query))
101101
console.debug('Query AST:')
102102
console.debug(queryAst)
103103
return null

src/templates/routes.py.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function query2dto(parser, method) {
101101
const queryAst = parser.astify(query)
102102
const props = extractProperties(queryAst)
103103
if (props.length === 0) {
104-
console.warn('Could not create DTO for query:', formatQuery(query))
104+
console.warn('Could not create DTO for query:', formatQueryAsSingleLine(query))
105105
console.debug('Query AST:')
106106
console.debug(queryAst)
107107
return null

0 commit comments

Comments
 (0)