Open wymli opened 1 year ago
Hey @wymli, thanks for trying Bud!
- how to change id:int to name:string?
This will improve soon with support for custom routing. I believe this is similar to: https://github.com/livebud/bud/issues/170.
If you're just looking to fill in a different field for your struct, I think you could alter the json
tag to use pscluster_id
.
Something like (untested):
type ShowInput struct {
Name string `json:"pscluster_id,omitempty"`
}
func (c *Controller) Show(in *ShowInput) {
// ...
}
- why this strange name generated?
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!
- Underscores become dashes in url
Hmm, yah. I guess we probably want snake case here instead of slug case. https://github.com/livebud/bud/blob/bb1741fda309f9402c130d22ac5775049f51a175/internal/cli/new_controller.go#L193-L228
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