response

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS status = iota
	FAILURE
)

Variables

This section is empty.

Functions

func BadRequest added in v0.0.2

func BadRequest(w http.ResponseWriter, message string, loggers chaoslogger.Loggers)

func InternalServerError added in v0.0.2

func InternalServerError(w http.ResponseWriter, message string, loggers chaoslogger.Loggers)

func OkResponse added in v0.0.2

func OkResponse(w http.ResponseWriter, message string, loggers chaoslogger.Loggers)

func RecoverResponse added in v0.0.2

func RecoverResponse(w http.ResponseWriter, messages []*RecoverMessage, loggers chaoslogger.Loggers)

Types

type Payload

type Payload struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
}

func (*Payload) SetInWriter

func (p *Payload) SetInWriter(w http.ResponseWriter, loggers chaoslogger.Loggers)

type RecoverMessage

type RecoverMessage struct {
	Message string `json:"message"`
	Error   string `json:"error"`
	Status  string `json:"status"`
}

func FailureRecoverResponse

func FailureRecoverResponse(message string) *RecoverMessage

func SuccessRecoverResponse

func SuccessRecoverResponse(message string) *RecoverMessage

type RecoverResponsePayload

type RecoverResponsePayload struct {
	RecoverMessage []*RecoverMessage `json:"recoverMessages"`
	Status         int               `json:"status"`
}

func (*RecoverResponsePayload) BadRequest

func (recoverR *RecoverResponsePayload) BadRequest(message string, logger log.Logger)

func (*RecoverResponsePayload) SetInWriter

func (recoverR *RecoverResponsePayload) SetInWriter(w http.ResponseWriter, loggers chaoslogger.Loggers)

Jump to

Keyboard shortcuts

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