-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
How to change default id:int to name:string in generated url path? #363
Comments
Hey @wymli, thanks for trying Bud!
This will improve soon with support for custom routing. I believe this is similar to: #170. If you're just looking to fill in a different field for your struct, I think you could alter the Something like (untested): type ShowInput struct {
Name string `json:"pscluster_id,omitempty"`
}
func (c *Controller) Show(in *ShowInput) {
// ...
}
That looks strange indeed! If you have a chance, a failing test would be appreciated in https://github.com/livebud/bud/blob/transpiler/internal/cli/new_controller_test.go! Otherwise, I'll have a look when I revisit the controller implementation!
Hmm, yah. I guess we probably want snake case here instead of slug case. bud/internal/cli/new_controller.go Lines 193 to 228 in bb1741f
Accepting PRs! |
First of all thank you very much for the tool, very useful.
I have some questions waiting for your help.
1. how to change id:int to name:string?
If I run the following commands to generate controller and view, I got a generated path like
// GET /pscluster/:pscluster_id/psmeta/:id
. Do we have some cli flags to change ":pscluter_id int" to ":pscluster_name string"?2. why this strange name generated?
when I run
bud new controller pscluster/psmeta create show edit update delete
, I got a strange struct name, which changepsmeta
topsmetum
3. Underscores become dashes in url
The text was updated successfully, but these errors were encountered: