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 was looking at converting a small existing system to use jsonapi.
The structure for my response handlers is
type FooResponse interface {
ID() int
Foos() FooList
...
}
var resp FooResponse
// a bunch of conditional logic that gets FooResponse set
if err := jsonapi.MarshalPayload(w, resp); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
For the other ways I use FooResponse, this makes a lot of sense. Can I add a method to the FooResponse interface that jsonapi would call to build the response? Glancing through the code nothing stands out, it seems like it'll only work with a "plain" struct or slice directly?
The text was updated successfully, but these errors were encountered:
I was looking at converting a small existing system to use jsonapi.
The structure for my response handlers is
For the other ways I use FooResponse, this makes a lot of sense. Can I add a method to the FooResponse interface that jsonapi would call to build the response? Glancing through the code nothing stands out, it seems like it'll only work with a "plain" struct or slice directly?
The text was updated successfully, but these errors were encountered: