renderx

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchProtobuf

type BatchProtobuf struct {
	Data []interface{}
}

批处理protobuf数据

func (BatchProtobuf) Render

func (r BatchProtobuf) Render(w http.ResponseWriter) error

func (BatchProtobuf) WriteContentType

func (r BatchProtobuf) WriteContentType(w http.ResponseWriter)

type ProtoBuf

type ProtoBuf struct {
	Data interface{}
}

ProtoBuf contains the given interface object.

func (ProtoBuf) Render

func (r ProtoBuf) Render(w http.ResponseWriter) error

Render (ProtoBuf) marshals the given interface object and writes data with custom ContentType.

func (ProtoBuf) WriteContentType

func (r ProtoBuf) WriteContentType(w http.ResponseWriter)

type Response

type Response struct {
	Code    int         `json:"code"`             // 业务编码
	Message string      `json:"message"`          // 错误描述
	Reason  interface{} `json:"reason,omitempty"` // 错误详细描述
	Data    interface{} `json:"data"`             // 成功时返回的数据
	ID      string      `json:"id,omitempty"`     // 当前请求的唯一ID,便于问题定位,忽略也可
}

func Error

func Error(message string, reason ...interface{}) *Response

func Success

func Success(data ...interface{}) *Response

func (*Response) WithData

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

func (*Response) WithId

func (r *Response) WithId(id string) *Response

func (*Response) WithReason

func (r *Response) WithReason(reason interface{}) *Response

type ResponseWithRequestID

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

func NewResponseWithRequestID

func NewResponseWithRequestID(requestID int, result proto.Message, err error) *ResponseWithRequestID

Jump to

Keyboard shortcuts

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