render

package
v0.0.0-...-0158116 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 2 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

Types

type JSON

type JSON struct {
	Data interface{}
}

JSON contains the given interface object.

func (JSON) Render

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

Render (JSON) writes data with custom ContentType.

func (JSON) WriteContentType

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

WriteContentType (JSON) writes JSON 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.

Jump to

Keyboard shortcuts

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