api

package
v0.0.0-...-2033d17 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDerivedErrorRenderer

func NewDerivedErrorRenderer(err error, statusCode int) render.Renderer

func NewDerivedErrorRendererWithData

func NewDerivedErrorRendererWithData(err error, statusCode int, data Data) render.Renderer

func NewHealthRouter

func NewHealthRouter(service health.Service) chi.Router

func NewSnippetRouter

func NewSnippetRouter(service snippet.Service) chi.Router

func NewTextErrorRenderer

func NewTextErrorRenderer(errText string, statusCode int) render.Renderer

func NewTextErrorRendererWithData

func NewTextErrorRendererWithData(errText string, statusCode int, data Data) render.Renderer

Types

type Data

type Data map[string]any

type Error

type Error struct {
	HTTPStatusCode int    `json:"-"`
	ErrText        string `json:"error,omitempty"`
	Data           Data   `json:"data,omitempty"`
}

func (*Error) Render

func (err *Error) Render(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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