render

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package render is a generated protocol buffer package.

It is generated from these files:

pb.proto

It has these top-level messages:

PB

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

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

Data common bytes struct.

func (Data) Render

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

Render (Data) writes data with custom ContentType.

func (Data) WriteContentType

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

WriteContentType writes data with custom ContentType.

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.

func (JSON) Render

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

Render (JSON) writes data with json ContentType.

func (JSON) WriteContentType

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

WriteContentType write json ContentType.

type MapJSON

type MapJSON map[string]interface{}

MapJSON common map json struct.

func (MapJSON) Render

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

Render (MapJSON) writes data with json ContentType.

func (MapJSON) WriteContentType

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

WriteContentType write json ContentType.

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

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

func (*PB) GetCode

func (m *PB) GetCode() int64

func (*PB) GetData

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

func (*PB) GetMessage

func (m *PB) GetMessage() string

func (*PB) GetTTL

func (m *PB) GetTTL() uint64

func (*PB) ProtoMessage

func (*PB) ProtoMessage()

func (PB) Render

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

Render (PB) writes data with protobuf ContentType.

func (*PB) Reset

func (m *PB) Reset()

func (*PB) String

func (m *PB) String() string

func (PB) WriteContentType

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

WriteContentType write protobuf ContentType.

type Redirect

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

Redirect render for redirect to specified location.

func (Redirect) Render

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

Render (Redirect) redirect to specified location.

func (Redirect) WriteContentType

func (r Redirect) WriteContentType(http.ResponseWriter)

WriteContentType noneContentType.

type Render

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

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

String common string struct.

func (String) Render

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

Render (String) writes data with custom ContentType.

func (String) WriteContentType

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

WriteContentType writes string with text/plain ContentType.

type XML

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

XML common xml struct.

func (XML) Render

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

Render (XML) writes data with xml ContentType.

func (XML) WriteContentType

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

WriteContentType write xml ContentType.

Jump to

Keyboard shortcuts

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