service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPHeaderTraceRequest = "X-Tidepool-Trace-Request"
	HTTPHeaderTraceSession = "X-Tidepool-Trace-Session"
)

Variables

This section is empty.

Functions

func CopyRequestTrace

func CopyRequestTrace(sourceRequest *rest.Request, destinationRequest *http.Request) error

func GetRequestLogger

func GetRequestLogger(request *rest.Request) log.Logger

func GetRequestTraceRequest

func GetRequestTraceRequest(request *rest.Request) string

func GetRequestTraceSession

func GetRequestTraceSession(request *rest.Request) string

func SetRequestErrors

func SetRequestErrors(request *rest.Request, errors []*Error)

func SetRequestLogger

func SetRequestLogger(request *rest.Request, logger log.Logger)

func SetRequestTraceRequest

func SetRequestTraceRequest(request *rest.Request, traceRequest string)

func SetRequestTraceSession

func SetRequestTraceSession(request *rest.Request, traceSession string)

Types

type Context

type Context interface {
	Logger() log.Logger

	Request() *rest.Request
	Response() rest.ResponseWriter

	RespondWithError(err *Error)
	RespondWithInternalServerFailure(message string, failure ...interface{})
	RespondWithStatusAndErrors(statusCode int, errors []*Error)
	RespondWithStatusAndData(statusCode int, data interface{})
}

type Error

type Error struct {
	Code   string      `json:"code,omitempty"`
	Title  string      `json:"title,omitempty"`
	Detail string      `json:"detail,omitempty"`
	Status int         `json:"status,string,omitempty"`
	Source *Source     `json:"source,omitempty"`
	Meta   interface{} `json:"meta,omitempty"`
}

func ErrorInternalServerFailure

func ErrorInternalServerFailure() *Error

func GetRequestErrors

func GetRequestErrors(request *rest.Request) []*Error

func (*Error) WithMeta

func (e *Error) WithMeta(meta interface{}) *Error

func (*Error) WithSourceParameter

func (e *Error) WithSourceParameter(parameter string) *Error

func (*Error) WithSourcePointer

func (e *Error) WithSourcePointer(pointer string) *Error

type Source

type Source struct {
	Parameter string `json:"parameter,omitempty"`
	Pointer   string `json:"pointer,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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