Documentation ¶
Overview ¶
Copyright 2017 Applatix, Inc.
Index ¶
- func ErrorHandler(err error, w http.ResponseWriter) error
- func GenerateSelfSignedCert() (crt, key string)
- func IsUUIDv4(u string) bool
- func LogStack()
- func LogStats()
- func RegisterStackDumper()
- func StartStatsTicker(d time.Duration)
- func SuccessHandler(obj interface{}, w http.ResponseWriter)
- func TXErrorHandler(err error, tx interface{}, w http.ResponseWriter) (origerr error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(err error, w http.ResponseWriter) error
ErrorHandler is a helper log and write a json error bean to the response
func GenerateSelfSignedCert ¶
func GenerateSelfSignedCert() (crt, key string)
GenerateSelfSignedCert generates self signed certificate and the signing key
func RegisterStackDumper ¶
func RegisterStackDumper()
RegisterStackDumper will start a goroutine which waits to receive a SIGUSR1 signal and upon receival, dumps stack trace
func StartStatsTicker ¶
StartStatsTicker will start a goroutine which dumps stats at a specified interval
func SuccessHandler ¶
func SuccessHandler(obj interface{}, w http.ResponseWriter)
SuccessHandler is a helper to write an json response success APIs. If obj is nil, returns empty dictionary. If obj is an array or slice, encapsulates it into a json list in a "data" field (e.g. {"data" : []}) For all other cases (structs/maps), returns the object marshaled as json
func TXErrorHandler ¶
func TXErrorHandler(err error, tx interface{}, w http.ResponseWriter) (origerr error)
TXErrorHandler is a helper to rollback a transaction and write a json error to the response
Types ¶
This section is empty.