app

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	TTL     int         `json:"ttl"`
	Data    interface{} `json:"data,omitempty"`
}

JSON common json struct.

type PB

type PB struct {
	Code    int64                `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Message string               `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"`
	TTL     uint64               `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"`
	Data    *google_protobuf.Any `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"`
}

func (*PB) ProtoMessage

func (*PB) ProtoMessage()

func (*PB) Reset

func (m *PB) Reset()

func (*PB) String

func (m *PB) String() string

type Response

type Response struct {
	*gin.Context
}

func NewResponse

func NewResponse(c *gin.Context) *Response

func (*Response) JSON

func (c *Response) JSON(data interface{}, err error)

JSON serializes the given struct as JSON into the response body. It also sets the Content-Type as "application/json".

func (*Response) JSONMap

func (c *Response) JSONMap(data map[string]interface{}, err error)

JSONMap serializes the given map as map JSON into the response body. It also sets the Content-Type as "application/json".

func (*Response) MustBindHEADER added in v1.0.6

func (c *Response) MustBindHEADER(obj interface{}) (err error)

func (*Response) MustBindJSON added in v1.0.6

func (c *Response) MustBindJSON(obj interface{}) (err error)

func (*Response) MustBindQUERY added in v1.0.6

func (c *Response) MustBindQUERY(obj interface{}) (err error)

func (*Response) MustBindURI added in v1.0.6

func (c *Response) MustBindURI(obj interface{}) (err error)

func (*Response) MustBindWith added in v1.0.6

func (c *Response) MustBindWith(obj interface{}, b binding.Binding) (err error)

MustBindWith binds the passed struct pointer using the specified binding engine. It will abort the request with HTTP 400 if any error ocurrs. See the binding package.

func (*Response) MustBindXML added in v1.0.6

func (c *Response) MustBindXML(obj interface{}) (err error)

func (*Response) MustBindYAML added in v1.0.6

func (c *Response) MustBindYAML(obj interface{}) (err error)

func (*Response) Protobuf

func (c *Response) Protobuf(data proto.Message, err error)

Protobuf serializes the given struct as PB into the response body. It also sets the ContentType as "application/x-protobuf".

func (*Response) XML

func (c *Response) XML(data interface{}, err error)

XML serializes the given struct as XML into the response body. It also sets the Content-Type as "application/xml".

type XML

type XML struct {
	Code    int
	Message string
	Data    interface{}
}

XML common xml struct.

Jump to

Keyboard shortcuts

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