kratos: github.com/bilibili/kratos/pkg/net/http/blademaster/render Index | Files

package render

import "github.com/bilibili/kratos/pkg/net/http/blademaster/render"

Package render is a generated protocol buffer package.

It is generated from these files:

pb.proto

It has these top-level messages:

PB

Index

Package Files

data.go json.go protobuf.go redirect.go render.go render.pb.go string.go xml.go

type Data Uses

type Data struct {
    ContentType string
    Data        [][]byte
}

Data common bytes struct.

func (Data) Render Uses

func (r Data) Render(w http.ResponseWriter) (err error)

Render (Data) writes data with custom ContentType.

func (Data) WriteContentType Uses

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

WriteContentType writes data with custom ContentType.

type JSON Uses

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

JSON common json struct.

func (JSON) Render Uses

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

Render (JSON) writes data with json ContentType.

func (JSON) WriteContentType Uses

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

WriteContentType write json ContentType.

type MapJSON Uses

type MapJSON map[string]interface{}

MapJSON common map json struct.

func (MapJSON) Render Uses

func (m MapJSON) Render(w http.ResponseWriter) error

Render (MapJSON) writes data with json ContentType.

func (MapJSON) WriteContentType Uses

func (m MapJSON) WriteContentType(w http.ResponseWriter)

WriteContentType write json ContentType.

type PB Uses

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) Descriptor Uses

func (*PB) Descriptor() ([]byte, []int)

func (*PB) GetCode Uses

func (m *PB) GetCode() int64

func (*PB) GetData Uses

func (m *PB) GetData() *google_protobuf.Any

func (*PB) GetMessage Uses

func (m *PB) GetMessage() string

func (*PB) GetTTL Uses

func (m *PB) GetTTL() uint64

func (*PB) ProtoMessage Uses

func (*PB) ProtoMessage()

func (PB) Render Uses

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

Render (PB) writes data with protobuf ContentType.

func (*PB) Reset Uses

func (m *PB) Reset()

func (*PB) String Uses

func (m *PB) String() string

func (PB) WriteContentType Uses

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

WriteContentType write protobuf ContentType.

type Redirect Uses

type Redirect struct {
    Code     int
    Request  *http.Request
    Location string
}

Redirect render for redirect to specified location.

func (Redirect) Render Uses

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

Render (Redirect) redirect to specified location.

func (Redirect) WriteContentType Uses

func (r Redirect) WriteContentType(http.ResponseWriter)

WriteContentType noneContentType.

type Render Uses

type Render interface {
    // Render render it to http response writer.
    Render(http.ResponseWriter) error
    // WriteContentType write content-type to http response writer.
    WriteContentType(w http.ResponseWriter)
}

Render http reponse render.

type String Uses

type String struct {
    Format string
    Data   []interface{}
}

String common string struct.

func (String) Render Uses

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

Render (String) writes data with custom ContentType.

func (String) WriteContentType Uses

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

WriteContentType writes string with text/plain ContentType.

type XML Uses

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

XML common xml struct.

func (XML) Render Uses

func (r XML) Render(w http.ResponseWriter) (err error)

Render (XML) writes data with xml ContentType.

func (XML) WriteContentType Uses

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

WriteContentType write xml ContentType.

Package render imports 9 packages (graph) and is imported by 1 packages. Updated 2019-05-04. Refresh now. Tools for package owners.