-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Description
I want to unmarshal string param to array of strings
Checklist
- Dependencies installed
- No typos
- Searched existing issues and docs
Expected behaviour
&{[city city.country]}
Actual behaviour
&{[city,city.country]}
Steps to reproduce
Working code to debug
type Expand []string
func (t *Expand) UnmarshalParam(param string) error {
*t = Expand(strings.Split(param, ","))
return nil
}
type HotelRequest struct {
Expand Expand `json:"ex" form:"ex" query:"ex"`
}then i try bind param:
requestModel := new(request.HotelRequest)
if err := c.Bind(requestModel); err != nil {
log.Fatal(err)
}
fmt.Println(requestModel)Version/commit
Metadata
Metadata
Assignees
Labels
No labels