/lint-inline-sql-in-go

Parses out and shows errors for sql statements defined as string in go files.

Primary LanguageTypeScript

lint-inline-sql-in-go README

Lint inline SQL in Go helps you lint inline Postgres SQL statements in your golang code.

Features

Catch syntax errors in your inline SQL

Highlights syntax errors in inline SQL

Warns when number of parameters does not match in a INSERT query

Number of parameters does not match in INSERT query

Catch missing parameters in order

Missing parameters in order

Requirements

The extension uses and wouldn't be possible without pgsql-ast-parser. No set up required from user's end.

Extension Settings

This extension contributes the following settings:

  • lintInlineSQLInGo.sqlRegex: To match sql statements in your code. Defaults to "`([^\`]*)`" ie it matches all tilde quoted strings.

For example, to match only tilde quoted strings which are assigned to a sql variable you can do something like -

  "lintInlineSQLInGo.sqlRegex": "sql := `([^`]*)`"

Known Issues

No known issues. But syntax errors can be improved from default error messages that we get from parser.

Release Notes

0.0.3

  • Rename display name for the extension

0.0.2

  • Fix screenshots in README

0.0.1

Initial release.