sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Implement tern template support

Open No3371 opened this issue 2 months ago • 1 comments

tern allows sql scripts reference scripts in sub folders with the syntax {{ template "path/to/script" . }}.

sqlc does not accept this syntax appears within migration scripts, which means you either gives up the nice organizational feature of tern, or gives up sqlc.

By adding a pre-processor func TransformStatements() next to RemoveRollbackStatements(), this PR allows sqlc to fetch content of script files referenced by tern template syntax and replace the syntax lines with the actual sql file content.

No3371 avatar Oct 16 '25 15:10 No3371

Sorry for the force push. I accidentally included go.sum change in the PR and did some cleanup.

No3371 avatar Oct 16 '25 15:10 No3371