response

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w http.ResponseWriter, res Response)

func WriteError

func WriteError(w http.ResponseWriter, err error)

Types

type Meta

type Meta struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

func (Meta) HttpStatus

func (m Meta) HttpStatus() int

type Response

type Response struct {
	Meta Meta        `json:"meta,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

func Created

func Created(data interface{}) Response

func Error

func Error(err error) Response

func New

func New(code int, message string, data interface{}) Response

func Ok

func Ok(data interface{}) Response

Jump to

Keyboard shortcuts

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