util

package
v0.0.0-...-703a8e5 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2016 License: MPL-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalResponse

func MarshalResponse(r *http.Request, v interface{}) ([]byte, error)

MarshalResponse acts as a universal Marshaller trying to give the client of an http request what it wants by checking the accept and content-type headers before defaulting to JSON

func MarshalToMimeType

func MarshalToMimeType(v interface{}, mimeType string) ([]byte, error)

func ReadFromWebSocket

func ReadFromWebSocket(ws *websocket.Conn, processMsg func([]byte)) error

func Unmarshal

func Unmarshal(data []byte, dest interface{}) error

func UnmarshalRequest

func UnmarshalRequest(r *http.Request, dest interface{}) error

UnmarshalRequest determines the content type of the body of a request by first checking the content-type header and then falling back to scanning the body to unmarshal into dest

Types

type Marshaller

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

type Unmarshaller

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

Jump to

Keyboard shortcuts

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