-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
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
Lowercase replace in strings? #57
Comments
this is a bug,I hava same situation. |
same here. has anyone a solution? |
@stdatiks @zhl11b @gitmonster https://github.com/zhiqiangxu/gg can do such jobs with more accurate control:
package xmpl
import (
"github.com/jmoiron/sqlx"
)
type Type interface{}
type Types []Type
const Table = "table"
func GetTypes(db *sqlx.DB) (Types, error) {
result := Types{}
err := db.Select(&result, "SELECT * FROM " + Table + ";")
return result, err
} Then package xmpl
import (
"github.com/jmoiron/sqlx"
)
type Types []Operation
const Table = "operation"
func GetOperations(db *sqlx.DB) (Types, error) {
result := Types{}
err := db.Select(&result, "SELECT * FROM "+Table+";")
return result, err
} |
@zhiqiangxu no, thanks |
Running into the same issue. I tried something like this: //go:generate genny -in=$GOFILE -out=gen-$GOFILE -tag=generate gen "Model=Student,Event,Location model=student,event,location" but it made functions for every combination. |
One workaround I can think of is having a generate tag for each type, for instance: //go:generate genny -in=$GOFILE -out=student-gen.go -tag=generate gen "Model=Student model=student"
//go:generate genny -in=$GOFILE -out=event-gen.go -tag=generate gen "Model=Event model=event"
//go:generate genny -in=$GOFILE -out=location-gen.go -tag=generate gen "Model=Location model=location" but something cleaner might be nice. Considering this project hasn't been updated in a while and go2 is coming soon, this is probably never going to be fixed :/ |
template
generated with
will replace
table
byOperation
, but notoperation
:The text was updated successfully, but these errors were encountered: