golang templates: reduce dbtx interface when not using prepared queries #1251
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Hi there,
i havent seen any PR requirements or existing tests on the repo so this is just the bare bone change.
Basically I am conditionally making the DBTX interface in the golang sql.DB implementation a little smaller by removing the
PrepareContext
when prepared queries are turned off, since all usages ofPrepareContext
are in the part of the template behind the same if statement. In general, if a method is not used, why add it to the interface?For some context, we ran across this because we are trying to pass to sqlc a wrapper of sql.DB (from https://pkg.go.dev/github.com/honeycombio/beeline-go/wrappers/hnysql) which has a slightly different PrepareContext return type. We don't use prepared queries so that difference shouldn't impact us.