json

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBody

func ReadBody[T any](req *http.Request, data *T) error

Types

type Response

type Response struct {
	Writer http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(w http.ResponseWriter) *Response

func NewResponseWithLogger

func NewResponseWithLogger(w http.ResponseWriter, r *http.Request, l zerolog.Logger) *Response

func (*Response) BadRequestWithMessage

func (r *Response) BadRequestWithMessage(message string)

func (*Response) BadRequestWithMessages

func (r *Response) BadRequestWithMessages(responseMessage, logMessage string)

func (*Response) ConflictWithMessage

func (r *Response) ConflictWithMessage(message string)

func (*Response) ConflictWithMessages

func (r *Response) ConflictWithMessages(responseMessage, logMessage string)

func (*Response) CreatedWithMessage

func (r *Response) CreatedWithMessage(message string)

TODO: Need to modify this to include the uri for created resource

func (*Response) Data

func (r *Response) Data(status int, data any)

func (*Response) ErrorWithMessages

func (r *Response) ErrorWithMessages(code int, responseMessage string, logMessage string, err error)

func (*Response) InternalServerErrorWithMessage

func (r *Response) InternalServerErrorWithMessage(err error, message string)

func (*Response) InternalServerErrorWithMessages

func (r *Response) InternalServerErrorWithMessages(err error, responseMessage string, logMessage string)

func (*Response) InvalidInputWithMessage

func (r *Response) InvalidInputWithMessage(err error, message string)

func (*Response) InvalidInputWithMessages

func (r *Response) InvalidInputWithMessages(err error, responseMessage, logMessage string)

func (*Response) NoContent

func (r *Response) NoContent()

func (*Response) NotAcceptableWithMessage

func (r *Response) NotAcceptableWithMessage(message string)

func (*Response) NotAcceptableWithMessages

func (r *Response) NotAcceptableWithMessages(responseMessage, logMessage string)

func (*Response) NotFoundWithMessage

func (r *Response) NotFoundWithMessage(message string)

func (*Response) NotFoundWithMessages

func (r *Response) NotFoundWithMessages(responseMessage, logMessage string)

func (*Response) OK

func (r *Response) OK(data any)

Jump to

Keyboard shortcuts

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