render

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 6 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 WriteString

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

Types

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

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

type Delims

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

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

type IndentedJSON

type IndentedJSON struct {
	Data interface{}
}

func (IndentedJSON) Render

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

func (IndentedJSON) WriteContentType

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

func (r JSON) 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

func (r Redirect) WriteContentType(http.ResponseWriter)

type Render

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

type String

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

func (String) Render

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

func (String) WriteContentType

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

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

Jump to

Keyboard shortcuts

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