Skip to content

Allow sqlc.arg('argname') form for named params - #351

Merged
kyleconroy merged 4 commits into
sqlc-dev:masterfrom
Cyberax:master
Feb 24, 2020
Merged

Allow sqlc.arg('argname') form for named params#351
kyleconroy merged 4 commits into
sqlc-dev:masterfrom
Cyberax:master

Conversation

@Cyberax

@Cyberax Cyberax commented Feb 22, 2020

Copy link
Copy Markdown
Contributor

This pacifies static SQL analyzers in IDEs (like GoLand).

@kyleconroy

Copy link
Copy Markdown
Collaborator

Thanks for the PR.

Can you explain your use of go run? I don’t understand why the Placeholder is needed.

Comment thread internal/catalog/build.go Outdated
@Cyberax

Cyberax commented Feb 24, 2020

Copy link
Copy Markdown
Contributor Author

Can you explain your use of go run? I don’t understand why the Placeholder is needed.

My trick is to import codegen utilities like sqlc as modules. For this to work I need to make sure they are not optimized away by go mod tidy. This can be done by creating a dummy file (like use.go) that contains import (_ "github.com/kyleconroy/sqlc").

However right now sqlc can't be imported, because Golang compiler detects that there are no Go files in the package ("github.com/kyleconroy/sqlc: module github.com/kyleconroy/sqlc@latest found (v1.0.0), but does not contain package github.com/kyleconroy/sqlc")

A simple placeholder file tricks Go into accepting the "package".

@Cyberax
Cyberax requested a review from kyleconroy February 24, 2020 09:03
@kyleconroy
kyleconroy merged commit 4b756bb into sqlc-dev:master Feb 24, 2020
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