Versions in this module Expand all Collapse all v1 v1.0.0 Aug 25, 2026 Changes in this version + const AtomicExtensionURI + const CursorMaxSizeExceededTypeURI + const CursorPaginationProfileURI + const CursorRangeNotSupportedTypeURI + const CursorUnsupportedSortTypeURI + const DefaultMaxAcceptCandidates + const DefaultMaxArrayItems + const DefaultMaxDocumentBytes + const DefaultMaxNegotiationHeaderBytes + const DefaultMaxNegotiationURIBytes + const DefaultMaxNestingDepth + const DefaultMaxObjectMembers + const DefaultMaxParameterURIs + const DefaultMaxQueryListItems + const DefaultMaxQueryNameBytes + const DefaultMaxQueryParameters + const DefaultMaxQuerySelectors + const DefaultMaxQueryTotalBytes + const DefaultMaxQueryValueBytes + const DefaultMaxQueryValues + const DefaultMaxSupportedURIs + const DefaultMaxTotalValues + const MediaTypeJSONAPI + func Marshal(document Document) ([]byte, error) + func MarshalAtomic(document AtomicDocument) ([]byte, error) + func MarshalAtomicWith(document AtomicDocument, options AtomicValidationOptions) ([]byte, error) + func MarshalWith(document Document, options ValidationOptions) ([]byte, error) + func ParseCursorItemMeta(meta Meta) (string, bool, error) + func ParseCursorItemMetaAs(meta Meta, member string) (string, bool, error) + func ValidateCursorPaginationLinks(links Links) error + type AtomicDocument struct + Errors []ErrorObject + JSONAPI *JSONAPI + Links Links + Meta Meta + Operations []AtomicOperation + Results []AtomicResult + func ExecuteAtomic(ctx context.Context, beginner AtomicTransactionBeginner, ...) (AtomicDocument, error) + func UnmarshalAtomic(payload []byte) (AtomicDocument, error) + func UnmarshalAtomicWith(payload []byte, options AtomicValidationOptions) (AtomicDocument, error) + func UnmarshalAtomicWithLimits(payload []byte, options AtomicValidationOptions, limits DecodeLimits) (AtomicDocument, error) + func (document AtomicDocument) MarshalJSON() ([]byte, error) + func (document AtomicDocument) Validate() error + func (document AtomicDocument) ValidateWith(options AtomicValidationOptions) error + type AtomicExecutionError struct + Cause error + OperationIndex int + Phase string + RollbackCause error + func (err *AtomicExecutionError) Error() string + func (err *AtomicExecutionError) Unwrap() []error + type AtomicOperation struct + Data *PrimaryData + Href string + Meta Meta + Op AtomicOperationCode + Ref *AtomicReference + func (operation AtomicOperation) MarshalJSON() ([]byte, error) + func (operation AtomicOperation) WithHref(value string) AtomicOperation + type AtomicOperationCode string + const AtomicAdd + const AtomicRemove + const AtomicUpdate + type AtomicPanicError struct + Phase string + Value any + func (err *AtomicPanicError) Error() string + func (err *AtomicPanicError) Unwrap() error + type AtomicReference struct + ID string + LID string + Relationship string + Type string + func (reference AtomicReference) MarshalJSON() ([]byte, error) + func (reference AtomicReference) WithID(value string) AtomicReference + func (reference AtomicReference) WithLID(value string) AtomicReference + func (reference AtomicReference) WithRelationship(value string) AtomicReference + type AtomicResult struct + Data *PrimaryData + Meta Meta + func (result AtomicResult) MarshalJSON() ([]byte, error) + type AtomicTransaction interface + ApplyAtomic func(context.Context, AtomicOperation) (AtomicResult, error) + CommitAtomic func(context.Context) error + RollbackAtomic func(context.Context) error + type AtomicTransactionBeginner interface + BeginAtomic func(context.Context) (AtomicTransaction, error) + type AtomicValidationContext uint8 + const AtomicGenericContext + const AtomicRequestContext + const AtomicResponseContext + type AtomicValidationOptions struct + Context AtomicValidationContext + ExpectedOperations []AtomicOperation + ExpectedResultCount int + type Attributes map[string]any + type CallbackError struct + Cause error + PanicValue any + Phase string + func (err *CallbackError) CallbackPanicValue() (any, bool) + func (err *CallbackError) CallbackPhase() string + func (err *CallbackError) Error() string + func (err *CallbackError) Unwrap() error + type Codec struct + func NewCodec(options CodecOptions) (*Codec, error) + func (codec *Codec) Marshal(document Document) ([]byte, error) + func (codec *Codec) Unmarshal(payload []byte) (Document, error) + type CodecOptions struct + Extensions []ExtensionDefinition + Limits DecodeLimits + Profiles []ProfileDefinition + Validation ValidationOptions + type CursorEstimatedTotal struct + BestGuess *int64 + type CursorPage struct + HasMore bool + HasNext bool + HasPrevious bool + Items []Meta + Links Links + Meta Meta + Request CursorPageRequest + func (page CursorPage) Validate() error + func (page CursorPage) ValidateAt(path string) error + type CursorPageMeta struct + EstimatedTotal *CursorEstimatedTotal + RangeTruncated *bool + Total *int64 + func ParseCursorPageMeta(meta Meta) (CursorPageMeta, bool, error) + func ParseCursorPageMetaAs(meta Meta, member string) (CursorPageMeta, bool, error) + func (metadata CursorPageMeta) Meta() (Meta, error) + func (metadata CursorPageMeta) MetaAs(member string) (Meta, error) + type CursorPageRequest struct + After string + AfterPresent bool + Before string + BeforePresent bool + PageMember string + Range bool + Size int + SizePresent bool + type CursorPagination struct + func NewCursorPagination(config CursorPaginationConfig) (*CursorPagination, error) + func (pagination *CursorPagination) Parse(family ParameterFamily) (CursorPageRequest, error) + func (pagination *CursorPagination) ParseQuery(query Query) (CursorPageRequest, error) + type CursorPaginationConfig struct + AllowRange bool + DefaultSize int + MaxSize int + PageMember string + ValidateCursor func(string) error + ValidateSort func([]SortField) error + type CursorPaginationError struct + Cause error + Code string + MaxSize int + Message string + PageMember string + Parameter string + Status int + func (err *CursorPaginationError) Error() string + func (err *CursorPaginationError) ErrorObject(title, detail string) ErrorObject + func (err *CursorPaginationError) Unwrap() error + type DecodeError struct + Cause error + Code string + Message string + Path string + func (err *DecodeError) Error() string + func (err *DecodeError) Unwrap() error + type DecodeLimits struct + MaxArrayItems int + MaxDocumentBytes int + MaxNestingDepth int + MaxObjectMembers int + MaxTotalValues int + func DefaultDecodeLimits() DecodeLimits + type Document struct + AdditionalMembers Members + Data *PrimaryData + Errors []ErrorObject + Included []ResourceObject + JSONAPI *JSONAPI + Links Links + Meta Meta + func Unmarshal(payload []byte) (Document, error) + func UnmarshalWith(payload []byte, options ValidationOptions) (Document, error) + func UnmarshalWithLimits(payload []byte, options ValidationOptions, limits DecodeLimits) (Document, error) + func (document Document) MarshalJSON() ([]byte, error) + func (document Document) Validate() error + func (document Document) ValidateWith(options ValidationOptions) error + type ErrorObject struct + AdditionalMembers Members + Code string + Detail string + ID string + Links Links + Meta Meta + Source *ErrorSource + Status string + Title string + func (apiError ErrorObject) MarshalJSON() ([]byte, error) + func (apiError ErrorObject) WithCode(value string) ErrorObject + func (apiError ErrorObject) WithDetail(value string) ErrorObject + func (apiError ErrorObject) WithID(value string) ErrorObject + func (apiError ErrorObject) WithStatus(value string) ErrorObject + func (apiError ErrorObject) WithTitle(value string) ErrorObject + type ErrorSource struct + AdditionalMembers Members + Header string + Parameter string + Pointer string + func (source ErrorSource) MarshalJSON() ([]byte, error) + func (source ErrorSource) WithHeader(value string) ErrorSource + func (source ErrorSource) WithParameter(value string) ErrorSource + func (source ErrorSource) WithPointer(value string) ErrorSource + type ExtensionDefinition struct + Members []MemberDefinition + Namespace string + URI string + type Identifier struct + AdditionalMembers Members + ID string + LID string + Meta Meta + Type string + func (identifier Identifier) MarshalJSON() ([]byte, error) + func (identifier Identifier) WithID(value string) Identifier + func (identifier Identifier) WithLID(value string) Identifier + type JSONAPI struct + AdditionalMembers Members + Ext []string + Meta Meta + Profile []string + Version string + func (object JSONAPI) MarshalJSON() ([]byte, error) + func (object JSONAPI) WithVersion(value string) JSONAPI + type Link struct + func ExtensionLinkValue(value any) Link + func LinkFromObject(object LinkObject) Link + func NullLink() Link + func ObjectLink(href string, meta Meta) Link + func URI(href string) Link + func (link Link) ExtensionValue() (any, bool) + func (link Link) MarshalJSON() ([]byte, error) + func (link Link) WithRel(value string) Link + func (link Link) WithTitle(value string) Link + func (link Link) WithType(value string) Link + type LinkHreflang struct + func LanguageTag(tag string) *LinkHreflang + func LanguageTags(tags ...string) *LinkHreflang + type LinkObject struct + AdditionalMembers Members + DescribedBy *Link + Href string + Hreflang *LinkHreflang + Meta Meta + Rel string + Title string + Type string + type Links map[string]Link + type MediaType struct + Extensions []string + Profiles []string + func (mediaType MediaType) String() string + type MemberDefinition struct + Name string + Scope MemberScope + Validate func(any) error + type MemberScope uint8 + const ErrorMemberScope + const ErrorSourceMemberScope + const IdentifierMemberScope + const JSONAPIMemberScope + const LinkObjectMemberScope + const LinksObjectMemberScope + const RelationshipMemberScope + const ResourceMemberScope + const TopLevelMemberScope + type Members map[string]any + type Meta map[string]any + func CursorItemMeta(cursor string) Meta + func CursorItemMetaAs(member, cursor string) (Meta, error) + type NegotiatedMedia struct + ContentType string + MediaType MediaType + VaryAccept bool + type NegotiationError struct + Code string + Message string + Status int + func (err *NegotiationError) Error() string + type NegotiationLimits struct + MaxAcceptCandidates int + MaxHeaderBytes int + MaxParameterURIs int + MaxSupportedURIs int + MaxURIBytes int + func DefaultNegotiationLimits() NegotiationLimits + type Negotiator struct + func NewNegotiator(extensions, profiles []string) (*Negotiator, error) + func NewNegotiatorWithLimits(extensions, profiles []string, limits NegotiationLimits) (*Negotiator, error) + func (negotiator *Negotiator) CheckContentType(header string) (MediaType, error) + func (negotiator *Negotiator) NegotiateAccept(header string) (NegotiatedMedia, error) + type ParameterFamily map[string][]string + type PrimaryData struct + func NullData() *PrimaryData + func ResourceCollection(resources ...ResourceObject) *PrimaryData + func ResourceData(resource ResourceObject) *PrimaryData + func (data PrimaryData) MarshalJSON() ([]byte, error) + type ProfileDefinition struct + URI string + ValidateDocument func(Document) error + type Query struct + Custom map[string]ParameterFamily + Extensions map[string]ParameterFamily + Fields map[string][]string + Filter ParameterFamily + Include []string + IncludePresent bool + Page ParameterFamily + Sort []SortField + SortPresent bool + func ParseQuery(values url.Values) (Query, error) + func ParseQueryWithLimits(values url.Values, limits QueryLimits) (Query, error) + type QueryError struct + Code string + Message string + Parameter string + Status int + func (err *QueryError) Error() string + type QueryLimits struct + MaxListItems int + MaxNameBytes int + MaxParameters int + MaxSelectors int + MaxTotalBytes int + MaxValueBytes int + MaxValues int + func DefaultQueryLimits() QueryLimits + type QueryParser struct + func NewQueryParser(customFamilies, extensionNamespaces []string) (*QueryParser, error) + func NewQueryParserWithLimits(customFamilies, extensionNamespaces []string, limits QueryLimits) (*QueryParser, error) + func (parser *QueryParser) Parse(values url.Values) (Query, error) + type Relationship struct + AdditionalMembers Members + Data *RelationshipData + Links Links + Meta Meta + func (relationship Relationship) MarshalJSON() ([]byte, error) + type RelationshipData struct + func NullRelationship() *RelationshipData + func ToMany(identifiers ...Identifier) *RelationshipData + func ToOne(identifier Identifier) *RelationshipData + func (data RelationshipData) MarshalJSON() ([]byte, error) + type Relationships map[string]Relationship + type ResourceObject struct + AdditionalMembers Members + Attributes Attributes + ID string + LID string + Links Links + Meta Meta + Relationships Relationships + Type string + func (resource ResourceObject) MarshalJSON() ([]byte, error) + func (resource ResourceObject) WithID(value string) ResourceObject + func (resource ResourceObject) WithLID(value string) ResourceObject + type SortField struct + Descending bool + Name string + type ValidationContext uint8 + const CreateRequest + const GenericDocument + const Response + const ToManyRelationshipRequest + const ToOneRelationshipRequest + const UpdateRequest + type ValidationError struct + Violations []Violation + func (err *ValidationError) Error() string + func (err *ValidationError) Unwrap() []error + type ValidationOptions struct + Context ValidationContext + ExpectedID string + ExpectedIDPresent bool + ExpectedType string + SparseFieldsetsOmittedLinkage bool + type Violation struct + Code string + Message string + Path string