We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe.
Goqu generates queries with unintended default dialect when forget to import the dialect in every files.
This situation especially occurs when running single unit test.
Describe the solution you'd like
Provide following functions which requires specific dialect to be imported.
package goqu // RequireDialect returns dialect if available, otherwise returns an error. func RequireDialect(dialect string) (DialectWrapper, error) // MustDialect returns dialect if available, otherwise panics. func MustDialect(dialect string) DialectWrapper
Describe alternatives you've considered
The following code achieves it (by non-straightforward way though), but I would like to suggest this to be a part of goqu official functions.
func RequireDialect(dialect string) (goqu.DialectWrapper, error) { d := goqu.Dialect(dialect) if goqu.GetDialect(dialect).Dialect() == dialect { return d, nil } return d, errors.New("goqu dialect unavailable: " + dialect) } func MustDialect(dialect string) goqu.DialectWrapper { d, err := RequireDialect(dialect) if err != nil { panic(err) } return d }
Dialect
Additional context Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
Or another approach:
package goqu // RequireDialect returns an error if specified dialect is unavailable. func RequireDialect(dialect string) (error)
Usage:
if err := goqu.RequireDialect("postgres"); err != nil { panic(err) } goqu.Dialect("postgres").Select("*") //...
Sorry, something went wrong.
doug-martin
No branches or pull requests
Is your feature request related to a problem? Please describe.
Goqu generates queries with unintended default dialect when forget to import the dialect in every files.
This situation especially occurs when running single unit test.
Describe the solution you'd like
Provide following functions which requires specific dialect to be imported.
Describe alternatives you've considered
The following code achieves it (by non-straightforward way though), but I would like to suggest this to be a part of goqu official functions.
Dialect
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: