Documentation
¶
Index ¶
- type CreateSummary
- type Identifier
- type Meta
- type Method
- type Normalizer
- type NullIdentifier
- type Request
- type Resource
- type SaveMethod
- type SaveRequest
- type SaveSummary
- type SelectMethod
- type SelectRequest
- func (req SelectRequest[R]) Do(ctx context.Context, extraParams ...jsonrpc.Param) (*R, error)
- func (req SelectRequest[R]) Filter(f query.FilterType) SelectRequest[R]
- func (req SelectRequest[R]) Include(relationships ...string) SelectRequest[R]
- func (req SelectRequest[R]) Limit(n int) SelectRequest[R]
- func (req SelectRequest[R]) Skip(n int) SelectRequest[R]
- func (req SelectRequest[R]) Sort(fields ...string) SelectRequest[R]
- type Selection
- type SelectionMeta
- type ToMany
- type ToOne
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSummary ¶
CreateSummary holds the identity of a resource, and describes weather it was created due to your operation.
type Identifier ¶
Identifier uniquely identifies a resource entry.
type Meta ¶
type Meta struct {
Annotations fields.Annotations `json:"annotations,omitempty"`
AttributesHash fields.Hexadecimal `json:"attributesHash,omitempty"`
RelationshipsHash fields.Hexadecimal `json:"relationshipsHash,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Meta holds the meta data fields for a resource entry select view.
type Normalizer ¶
type Normalizer interface {
Normalize()
}
Normalizer describes a type that should be normalized before encoding.
type NullIdentifier ¶
type NullIdentifier Identifier
NullIdentifier is a version of Identifier where the zero-value is encoded as null in JSON.
func (NullIdentifier) MarshalJSON ¶
func (id NullIdentifier) MarshalJSON() ([]byte, error)
func (*NullIdentifier) UnmarshalJSON ¶
func (id *NullIdentifier) UnmarshalJSON(data []byte) error
type Request ¶
type Request[R any] struct { // contains filtered or unexported fields }
Request allows creating or updating properties based on a keyed relation.
type Resource ¶
type Resource[A, R any] struct { Identifier Meta Meta `json:"meta"` Attributes A `json:"attributes"` Relationships R `json:"relationships"` }
Resource describes a generic resource entry select view.
func (Resource[A, R]) MarshalJSON ¶
type SaveMethod ¶
SaveMethod is a constructor for Requests against a given RPC method.
func (SaveMethod[D, R]) NewRequest ¶
func (cfg SaveMethod[D, R]) NewRequest(h jsonrpc.Handler, data D, params ...jsonrpc.Param) SaveRequest[D, R]
type SaveRequest ¶
type SaveRequest[D, R any] struct { // contains filtered or unexported fields }
SaveRequest allows creating or updating properties based on a keyed relation.
func (SaveRequest[D, R]) CreateOnly ¶
func (req SaveRequest[D, R]) CreateOnly() SaveRequest[D, R]
CreateOnly returns a request with the createOnly property set to true. When set to true, existing resources are not updated.
type SaveSummary ¶
type SaveSummary struct {
ID string `json:"id"`
Created bool `json:"created"`
Updated bool `json:"updated"`
}
SaveSummary holds the identity of a resource, and describes weather it was updated or created due to your operation.
type SelectMethod ¶
func (SelectMethod[R]) NewRequest ¶
func (cfg SelectMethod[R]) NewRequest(h jsonrpc.Handler, params ...jsonrpc.Param) SelectRequest[R]
type SelectRequest ¶
type SelectRequest[R any] struct { // contains filtered or unexported fields }
func (SelectRequest[R]) Filter ¶
func (req SelectRequest[R]) Filter(f query.FilterType) SelectRequest[R]
Filter returns a new request with the specified filter added to existing filters with logical AND.
func (SelectRequest[R]) Include ¶
func (req SelectRequest[R]) Include(relationships ...string) SelectRequest[R]
Include returns a new request that includes the specified related resources. the provided list is appended to any existing include properties.
func (SelectRequest[R]) Limit ¶
func (req SelectRequest[R]) Limit(n int) SelectRequest[R]
Limit returns a new request that limits the number of matches. Setting n < 0 will use the default limit.
func (SelectRequest[R]) Skip ¶
func (req SelectRequest[R]) Skip(n int) SelectRequest[R]
Skip returns a new request that skips the first n matches.
func (SelectRequest[R]) Sort ¶
func (req SelectRequest[R]) Sort(fields ...string) SelectRequest[R]
Sort returns a new request that sorts according to the specified fields. A minus (-) prefix can be used on the filed name to indicate inverse ordering.
type Selection ¶
type Selection[E, I any] struct { Meta SelectionMeta `json:"meta"` Data []E `json:"data"` Included I `json:"included"` }
Selection holds resource selection results.
type SelectionMeta ¶
type SelectionMeta struct {
Total int `json:"total"`
GroupIncludedByType bool `json:"groupIncludedByType"`
}
SelectionMeta contains top-level meta information about a resource selection.
type ToMany ¶
type ToMany struct {
Meta map[string]json.RawMessage `json:"meta,omitempty"`
Data []Identifier `json:"data"`
}
ToMany describes a to many relationship entry.
type ToOne ¶
type ToOne struct {
Meta map[string]json.RawMessage `json:"meta,omitempty"`
Data NullIdentifier `json:"data"`
}
ToOne describes a to one relationship entry.