responder

package
v0.0.0-...-fe78ce7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStreamer

func IsStreamer(r Responder) bool

func Register

func Register(r Responder, p float32)

Types

type EncoderFunc

type EncoderFunc func(interface{}) ([]byte, error)

type Matcher

type Matcher interface {
	Match(string) bool
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func (*Registry) GetByMatch

func (r *Registry) GetByMatch(m Matcher) Responder

func (*Registry) GetByMediaType

func (r *Registry) GetByMediaType(t *nswebmime.MediaType) Responder

func (*Registry) GetByType

func (r *Registry) GetByType(t string) Responder

func (*Registry) Register

func (r *Registry) Register(res Responder, priority float32)

type Responder

type Responder interface {
	MediaType() *nswebmime.MediaType
	Encode(interface{}) ([]byte, error)
}

func GetByMatch

func GetByMatch(m Matcher) Responder

func GetByMediaType

func GetByMediaType(t *nswebmime.MediaType) Responder

func GetByType

func GetByType(t string) Responder

func JSON

func JSON() Responder

func NewResponder

func NewResponder(mt *nswebmime.MediaType, enc EncoderFunc) Responder

func Protobuf

func Protobuf() Responder

type Streamer

type Streamer interface {
	Stream(interface{}) (io.Reader, error)
}

func AsStreamer

func AsStreamer(r Responder) (Streamer, bool)

Jump to

Keyboard shortcuts

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