Categorygithub.com/Meshcapade/jsonapi
modulepackage
1.1.2
Repository: https://github.com/meshcapade/jsonapi.git
Documentation: pkg.go.dev

# README

Just a fork with a fix, since the google team seems to have dropped support

Installation

go get -u github.com/Meshcapade/jsonapi

# Packages

No description provided by the author

# Functions

Marshal does the same as MarshalPayload except it just returns the payload and doesn't write out results.
MarshalErrors writes a JSON API response using the given `[]error`.
MarshalOnePayloadEmbedded - This method not meant to for use in implementation code, although feel free.
MarshalPayload writes a jsonapi response for one or many records.
MarshalPayloadWithoutIncluded writes a jsonapi response with one or many records, without the related records sideloaded into "included" array.
NewRuntime creates a Runtime for use in an application.
UnmarshalManyPayload converts an io into a set of struct instances using jsonapi tags on the type's struct fields.
UnmarshalPayload converts an io into a struct instance using jsonapi tags on struct fields.

# Constants

KeyFirstPage is the key to the links object whose value contains a link to the first page of data.
KeyLastPage is the key to the links object whose value contains a link to the last page of data.
KeyNextPage is the key to the links object whose value contains a link to the next page of data.
KeyPreviousPage is the key to the links object whose value contains a link to the previous page of data.
MarshalStart is the Event that is sent sent when serialization of a payload begins.
MarshalStop is the Event that is sent sent when serialization of a payload ends.
MediaType is the identifier for the JSON API media type see http://jsonapi.org/format/#document-structure.
QueryParamPageCursor is a JSON API query parameter used with a cursor-based strategy.
QueryParamPageLimit is a JSON API query parameter used in an offset based pagination strategy in conjunction with QueryParamPageOffset.
QueryParamPageNumber is a JSON API query parameter used in a page based pagination strategy in conjunction with QueryParamPageSize.
QueryParamPageOffset is a JSON API query parameter used in an offset based pagination strategy in conjunction with QueryParamPageLimit.
QueryParamPageSize is a JSON API query parameter used in a page based pagination strategy in conjunction with QueryParamPageNumber.
UnmarshalStart is the Event that is sent when deserialization of a payload begins.
UnmarshalStop is the Event that is sent when deserialization of a payload ends.

# Variables

ErrBadJSONAPIID is returned when the Struct JSON API annotated "id" field was not a valid numeric type.
ErrBadJSONAPIStructTag is returned when the Struct field's JSON API annotation is invalid.
ErrExpectedSlice is returned when a variable or argument was expected to be a slice of *Structs; MarshalMany will return this error when its interface{} argument is invalid.
ErrInvalidISO8601 is returned when a struct has a time.Time type field and includes "iso8601" in the tag spec, but the JSON value was not an ISO8601 timestamp string.
ErrInvalidRFC3339 is returned when a struct has a time.Time type field and includes "rfc3339" in the tag spec, but the JSON value was not an RFC3339 timestamp string.
ErrInvalidTime is returned when a struct has a time.Time type field, but the JSON value was not a unix timestamp integer.
I wish we used punctuation.
ErrUnexpectedType is returned when marshalling an interface; the interface had to be a pointer or a slice; otherwise this error is returned.
ErrUnknownFieldNumberType is returned when the JSON value was a float (numeric) but the Struct field was a non numeric type (i.e.
Instrumentation is a a global Events variable.

# Structs

ErrorObject is an `Error` implementation as well as an implementation of the JSON API error object.
ErrorsPayload is a serializer struct for representing a valid JSON API errors payload.
ErrUnsupportedPtrType is returned when the Struct field was a pointer but the JSON value was of a different type.
Link is used to represent a member of the `links` object.
ManyPayload is used to represent a generic JSON API payload where many resources (Nodes) were included in an [] in the "data" key.
Node is used to represent a generic JSON API Resource.
OnePayload is used to represent a generic JSON API payload where a single resource (Node) was included as an {} in the "data" key.
RelationshipManyNode is used to represent a generic has many JSON API relation.
RelationshipOneNode is used to represent a generic has one JSON API relation.
Runtime has the same methods as jsonapi package for serialization and deserialization but also has a ctx, a map[string]interface{} for storing state, designed for instrumenting serialization timings.

# Interfaces

Linkable is used to include document links in response data e.g.
Metable is used to include document meta in response data e.g.
Payloader is used to encapsulate the One and Many payload types.
RelationshipLinkable is used to include relationship links in response data e.g.
RelationshipMetable is used to include relationship meta in response data.

# Type aliases

Event represents a lifecycle event in the marshaling or unmarshalling process.
Events is the func type that provides the callback for handling event timings.
Links is used to represent a `links` object.
Meta is used to represent a `meta` object.