render

package
v1.2.115 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSONPB

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

WriteJSONPB marshals the given interface object and writes it with custom ContentType.

Types

type JSONPB

type JSONPB struct {
	Data interface{}
}

JSONPB contains the given interface object.

func (JSONPB) Render

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

Render (JSON) writes data with custom ContentType.

func (JSONPB) WriteContentType

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

WriteContentType (JSON) writes JSON ContentType.

type TemplateHTML

type TemplateHTML struct {
	Template *template.Template
	Files    []string
	Glob     string

	FuncMap template.FuncMap
	Name    string // Data's Name in tmpl
	Data    interface{}

	Delims *render.Delims
	// contains filtered or unexported fields
}

TemplateHTML contains template reference and its name with given interface object.

func (TemplateHTML) Render

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

Render (TemplateHTML) executes template and writes its result with custom ContentType for response.

func (TemplateHTML) WriteContentType

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

WriteContentType (TemplateHTML) writes TemplateHTML ContentType.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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