response

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OK request is success
	OK = newResponse(http.StatusOK, "ok")

	// Err request is failure
	Err = newResponse(http.StatusInternalServerError, "")
)

Functions

This section is empty.

Types

type Response

type Response struct {
	Code int         `json:"code,omitempty"`
	Msg  string      `json:"msg,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

Response declare unite api response format

func (*Response) String

func (resp *Response) String() string

func (*Response) WithData

func (resp *Response) WithData(data interface{}) *Response

WithData append data into response

func (*Response) WithMessage

func (resp *Response) WithMessage(message string) *Response

WithMessage append message into response

Jump to

Keyboard shortcuts

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