Versions in this module Expand all Collapse all v0 v0.5.0 Jul 29, 2024 Changes in this version + const HeaderKeyLocation + const LinkAttributeRelated + const LinkAttributeSelf + func Error(w http.ResponseWriter, err error, status int, options ...WriteOptions) + func Write(w http.ResponseWriter, data any, status int, options ...WriteOptions) + type Config struct + func DefaultConfig() Config + func (c *Config) Apply(options ...Options) + func (c *Config) ApplyWriteOptions(options ...WriteOptions) + type DocumentOptions = func(http.ResponseWriter, *jsonapi.Document) error + type Handler struct + func Handle(handler http.Handler, options ...Options) Handler + func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Middleware = func(next http.Handler) http.Handler + type Options func(*Config) + func WithContextResolver(resolver jsonapi.RequestContextResolver) Options + func WithMiddleware(middleware Middleware) Options + type Relationship struct + AddRef http.Handler + GetRef http.Handler + RemoveRef http.Handler + UpdateRef http.Handler + func (h Relationship) ServeHTTP(w http.ResponseWriter, r *http.Request) + type RelationshipMux map[string]http.Handler + func (h RelationshipMux) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Resource struct + Create http.Handler + Delete http.Handler + Get http.Handler + List http.Handler + Refs http.Handler + Update http.Handler + func (h Resource) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ResourceMux map[string]http.Handler + func (m ResourceMux) Handle(resource string, handler http.Handler) + func (m ResourceMux) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ResponseRecorder struct + Document *jsonapi.Document + HeaderMap http.Header + JSONMarshal jsonMarshalFunc + JSONUnmarshal jsonUnmarshalFunc + Status int + func NewRecorder() *ResponseRecorder + func (ww *ResponseRecorder) Header() http.Header + func (ww *ResponseRecorder) Write(p []byte) (int, error) + func (ww *ResponseRecorder) WriteHeader(status int) + func (ww ResponseRecorder) Flush(w http.ResponseWriter) + type WriteOptions func(*Config) + func WithDocumentOptions(options DocumentOptions) WriteOptions + func WithJSONMarshaler(marshal jsonMarshalFunc) WriteOptions + func WriteLink(key string, href string) WriteOptions + func WriteLocationHeader(baseURL string, resolver jsonapi.URLResolver) WriteOptions + func WriteMeta(key string, value any) WriteOptions + func WriteNavigationLinks(r *http.Request, info map[string]query.Page) WriteOptions + func WriteRef(name string) WriteOptions + func WriteResourceLinks(baseURL string, resolver jsonapi.URLResolver) WriteOptions + func WriteSelfLink(r *http.Request) WriteOptions + func WriteSortedPrimaryData(cmp jsonapi.Comparator, criterion []query.Sort) WriteOptions Other modules containing this package github.com/gonobo/jsonapi/v2