utils

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLogger

type AppLogger struct {
	Log *zap.Logger
}

func NewAppLogger

func NewAppLogger(logFileName string) *AppLogger

type HttpHandlerJson added in v0.0.2

type HttpHandlerJson struct{}

func NewHttpHandler added in v0.0.2

func NewHttpHandler() *HttpHandlerJson

func (*HttpHandlerJson) ErrorJSON added in v0.0.2

func (h *HttpHandlerJson) ErrorJSON(w http.ResponseWriter, err error, status ...int) error

ErrorJSON takes an error, and optionally a response status code, and generates and sends a json error response

func (*HttpHandlerJson) ReadJSON added in v0.0.2

func (h *HttpHandlerJson) ReadJSON(w http.ResponseWriter, r *http.Request, data any) error

ReadJSON tries to read the body of a request and converts it into JSON

func (*HttpHandlerJson) WriteJSON added in v0.0.2

func (h *HttpHandlerJson) WriteJSON(w http.ResponseWriter, status int, data any, headers ...http.Header) error

WriteJSON takes a response status code and arbitrary data and writes a json response to the client

Jump to

Keyboard shortcuts

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