response

package
v0.0.0-...-15fa731 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferPool = util.NewBufferPool() // used by pickle, fastjson and msgp responses to serialize into
View Source
var ErrMetricNotFound = errors.New("metric not found")
View Source
var RequestCanceledErr = NewError(499, "request canceled")

Functions

func Write

func Write(w http.ResponseWriter, resp Response)

Types

type Error

type Error interface {
	Code() int
	Error() string
}

type ErrorResp

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

func NewError

func NewError(code int, err string) *ErrorResp

func WrapError

func WrapError(e error) *ErrorResp

func WrapErrorForTagDB

func WrapErrorForTagDB(e error) *ErrorResp

graphite's http tagdb client requires a specific error format

func (*ErrorResp) Body

func (r *ErrorResp) Body() ([]byte, error)

func (*ErrorResp) Close

func (r *ErrorResp) Close()

func (*ErrorResp) Code

func (r *ErrorResp) Code() int

func (*ErrorResp) Error

func (r *ErrorResp) Error() string

func (*ErrorResp) Headers

func (r *ErrorResp) Headers() (headers map[string]string)

func (*ErrorResp) ValidateAndFixCode

func (r *ErrorResp) ValidateAndFixCode()

type FastJSON

type FastJSON interface {
	MarshalJSONFast([]byte) ([]byte, error)
}

type FastJson

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

func NewFastJson

func NewFastJson(code int, body FastJSON) *FastJson

func (*FastJson) Body

func (r *FastJson) Body() ([]byte, error)

func (*FastJson) Close

func (r *FastJson) Close()

func (*FastJson) Code

func (r *FastJson) Code() int

func (*FastJson) Headers

func (r *FastJson) Headers() (headers map[string]string)

type Json

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

func NewJson

func NewJson(code int, body interface{}, jsonp string) *Json

func (*Json) Body

func (r *Json) Body() (buf []byte, err error)

func (*Json) Close

func (r *Json) Close()

func (*Json) Code

func (r *Json) Code() int

func (*Json) Headers

func (r *Json) Headers() (headers map[string]string)

type Msgp

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

func NewMsgp

func NewMsgp(code int, body msgp.Marshaler) *Msgp

func (*Msgp) Body

func (r *Msgp) Body() ([]byte, error)

func (*Msgp) Close

func (r *Msgp) Close()

func (*Msgp) Code

func (r *Msgp) Code() int

func (*Msgp) Headers

func (r *Msgp) Headers() (headers map[string]string)

type MsgpArray

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

func NewMsgpArray

func NewMsgpArray(code int, body []msgp.Marshaler) *MsgpArray

func (*MsgpArray) Body

func (r *MsgpArray) Body() ([]byte, error)

func (*MsgpArray) Close

func (r *MsgpArray) Close()

func (*MsgpArray) Code

func (r *MsgpArray) Code() int

func (*MsgpArray) Headers

func (r *MsgpArray) Headers() (headers map[string]string)

type Msgpack

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

func NewMsgpack

func NewMsgpack(code int, body msgp.Marshaler) *Msgpack

func (*Msgpack) Body

func (r *Msgpack) Body() ([]byte, error)

func (*Msgpack) Close

func (r *Msgpack) Close()

func (*Msgpack) Code

func (r *Msgpack) Code() int

func (*Msgpack) Headers

func (r *Msgpack) Headers() (headers map[string]string)

type Picklable

type Picklable interface {
	Pickle([]byte) ([]byte, error)
}

type Pickle

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

func NewPickle

func NewPickle(code int, body Picklable) *Pickle

func (*Pickle) Body

func (r *Pickle) Body() ([]byte, error)

func (*Pickle) Close

func (r *Pickle) Close()

func (*Pickle) Code

func (r *Pickle) Code() int

func (*Pickle) Headers

func (r *Pickle) Headers() (headers map[string]string)

type Response

type Response interface {
	Code() int
	Body() ([]byte, error)
	Headers() map[string]string
	Close()
}

type TagDBError

type TagDBError struct {
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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