request

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetaKey meta
	MetaKey = "meta"
	// RequestIDKey request_id
	RequestIDKey = "request_id"
)

Variables

This section is empty.

Functions

func APIError

func APIError(ctx *gin.Context, kErr *error.KafkaError)

APIError http request error

func APISuccess

func APISuccess(ctx *gin.Context, response interface{})

APISuccess http request success

func GetRequestID

func GetRequestID(ctx *gin.Context) string

GetRequestID get current request id

Types

type Meta

type Meta struct {
	Code       int64  `json:"code"`        //error code, if succeed return 0
	Error      string `json:"error"`       //error for developer
	RequestID  string `json:"request_id"`  //request id
	RequestURI string `json:"request_uri"` //request uri
}

Meta struct

type Response

type Response struct {
	Meta Meta        `json:"meta"`     //response meta
	Body interface{} `json:"response"` //response body
}

Response struct

Jump to

Keyboard shortcuts

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