render

package
v0.0.0-...-73c17ce Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteString

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

WriteString writes data according to its format and write custom ContentType.

Types

type Redirect

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

Redirect contains the http request reference and redirects status code and location.

func (Redirect) Render

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

Render (Redirect) redirects the http request to new location and writes redirect response.

func (Redirect) WriteContentType

func (r Redirect) WriteContentType(http.ResponseWriter)

WriteContentType (Redirect) don't write any ContentType.

type Render

type Render interface {
	// Render writes data with custom ContentType.
	Render(http.ResponseWriter) error
	// WriteContentType writes custom ContentType.
	WriteContentType(w http.ResponseWriter)
}

Render interface is to be implemented by JSON, XML, HTML, YAML and so on.

type String

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

String contains the given interface object slice and its format.

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 (String) writes Plain ContentType.

Jump to

Keyboard shortcuts

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