api

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpResult

func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error)

func SpanIDFromContext added in v1.0.2

func SpanIDFromContext(ctx context.Context) string

func TraceIDFromContext added in v1.0.2

func TraceIDFromContext(ctx context.Context) string

Types

type ResponseFail

type ResponseFail struct {
	Success bool         `json:"success"`
	Message string       `json:"message"`
	Code    errx.ErrCode `json:"code"`
	Trace   string       `json:"trace"`
	Span    string       `json:"span"`
}

func Fail

func Fail(errCode errx.ErrCode, errMsg string) *ResponseFail

func FailWithTrace added in v1.0.2

func FailWithTrace(errCode errx.ErrCode, errMsg string, span, trace string) *ResponseFail

type ResponseOk

type ResponseOk struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func Success

func Success(data interface{}) *ResponseOk

Jump to

Keyboard shortcuts

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