I'm using labstack Echo (v4.1.11) go framework to create a REST API.
How do we/can we pass map
query param in the URL? I tried adding the following struct for the request body
PaginationRequest struct {
Page int64 `query:"page"`
Limit int64 `query:"limit"`
Filter map[string]string `query:"filter"`
}
and hoping I could got this url http://host/endpoint?page=1&limit=10&filter[status]=1&filter[user_id]=12
to work (read the filter["status"]
and filter["user_id"]
But when I tried binding the incoming request to PaginationRequest
it only read the page
and limit
parameter and filter = nil
I tried debug it into the echo/bind.go
the Bind function in reading the QueryParam
actually read filter[status]
as plain string "filter[status]" as key.
Is there anyway we can pass the map to the url query param? or we really have to be specific in here?