runtime

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 2 Imported by: 3

Documentation

Overview

Package runtime defines some functions used to encode/decode object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientNegotiator

type ClientNegotiator interface {
	Encoder() (Encoder, error)
	Decoder() (Decoder, error)
}

ClientNegotiator handles turning an HTTP content type into the appropriate encoder. Use NewClientNegotiator or NewVersionedClientNegotiator to create this interface from a NegotiatedSerializer.

func NewSimpleClientNegotiator

func NewSimpleClientNegotiator() ClientNegotiator

NewSimpleClientNegotiator will negotiate for a single serializer. This should only be used for testing or when the caller is taking responsibility for setting the GVK on encoded objects.

type Decoder

type Decoder interface {
	Decode(data []byte, v interface{}) error
}

Decoder attempts to load an object from data.

type Encoder

type Encoder interface {
	// Encode writes an object to a stream. Implementations may return errors if the versions are
	// incompatible, or if no conversion is defined.
	Encode(v interface{}) ([]byte, error)
}

Encoder writes objects to a serialized form.

type NegotiateError

type NegotiateError struct {
	ContentType string
	Stream      bool
}

NegotiateError is returned when a ClientNegotiator is unable to locate a serializer for the requested operation.

func (NegotiateError) Error

func (e NegotiateError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL