webapi

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RespDefault func() *WebHTTPApi = func() *WebHTTPApi {
	return NewWebHTTPApi(200)
}

Functions

func WebHttpApiResponseHandler

func WebHttpApiResponseHandler(resp interface{}) (code int, data map[string]interface{})

Types

type IWebHTTPApi

type IWebHTTPApi interface {
	Code() int
	Message() string
	Data() interface{}
	Extra() map[string]interface{}
	Page() int64
	Limit() int64
	Total() int64
	HttpCode() int
	OmitEmptyKeys() []string
}

type WebHTTPApi

type WebHTTPApi struct {
	// contains filtered or unexported fields
}

func NewWebHTTPApi

func NewWebHTTPApi(code int) *WebHTTPApi

NewWebHTTPApi create a new WebHTTPApi for user quickly create a response code: response "code" in body

func (*WebHTTPApi) Code

func (w *WebHTTPApi) Code() int

func (*WebHTTPApi) Data

func (w *WebHTTPApi) Data() interface{}

func (*WebHTTPApi) Extra

func (w *WebHTTPApi) Extra() map[string]interface{}

func (*WebHTTPApi) HttpCode

func (w *WebHTTPApi) HttpCode() int

func (*WebHTTPApi) Limit

func (w *WebHTTPApi) Limit() int64

func (*WebHTTPApi) Message

func (w *WebHTTPApi) Message() string

func (*WebHTTPApi) OmitEmptyKeys added in v1.0.4

func (w *WebHTTPApi) OmitEmptyKeys() []string

func (*WebHTTPApi) Page

func (w *WebHTTPApi) Page() int64

func (*WebHTTPApi) Response added in v1.0.4

func (w *WebHTTPApi) Response() map[string]interface{}

func (*WebHTTPApi) SetCode

func (w *WebHTTPApi) SetCode(code int) *WebHTTPApi

func (*WebHTTPApi) SetData

func (w *WebHTTPApi) SetData(data interface{}) *WebHTTPApi

func (*WebHTTPApi) SetExtra

func (w *WebHTTPApi) SetExtra(extra map[string]interface{}) *WebHTTPApi

func (*WebHTTPApi) SetHttpCode

func (w *WebHTTPApi) SetHttpCode(httpCode int) *WebHTTPApi

func (*WebHTTPApi) SetLimit

func (w *WebHTTPApi) SetLimit(limit int64) *WebHTTPApi

func (*WebHTTPApi) SetMessage

func (w *WebHTTPApi) SetMessage(message string) *WebHTTPApi

func (*WebHTTPApi) SetOmitEmptyKeys added in v1.0.4

func (w *WebHTTPApi) SetOmitEmptyKeys(omit ...string) *WebHTTPApi

func (*WebHTTPApi) SetPage

func (w *WebHTTPApi) SetPage(page int64) *WebHTTPApi

func (*WebHTTPApi) SetTotal

func (w *WebHTTPApi) SetTotal(total int64) *WebHTTPApi

func (*WebHTTPApi) Total

func (w *WebHTTPApi) Total() int64

Jump to

Keyboard shortcuts

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