render

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w http.ResponseWriter, obj interface{}) error

func WriteMsgPack added in v1.3.0

func WriteMsgPack(w http.ResponseWriter, obj interface{}) error

func WriteString

func WriteString(w http.ResponseWriter, format string, data []interface{})

Types

type AsciiJSON added in v1.3.0

type AsciiJSON struct {
	Data interface{}
}

func (AsciiJSON) Render added in v1.3.0

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

func (AsciiJSON) WriteContentType added in v1.3.0

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

type Data

type Data struct {
	ContentType string
	Data        []byte
}

func (Data) Render

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

Render (Data) writes data with custom ContentType.

func (Data) WriteContentType added in v1.3.0

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

type Delims added in v1.3.0

type Delims struct {
	Left  string
	Right string
}

type HTML

type HTML struct {
	Template *template.Template
	Name     string
	Data     interface{}
}

func (HTML) Render

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

func (HTML) WriteContentType added in v1.3.0

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

type HTMLDebug

type HTMLDebug struct {
	Files   []string
	Glob    string
	Delims  Delims
	FuncMap template.FuncMap
}

func (HTMLDebug) Instance

func (r HTMLDebug) Instance(name string, data interface{}) Render

type HTMLProduction

type HTMLProduction struct {
	Template *template.Template
	Delims   Delims
}

func (HTMLProduction) Instance

func (r HTMLProduction) Instance(name string, data interface{}) Render

type HTMLRender

type HTMLRender interface {
	Instance(string, interface{}) Render
}

type IndentedJSON

type IndentedJSON struct {
	Data interface{}
}

func (IndentedJSON) Render

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

func (IndentedJSON) WriteContentType added in v1.3.0

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

type JSON

type JSON struct {
	Data interface{}
}

func (JSON) Render

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

func (JSON) WriteContentType added in v1.3.0

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

type JsonpJSON added in v1.3.0

type JsonpJSON struct {
	Callback string
	Data     interface{}
}

func (JsonpJSON) Render added in v1.3.0

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

func (JsonpJSON) WriteContentType added in v1.3.0

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

type MsgPack added in v1.3.0

type MsgPack struct {
	Data interface{}
}

func (MsgPack) Render added in v1.3.0

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

func (MsgPack) WriteContentType added in v1.3.0

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

type Reader added in v1.3.0

type Reader struct {
	ContentType   string
	ContentLength int64
	Reader        io.Reader
	Headers       map[string]string
}

func (Reader) Render added in v1.3.0

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

Render (Reader) writes data with custom ContentType and headers.

func (Reader) WriteContentType added in v1.3.0

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

type Redirect

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

func (Redirect) Render

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

func (Redirect) WriteContentType added in v1.3.0

func (r Redirect) WriteContentType(http.ResponseWriter)

type Render

type Render interface {
	Render(http.ResponseWriter) error
	WriteContentType(w http.ResponseWriter)
}

type SecureJSON added in v1.3.0

type SecureJSON struct {
	Prefix string
	Data   interface{}
}

func (SecureJSON) Render added in v1.3.0

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

func (SecureJSON) WriteContentType added in v1.3.0

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

type SecureJSONPrefix added in v1.3.0

type SecureJSONPrefix string

type String

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

func (String) Render

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

func (String) WriteContentType added in v1.3.0

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

type XML

type XML struct {
	Data interface{}
}

func (XML) Render

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

func (XML) WriteContentType added in v1.3.0

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

type YAML

type YAML struct {
	Data interface{}
}

func (YAML) Render

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

func (YAML) WriteContentType added in v1.3.0

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

Jump to

Keyboard shortcuts

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