utils

package module
v0.0.0-...-b93265b Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2016 License: MIT Imports: 5 Imported by: 0

README

Utils by Ali Hamidi

Some useful snippets

  • jsonResponse - Responds with JSON
  • envelope/unvelope - Easily nest and unpack JSON
  • enableProfiling - Add pprof endpoints to a router (e.g. when using Negroni)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableProfiling

func EnableProfiling(r *mux.Router)

func Envelope

func Envelope(d interface{}, envelope string) map[string]interface{}

Nests map (for adding envelope)

func JSONResponse

func JSONResponse(w http.ResponseWriter, status int, data interface{}, err error)

JSON response convenience function

func Unvelope

func Unvelope(d []byte, envelope string) ([]byte, error)

Unpacks map (opposite process of envelope)

Types

This section is empty.

Jump to

Keyboard shortcuts

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