Skip to content

fix(codegen): trim the sql string before processing#113

Open
bertyhell wants to merge 1 commit intowsporto:mainfrom
bertyhell:bugfix/trim-sql
Open

fix(codegen): trim the sql string before processing#113
bertyhell wants to merge 1 commit intowsporto:mainfrom
bertyhell:bugfix/trim-sql

Conversation

@bertyhell
Copy link
Copy Markdown
Contributor

@bertyhell bertyhell commented Mar 29, 2026

to avoid trailing whitespace

example:

SELECT count(*) as count
FROM autoTags
                                    <<<< empty trailing line

would be included in the ts file with a trailing newline:

export function countAutoTags(db: Database): CountAutoTagsResult | null {
  const sql = `
	SELECT count(*) as count
	FROM autoTags
	
	`;

This PR trims that sql before it gets analysed:

export function countAutoTags(db: Database): CountAutoTagsResult | null {
	const sql = `
	SELECT count(*) as count
	FROM autoTags
	`

@wsporto
Copy link
Copy Markdown
Owner

wsporto commented Apr 18, 2026

I think we could avoid trimming the SQL. Keeping it unchanged might help users spot extra spaces or formatting issues directly in the .sql file.

I’m going to adjust the inconsistencies between the generators (pg, mysql, sqlite).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants