Documentation ¶
Index ¶
- Variables
- func DurationToNanosBytes(r io.Reader) ([]byte, error)
- func DurationToNanosMap(input map[string]interface{}) (map[string]interface{}, error)
- func Error(w http.ResponseWriter, err error, code int)
- func IsInvalidParams(err error) bool
- func WriteJSONResponse(w http.ResponseWriter, data interface{}, logger *zap.Logger)
- func WriteProtoMsgJSONResponse(w http.ResponseWriter, data proto.Message, logger *zap.Logger)
- func WriteUninitializedResponse(w http.ResponseWriter, logger *zap.Logger)
- type ErrorResponse
- type ParseError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidParams is returned when input parameters are invalid ErrInvalidParams = errors.New("invalid request params") )
Functions ¶
func DurationToNanosBytes ¶
DurationToNanosBytes transforms a json byte slice with Duration keys into Nanos
func DurationToNanosMap ¶
DurationToNanosMap transforms keys with a Duration into Nanos
func IsInvalidParams ¶
IsInvalidParams returns true if this is an invalid params error
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, data interface{}, logger *zap.Logger)
WriteJSONResponse writes generic data to the ResponseWriter
func WriteProtoMsgJSONResponse ¶
WriteProtoMsgJSONResponse writes a protobuf message to the ResponseWriter. This uses jsonpb for json marshalling, which encodes fields with default values, even with the omitempty tag.
func WriteUninitializedResponse ¶
func WriteUninitializedResponse(w http.ResponseWriter, logger *zap.Logger)
WriteUninitializedResponse writes a protobuf message to the ResponseWriter
Types ¶
type ErrorResponse ¶ added in v0.7.0
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse is a generic response for an HTTP error.
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError is the error from parsing requests
func NewParseError ¶
func NewParseError(inner error, code int) *ParseError
NewParseError creates a new parse error
Click to show internal directories.
Click to hide internal directories.