Documentation ¶
Index ¶
- Constants
- func IsEmptyRecord[T any](t T) bool
- func MarshalBatchEntities[K comparable, V any](entities map[K]V, writer restlicodec.Writer) (err error)
- func UnmarshalBatchEntities[K comparable, V restlicodec.Marshaler](entities map[K]V, reader restlicodec.Reader) (err error)
- type BatchEntityUpdateResponse
- type BatchResponse
- func (b *BatchResponse[K, V]) AddError(key K, value *ErrorResponse)
- func (b *BatchResponse[K, V]) AddResult(key K, value V)
- func (b *BatchResponse[K, V]) AddStatus(key K, value int)
- func (b *BatchResponse[K, V]) MarshalRestLi(writer restlicodec.Writer) error
- func (b *BatchResponse[K, V]) UnmarshalRestLi(reader restlicodec.Reader) error
- func (b *BatchResponse[K, V]) UnmarshalWithKeyLocator(reader restlicodec.Reader, keys KeyLocator[K]) error
- type CollectionMedata
- func (c *CollectionMedata) ComputeHash() fnv1a.Hash
- func (c *CollectionMedata) Equals(other *CollectionMedata) bool
- func (c *CollectionMedata) MarshalJSON() (data []byte, err error)
- func (c *CollectionMedata) MarshalRestLi(writer restlicodec.Writer) (err error)
- func (c *CollectionMedata) NewInstance() *CollectionMedata
- func (c *CollectionMedata) UnmarshalJSON(data []byte) error
- func (c *CollectionMedata) UnmarshalRestLi(reader restlicodec.Reader) (err error)
- type CreatedAndReturnedEntity
- type CreatedEntity
- type Elements
- type ElementsWithMetadata
- type EmptyRecord
- type ErrorResponse
- func (e *ErrorResponse) ComputeHash() fnv1a.Hash
- func (e *ErrorResponse) Equals(other *ErrorResponse) bool
- func (e *ErrorResponse) Error() string
- func (e *ErrorResponse) Format(s fmt.State, verb rune)
- func (e *ErrorResponse) MarshalJSON() (data []byte, err error)
- func (e *ErrorResponse) MarshalRestLi(writer restlicodec.Writer) (err error)
- func (e *ErrorResponse) NewInstance() *ErrorResponse
- func (e *ErrorResponse) UnmarshalJSON(data []byte) error
- func (e *ErrorResponse) UnmarshalRestLi(reader restlicodec.Reader) (err error)
- type KeyLocator
- type Link
- func (l *Link) ComputeHash() fnv1a.Hash
- func (l *Link) Equals(other *Link) bool
- func (l *Link) MarshalJSON() (data []byte, err error)
- func (l *Link) MarshalRestLi(writer restlicodec.Writer) (err error)
- func (l *Link) NewInstance() *Link
- func (l *Link) UnmarshalJSON(data []byte) error
- func (l *Link) UnmarshalRestLi(reader restlicodec.Reader) (err error)
- type PagingContext
- type RawRecord
- func (r RawRecord) ComputeHash() fnv1a.Hash
- func (r RawRecord) Equals(other RawRecord) bool
- func (r RawRecord) MarshalRestLi(writer restlicodec.Writer) error
- func (r RawRecord) NewInstance() RawRecord
- func (r *RawRecord) UnmarshalRestLi(reader restlicodec.Reader) error
- func (r *RawRecord) UnmarshalTo(obj restlicodec.Unmarshaler) error
Constants ¶
const ( ElementsField = "elements" ValueField = "value" StatusField = "status" StatusesField = "statuses" ResultsField = "results" ErrorField = "error" ErrorsField = "errors" IdField = "id" LocationField = "location" PagingField = "paging" MetadataField = "metadata" EntityField = "entity" EntitiesField = "entities" )
Variables ¶
This section is empty.
Functions ¶
func IsEmptyRecord ¶
func MarshalBatchEntities ¶
func MarshalBatchEntities[K comparable, V any](entities map[K]V, writer restlicodec.Writer) (err error)
func UnmarshalBatchEntities ¶
func UnmarshalBatchEntities[K comparable, V restlicodec.Marshaler](entities map[K]V, reader restlicodec.Reader) (err error)
Types ¶
type BatchEntityUpdateResponse ¶
type BatchEntityUpdateResponse struct {
Status int
}
func (*BatchEntityUpdateResponse) MarshalRestLi ¶
func (b *BatchEntityUpdateResponse) MarshalRestLi(writer restlicodec.Writer) error
func (*BatchEntityUpdateResponse) NewInstance ¶
func (b *BatchEntityUpdateResponse) NewInstance() *BatchEntityUpdateResponse
func (*BatchEntityUpdateResponse) UnmarshalRestLi ¶
func (b *BatchEntityUpdateResponse) UnmarshalRestLi(reader restlicodec.Reader) error
type BatchResponse ¶
type BatchResponse[K comparable, V restlicodec.Marshaler] struct { Statuses map[K]int Results map[K]V Errors map[K]*ErrorResponse }
func (*BatchResponse[K, V]) AddError ¶
func (b *BatchResponse[K, V]) AddError(key K, value *ErrorResponse)
func (*BatchResponse[K, V]) AddResult ¶
func (b *BatchResponse[K, V]) AddResult(key K, value V)
func (*BatchResponse[K, V]) AddStatus ¶
func (b *BatchResponse[K, V]) AddStatus(key K, value int)
func (*BatchResponse[K, V]) MarshalRestLi ¶
func (b *BatchResponse[K, V]) MarshalRestLi(writer restlicodec.Writer) error
func (*BatchResponse[K, V]) UnmarshalRestLi ¶
func (b *BatchResponse[K, V]) UnmarshalRestLi(reader restlicodec.Reader) error
func (*BatchResponse[K, V]) UnmarshalWithKeyLocator ¶
func (b *BatchResponse[K, V]) UnmarshalWithKeyLocator(reader restlicodec.Reader, keys KeyLocator[K]) error
type CollectionMedata ¶
type CollectionMedata struct { // The start index of this collection Start int32 // The number of elements in this collection segment Count int32 // The total number of elements in the entire collection (not just this segment) Total *int32 Links []*Link }
func NewCollectionMedataWithDefaultValues ¶
func NewCollectionMedataWithDefaultValues() (c *CollectionMedata)
func (*CollectionMedata) ComputeHash ¶
func (c *CollectionMedata) ComputeHash() fnv1a.Hash
func (*CollectionMedata) Equals ¶
func (c *CollectionMedata) Equals(other *CollectionMedata) bool
func (*CollectionMedata) MarshalJSON ¶
func (c *CollectionMedata) MarshalJSON() (data []byte, err error)
func (*CollectionMedata) MarshalRestLi ¶
func (c *CollectionMedata) MarshalRestLi(writer restlicodec.Writer) (err error)
func (*CollectionMedata) NewInstance ¶
func (c *CollectionMedata) NewInstance() *CollectionMedata
func (*CollectionMedata) UnmarshalJSON ¶
func (c *CollectionMedata) UnmarshalJSON(data []byte) error
func (*CollectionMedata) UnmarshalRestLi ¶
func (c *CollectionMedata) UnmarshalRestLi(reader restlicodec.Reader) (err error)
type CreatedAndReturnedEntity ¶
type CreatedAndReturnedEntity[K any, V restlicodec.Marshaler] struct { CreatedEntity[K] Entity V }
func (*CreatedAndReturnedEntity[K, V]) MarshalRestLi ¶
func (c *CreatedAndReturnedEntity[K, V]) MarshalRestLi(writer restlicodec.Writer) error
func (*CreatedAndReturnedEntity[K, V]) NewInstance ¶
func (c *CreatedAndReturnedEntity[K, V]) NewInstance() *CreatedAndReturnedEntity[K, V]
func (*CreatedAndReturnedEntity[K, V]) UnmarshalRestLi ¶
func (c *CreatedAndReturnedEntity[K, V]) UnmarshalRestLi(reader restlicodec.Reader) error
type CreatedEntity ¶
func (*CreatedEntity[K]) MarshalRestLi ¶
func (c *CreatedEntity[K]) MarshalRestLi(writer restlicodec.Writer) error
func (*CreatedEntity[K]) NewInstance ¶
func (c *CreatedEntity[K]) NewInstance() *CreatedEntity[K]
func (*CreatedEntity[K]) UnmarshalRestLi ¶
func (c *CreatedEntity[K]) UnmarshalRestLi(reader restlicodec.Reader) error
type Elements ¶
type Elements[V restlicodec.Marshaler] struct { Elements []V Paging *CollectionMedata }
func (*Elements[V]) MarshalRestLi ¶
func (f *Elements[V]) MarshalRestLi(writer restlicodec.Writer) error
func (*Elements[V]) NewInstance ¶
func (*Elements[V]) UnmarshalRestLi ¶
func (f *Elements[V]) UnmarshalRestLi(reader restlicodec.Reader) error
type ElementsWithMetadata ¶
type ElementsWithMetadata[V, M restlicodec.Marshaler] struct { Elements []V Paging *CollectionMedata Metadata M }
func (*ElementsWithMetadata[V, M]) MarshalRestLi ¶
func (f *ElementsWithMetadata[V, M]) MarshalRestLi(writer restlicodec.Writer) (err error)
func (*ElementsWithMetadata[V, M]) NewInstance ¶
func (f *ElementsWithMetadata[V, M]) NewInstance() *ElementsWithMetadata[V, M]
func (*ElementsWithMetadata[V, M]) UnmarshalRestLi ¶
func (f *ElementsWithMetadata[V, M]) UnmarshalRestLi(reader restlicodec.Reader) error
type EmptyRecord ¶
type EmptyRecord struct{}
func (EmptyRecord) DecodeQueryParams ¶
func (e EmptyRecord) DecodeQueryParams(restlicodec.QueryParamsReader) error
func (EmptyRecord) MarshalRestLi ¶
func (e EmptyRecord) MarshalRestLi(writer restlicodec.Writer) error
func (EmptyRecord) NewInstance ¶
func (e EmptyRecord) NewInstance() EmptyRecord
func (EmptyRecord) UnmarshalRestLi ¶
func (e EmptyRecord) UnmarshalRestLi(reader restlicodec.Reader) error
type ErrorResponse ¶
type ErrorResponse struct { // The HTTP status code. Status *int32 // A human-readable explanation of the error. Message *string // The FQCN of the exception thrown by the server. ExceptionClass *string // The full stack trace of the exception thrown by the server. StackTrace *string }
func (*ErrorResponse) ComputeHash ¶
func (e *ErrorResponse) ComputeHash() fnv1a.Hash
func (*ErrorResponse) Equals ¶
func (e *ErrorResponse) Equals(other *ErrorResponse) bool
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
func (*ErrorResponse) MarshalJSON ¶
func (e *ErrorResponse) MarshalJSON() (data []byte, err error)
func (*ErrorResponse) MarshalRestLi ¶
func (e *ErrorResponse) MarshalRestLi(writer restlicodec.Writer) (err error)
func (*ErrorResponse) NewInstance ¶
func (e *ErrorResponse) NewInstance() *ErrorResponse
func (*ErrorResponse) UnmarshalJSON ¶
func (e *ErrorResponse) UnmarshalJSON(data []byte) error
func (*ErrorResponse) UnmarshalRestLi ¶
func (e *ErrorResponse) UnmarshalRestLi(reader restlicodec.Reader) (err error)
type KeyLocator ¶
type KeyLocator[T any] interface { LocateOriginalKeyFromReader(keyReader restlicodec.Reader) (originalKey T, err error) }
type Link ¶
type Link struct { // The link relation e.g. 'self' or 'next' Rel string // The link URI Href string // The type (media type) of the resource Type string }
func (*Link) ComputeHash ¶
func (*Link) MarshalJSON ¶
func (*Link) MarshalRestLi ¶
func (l *Link) MarshalRestLi(writer restlicodec.Writer) (err error)
func (*Link) NewInstance ¶
func (*Link) UnmarshalJSON ¶
func (*Link) UnmarshalRestLi ¶
func (l *Link) UnmarshalRestLi(reader restlicodec.Reader) (err error)
type PagingContext ¶
func NewPagingContext ¶
func NewPagingContext(start, count int32) PagingContext
func (*PagingContext) ComputeHash ¶
func (p *PagingContext) ComputeHash() fnv1a.Hash
func (*PagingContext) EncodeQueryParams ¶
func (p *PagingContext) EncodeQueryParams() (rawQuery string, err error)
func (*PagingContext) Equals ¶
func (p *PagingContext) Equals(other *PagingContext) bool
type RawRecord ¶
type RawRecord map[string]interface{}
RawRecord is a container for arbitrary data. Because it gets parsed from raw JSON without any extra type information, it is expected that there will be unknown side effects, such as floats turning into integers or vice versa. This is designed to fill the gap for Java's DataMap-backed implementation of rest.li that supports untyped messages. To attempt deserialization into a know/real rest.li object, use the UnmarshalTo method Use at your own risk!
func (RawRecord) ComputeHash ¶
ComputeHash for a RawRecord always returns the 0-hash
func (RawRecord) Equals ¶
Equals for a RawRecord always returns false, unless it is being compared with itself
func (RawRecord) MarshalRestLi ¶
func (r RawRecord) MarshalRestLi(writer restlicodec.Writer) error
func (RawRecord) NewInstance ¶
func (*RawRecord) UnmarshalRestLi ¶
func (r *RawRecord) UnmarshalRestLi(reader restlicodec.Reader) error
func (*RawRecord) UnmarshalTo ¶
func (r *RawRecord) UnmarshalTo(obj restlicodec.Unmarshaler) error
UnmarshalTo attempts to deserialize this RawRecord into the given object by serializing it first to JSON then calling the given object's unmarshal method