Documentation ¶
Index ¶
- type JSON
- type PB
- type Response
- func (c *Response) JSON(data interface{}, err error)
- func (c *Response) JSONMap(data map[string]interface{}, err error)
- func (c *Response) MustBindHEADER(obj interface{}) (err error)
- func (c *Response) MustBindJSON(obj interface{}) (err error)
- func (c *Response) MustBindQUERY(obj interface{}) (err error)
- func (c *Response) MustBindURI(obj interface{}) (err error)
- func (c *Response) MustBindWith(obj interface{}, b binding.Binding) (err error)
- func (c *Response) MustBindXML(obj interface{}) (err error)
- func (c *Response) MustBindYAML(obj interface{}) (err error)
- func (c *Response) Protobuf(data proto.Message, err error)
- func (c *Response) XML(data interface{}, err error)
- type XML
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()
type Response ¶
func NewResponse ¶
func (*Response) JSON ¶
JSON serializes the given struct as JSON into the response body. It also sets the Content-Type as "application/json".
func (*Response) JSONMap ¶
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 (*Response) MustBindJSON ¶ added in v1.0.6
func (*Response) MustBindQUERY ¶ added in v1.0.6
func (*Response) MustBindURI ¶ added in v1.0.6
func (*Response) MustBindWith ¶ added in v1.0.6
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 (*Response) MustBindYAML ¶ added in v1.0.6
Click to show internal directories.
Click to hide internal directories.