render

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w *fasthttp.RequestCtx, obj any) error

func WriteString

func WriteString(w *fasthttp.RequestCtx, format string, data []any) (err error)

Types

type AsciiJSON

type AsciiJSON struct {
	Data any
}

func (AsciiJSON) Render

func (r AsciiJSON) Render(w *fasthttp.RequestCtx) (err error)

func (AsciiJSON) WriteContentType

func (r AsciiJSON) WriteContentType(w *fasthttp.RequestCtx)

type Data

type Data struct {
	ContentType string
	Data        []byte
}

func (Data) Render

func (r Data) Render(w *fasthttp.RequestCtx) (err error)

func (Data) WriteContentType

func (r Data) WriteContentType(w *fasthttp.RequestCtx)

type Delims

type Delims struct {
	// Left delimiter, defaults to {{.
	Left string
	// Right delimiter, defaults to }}.
	Right string
}

type HTML

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

func (HTML) Render

func (r HTML) Render(w *fasthttp.RequestCtx) error

func (HTML) WriteContentType

func (r HTML) WriteContentType(w *fasthttp.RequestCtx)

type HTMLDebug

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

func (HTMLDebug) Instance

func (r HTMLDebug) Instance(name string, data any) IRender

type HTMLProduction

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

func (HTMLProduction) Instance

func (r HTMLProduction) Instance(name string, data any) IRender

type IHTMLRender

type IHTMLRender interface {
	// Instance returns an HTML instance.
	Instance(string, any) IRender
}

type IRender

type IRender interface {
	Render(*fasthttp.RequestCtx) error
	WriteContentType(*fasthttp.RequestCtx)
}

type IndentedJSON

type IndentedJSON struct {
	Data any
}

func (IndentedJSON) Render

func (r IndentedJSON) Render(w *fasthttp.RequestCtx) error

func (IndentedJSON) WriteContentType

func (r IndentedJSON) WriteContentType(w *fasthttp.RequestCtx)

type JSON

type JSON struct {
	Data any
}

func (JSON) Render

func (r JSON) Render(w *fasthttp.RequestCtx) error

func (JSON) WriteContentType

func (r JSON) WriteContentType(w *fasthttp.RequestCtx)

type JsonpJSON

type JsonpJSON struct {
	Callback string
	Data     any
}

func (JsonpJSON) Render

func (r JsonpJSON) Render(w *fasthttp.RequestCtx) (err error)

func (JsonpJSON) WriteContentType

func (r JsonpJSON) WriteContentType(w *fasthttp.RequestCtx)

type PureJSON

type PureJSON struct {
	Data any
}

func (PureJSON) Render

func (r PureJSON) Render(w *fasthttp.RequestCtx) error

func (PureJSON) WriteContentType

func (r PureJSON) WriteContentType(w *fasthttp.RequestCtx)

type Reader

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

func (Reader) Render

func (r Reader) Render(w *fasthttp.RequestCtx) (err error)

func (Reader) WriteContentType

func (r Reader) WriteContentType(w *fasthttp.RequestCtx)

type Redirect

type Redirect struct {
	Code     int
	Location string
}

func (Redirect) Render

func (r Redirect) Render(w *fasthttp.RequestCtx) error

func (Redirect) WriteContentType

func (r Redirect) WriteContentType(*fasthttp.RequestCtx)

type SecureJSON

type SecureJSON struct {
	Prefix string
	Data   any
}

func (SecureJSON) Render

func (r SecureJSON) Render(w *fasthttp.RequestCtx) error

func (SecureJSON) WriteContentType

func (r SecureJSON) WriteContentType(w *fasthttp.RequestCtx)

type String

type String struct {
	Format string
	Data   []any
}

func (String) Render

func (r String) Render(w *fasthttp.RequestCtx) error

func (String) WriteContentType

func (r String) WriteContentType(w *fasthttp.RequestCtx)

type XML

type XML struct {
	Data any
}

func (XML) Render

func (r XML) Render(w *fasthttp.RequestCtx) error

func (XML) WriteContentType

func (r XML) WriteContentType(w *fasthttp.RequestCtx)

Jump to

Keyboard shortcuts

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