sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Make `sqlc.embed` compatible with `pgFormatter` and `sql-formatter`

Open Dragon-Huang0403 opened this issue 1 year ago • 0 comments

What does this PR fixed?

  • This PR addresses issues with SQL formatting tools pgFormatter and sql-formatter. These tools are used to format SQL, similar to how go fmt formats Go code.
  • Both formatters, by default, add spaces before function calls. This changes sqlc.embed(name) to sqlc.embed (name), which sqlc cannot parse correctly:
$ cd example/batch

$ sqlc generate                                                                                                                                                                                                                                   
> # package batch
> postgresql/query.sql:10:1: edited query syntax is invalid: syntax error at or near ")"

Dragon-Huang0403 avatar Jun 08 '24 08:06 Dragon-Huang0403