write

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error) http.HandlerFunc

Error is a shortcut for converting custom error types into appropriate response codes and JSON

func JSON

func JSON(obj interface{}) http.HandlerFunc

JSON is a shortcut for writing JSON api responses

func JSONorErr

func JSONorErr(obj interface{}, err error) http.HandlerFunc

JSONorErr is a simple helper to handle the last `if err != nil` check in a handler

func Success

func Success() http.HandlerFunc

Success writes a generic { success: true } response

func SuccessOrErr

func SuccessOrErr(err error) http.HandlerFunc

SuccessOrErr is a simple helper to handle the last `if err != nil` check in a handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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