custom

package
v0.0.0-...-6697815 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, r *http.Request)

func Delete

func Delete(h http.HandlerFunc) http.HandlerFunc

func Get

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request)

func NotImplemented

func NotImplemented(w http.ResponseWriter, r *http.Request)

func Only

func Only(method string, path string, h http.HandlerFunc) (string, http.HandlerFunc)

func Post

func Put

func ReadJSON

func ReadJSON(w http.ResponseWriter, r *http.Request, ptr any)

func ReadRaw

func ReadRaw(w http.ResponseWriter, r *http.Request) ([]byte, string)

func ReadXML

func ReadXML(w http.ResponseWriter, r *http.Request, ptr any)

func WriteErrorJSON

func WriteErrorJSON(w http.ResponseWriter, r *http.Request, code int, err error)

func WriteJSON

func WriteJSON(w http.ResponseWriter, r *http.Request, code int, data any)

func WriteRaw

func WriteRaw(w http.ResponseWriter, r *http.Request, code int, data []byte)

func WriteXML

func WriteXML(w http.ResponseWriter, r *http.Request, code int, data any)

Types

type ErrJSON

type ErrJSON struct {
	Code   int    `json:"code"`
	Status string `json:"status"`
	Error  error  `json:"error"`
}

func NewErrorJSON

func NewErrorJSON(code int, err error) ErrJSON

type JSON

type JSON map[string]any

Jump to

Keyboard shortcuts

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