Documentation
¶
Index ¶
- Constants
- func Marshal(w io.Writer, v interface{}) error
- func MarshalC(c *ctrl.Controller, w io.Writer, v interface{}) error
- func MarshalErrors(w io.Writer, errorObjects ...*aerrors.ApiError) error
- func MarshalScope(w io.Writer, s *query.Scope) error
- func MarshalScopeC(c *ctrl.Controller, w io.Writer, s *query.Scope) error
- func Unmarshal(r io.Reader, v interface{}) error
- func UnmarshalC(c *ctrl.Controller, r io.Reader, v interface{}) error
- func UnmarshalManyScope(r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
- func UnmarshalManyScopeC(c *ctrl.Controller, r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
- func UnmarshalSingleScope(r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
- func UnmarshalSingleScopeC(c *ctrl.Controller, r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
- func UnmarshalWithSelected(r io.Reader, v interface{}) ([]*mapping.StructField, error)
- func UnmarshalWithSelectedC(c *controller.Controller, r io.Reader, v interface{}) ([]*mapping.StructField, error)
- type ErrorsPayload
- type Link
- type Linkable
- type Links
- type Meta
- type Metable
- type RelationshipLinkable
- type RelationshipMetable
Constants ¶
const ( // MediaType defines the HTTP ContentType value for the jsonapi specification MediaType string = internal.MediaType )
Variables ¶
This section is empty.
Functions ¶
func MarshalC ¶
func MarshalC(c *ctrl.Controller, w io.Writer, v interface{}) error
MarshalC marshals the provided value 'v' into the writer. It uses the 'c' controller
func MarshalErrors ¶
MarshalErrors writes a JSON API response using the given `[]error`.
For more information on JSON API error payloads, see the spec here: http://jsonapi.org/format/#document-top-level and here: http://jsonapi.org/format/#error-objects.
func MarshalScope ¶
MarshalScope marshals the scope into the selceted writer for the given controller
func MarshalScopeC ¶
MarshalScopeC marshals the scope into the selceted writer for the given controller
func Unmarshal ¶
Unmarshal unmarshals the incoming reader stream into provided assuming that the value 'v' is already registered in the default controller
func UnmarshalC ¶
func UnmarshalC(c *ctrl.Controller, r io.Reader, v interface{}) error
UnmarshalC unmarshals the incoming reader stream 'r' into provided model 'v' assuming that it is already registered within the controller 'c'
func UnmarshalManyScope ¶
UnmarshalManyScope unmarshals the scope of multiple values for the default controller and given model struct
func UnmarshalManyScopeC ¶
func UnmarshalManyScopeC(c *ctrl.Controller, r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
UnmarshalManyScopeC unmarshals the scope of multiple values for the given controller and model struct
func UnmarshalSingleScope ¶
UnmarshalSingleScope unmarshals the value from the reader and creates the scope for the default controller
func UnmarshalSingleScopeC ¶
func UnmarshalSingleScopeC(c *ctrl.Controller, r io.Reader, m *mapping.ModelStruct) (*query.Scope, error)
UnmarshalSingleScopeC unmarshals the value from the reader and creates new scope
func UnmarshalWithSelected ¶
func UnmarshalWithSelected(r io.Reader, v interface{}) ([]*mapping.StructField, error)
UnmarshalWithSelected unmarshals the value from io.Reader and returns the selected fields if the value is a single
func UnmarshalWithSelectedC ¶
func UnmarshalWithSelectedC(c *controller.Controller, r io.Reader, v interface{}) ([]*mapping.StructField, error)
UnmarshalWithSelectedC unmarshals the value from io.Reader and returns the selected fields if the value is a single
Types ¶
type ErrorsPayload ¶
ErrorsPayload is a serializer struct for representing a valid JSON API errors payload.
type Linkable ¶
type Linkable interface {
JSONAPILinks() *Links
}
Linkable is used to include document links in response data e.g. {"self": "http://example.com/posts/1"}
type Links ¶
type Links map[string]interface{}
Links is used to represent a `links` object. http://jsonapi.org/format/#document-links
type Meta ¶
type Meta map[string]interface{}
Meta is used to represent a `meta` object. http://jsonapi.org/format/#document-meta
type Metable ¶
type Metable interface {
JSONAPIMeta() *Meta
}
Metable is used to include document meta in response data e.g. {"foo": "bar"}
type RelationshipLinkable ¶
type RelationshipLinkable interface { // JSONAPIRelationshipLinks will be invoked for each relationship with the corresponding relation name (e.g. `comments`) JSONAPIRelationshipLinks(relation string) *Links }
RelationshipLinkable is used to include relationship links in response data e.g. {"related": "http://example.com/posts/1/comments"}
type RelationshipMetable ¶
type RelationshipMetable interface { // JSONRelationshipMeta will be invoked for each relationship with the corresponding relation name (e.g. `comments`) JSONAPIRelationshipMeta(relation string) *Meta }
RelationshipMetable is used to include relationship meta in response data