You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can get the plugin to execute. I extended the sample "sqlc-gen-json" plugin to modify the "query.Name" to prefix it with
something. I can see the modifications in the generated codegen_request.json file.
My use case is, that I have many .sql files with many queries already existing, now I need to add a specific WHERE clause to all the existing SELECT queries (say "WHERE created_by=@created_by"), so I am trying to write a plugin inside which I can modify the query.Text (query string) before the rest of the sqlc codegen happens.
Regarding this I have a few questions,
Plugin seems to be only available under "codegen", how can I enable plugin under "gen" ?
Or is there a way to invoke "Generate" method in "internal/codegen/golang/gen.go" with all the config options under "gen:go" mentioned in the sqlc.yaml (shared above)
With my given use case, is there a better way to achieve the same. I dont want to manually edit all the existing queries, might have more use cases like this. Also want to this to be a framework of sorts so that everyone else in team writing queries doesn't have to worry about writing these common WHERE queries.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to play around with plugins but I can't get it to work with "go" (referring to golang.Options below in SQLGen).
This is how my sqlc.yaml looks like
I can get the plugin to execute. I extended the sample "sqlc-gen-json" plugin to modify the "query.Name" to prefix it with
something. I can see the modifications in the generated codegen_request.json file.
My use case is, that I have many .sql files with many queries already existing, now I need to add a specific WHERE clause to all the existing SELECT queries (say "WHERE created_by=@created_by"), so I am trying to write a plugin inside which I can modify the query.Text (query string) before the rest of the sqlc codegen happens.
Regarding this I have a few questions,
Thanks
Beta Was this translation helpful? Give feedback.
All reactions