Documentation ¶
Index ¶
- func GetQuote(r *http.Request, enc Encoder, parms martini.Params) (int, string)
- func GetTest(r *http.Request, parms martini.Params) (int, string)
- func Must(data string, err error) string
- func SetQuoteSources(sources map[string]models.QuoteSource)
- type Encoder
- type JsonEncoder
- type TextEncoder
- type XmlEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Must ¶
Because `panic`s are caught by martini's Recovery handler, it can be used to return server-side errors (500). Some helpful text message should probably be sent, although not the technical error (which is printed in the log).
func SetQuoteSources ¶
func SetQuoteSources(sources map[string]models.QuoteSource)
Types ¶
type Encoder ¶
type Encoder interface { EncodeOne(v interface{}) (string, error) Encode(v ...interface{}) (string, error) }
An Encoder implements an encoding format of values to be sent as response to requests on the API endpoints.
type JsonEncoder ¶
type JsonEncoder struct{}
func (JsonEncoder) Encode ¶
func (_ JsonEncoder) Encode(v ...interface{}) (string, error)
func (JsonEncoder) EncodeOne ¶
func (_ JsonEncoder) EncodeOne(v interface{}) (string, error)
JsonEncoder is an Encoder that produces JSON-formatted responses.
type TextEncoder ¶
type TextEncoder struct{}
func (TextEncoder) Encode ¶
func (_ TextEncoder) Encode(v ...interface{}) (string, error)
func (TextEncoder) EncodeOne ¶
func (e TextEncoder) EncodeOne(v ...interface{}) (string, error)
TextEncoder is an Encoder that produces plain text-formatted responses.
type XmlEncoder ¶
type XmlEncoder struct{}
func (XmlEncoder) Encode ¶
func (_ XmlEncoder) Encode(v ...interface{}) (string, error)
func (XmlEncoder) EncodeOne ¶
func (e XmlEncoder) EncodeOne(v interface{}) (string, error)
XmlEncoder is an Encoder that produces XML-formatted responses.
Click to show internal directories.
Click to hide internal directories.