code

package
v0.0.0-...-3991c3e Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w http.ResponseWriter, code ErrorCode)

Write writes the code as defined in the constants along with its error string

func WriteError

func WriteError(w http.ResponseWriter, value interface{})

WriteError outputs the result as Error(1) and body=value

func WriteOk

func WriteOk(w http.ResponseWriter)

WriteOk writes a successful reply to the ResponseWriter

func WriteValue

func WriteValue(w http.ResponseWriter, value interface{})

WriteValue outputs the result as Ok(0) and body=value

func WriteValueCode

func WriteValueCode(w http.ResponseWriter, code ErrorCode, value interface{})

WriteValueCode outputs the result as code=code and body=value

Types

type ErrorCode

type ErrorCode int

ErrorCode is used to indicate server responses

const (
	Ok ErrorCode = iota
	ServerErr
	ParamErr
	ReqBodyErr
)

Constants representing different code response types

Jump to

Keyboard shortcuts

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