result

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK              = Result{Code: 0, Msg: "ok", HttpStatus: 200}
	InternalError   = Result{Code: -1, Msg: "internal error", HttpStatus: 500}
	ConnectError    = Result{Code: 1001, Msg: "connect error", HttpStatus: 500}
	SettingNilError = Result{Code: 1002, Msg: "setting is nil", HttpStatus: 500}
)

Functions

This section is empty.

Types

type Result

type Result struct {
	Code int64       `json:"code"`
	Msg  string      `json:"message"`
	Data interface{} `json:"data,omitempty"`

	Err error `json:"error,omitempty"`

	HttpStatus int `json:"-"`
}

func Ok

func Ok(data interface{}) Result

func (*Result) Clone added in v0.0.11

func (result *Result) Clone() *Result

func (*Result) Error added in v0.0.11

func (result *Result) Error() string

func (*Result) SetCode added in v0.0.11

func (result *Result) SetCode(code int64) *Result

func (*Result) SetData added in v0.0.11

func (result *Result) SetData(v interface{}) *Result

func (*Result) SetError added in v0.0.11

func (result *Result) SetError(v error) *Result

func (*Result) SetHttpStatus added in v0.0.11

func (result *Result) SetHttpStatus(v int) *Result

func (*Result) SetMessage added in v0.0.11

func (result *Result) SetMessage(v string) *Result

func (*Result) String added in v0.0.11

func (result *Result) String() string

func (*Result) WriteJson

func (result *Result) WriteJson(ctx *gin.Context)

Jump to

Keyboard shortcuts

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