replace

package
v0.0.0-...-4c85db1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotBuiltin indicate the value of placeholder isn't builtin, users need to implement themselves
	ErrNotBuiltin = errors.New("not built-in variable")
	// ErrTmplNotExist ...
	ErrTmplNotExist = errors.New("tmpl not exist")
)

Functions

func ReplaceVariable

func ReplaceVariable(ctx *fasthttp.RequestCtx, w io.Writer, tag string) (int, error)

ReplaceVariable should be used in ExecuteFuncString

Types

type ReplaceFunc

type ReplaceFunc func(ctx *fasthttp.RequestCtx, w io.Writer) (int, error)

type TagFunc

type TagFunc = fasttemplate.TagFunc

type VariablePlaceholder

type VariablePlaceholder struct {
	// contains filtered or unexported fields
}

func NewVariablePlaceholder

func NewVariablePlaceholder() *VariablePlaceholder

NewVariablePlaceholder ...

func (*VariablePlaceholder) ExecuteFuncString

func (vp *VariablePlaceholder) ExecuteFuncString(tmplName string, fn TagFunc) (string, error)

func (*VariablePlaceholder) ExecuteString

func (vp *VariablePlaceholder) ExecuteString(tmplName string, ctx *fasthttp.RequestCtx) (string, error)

func (*VariablePlaceholder) GetTmpl

func (vp *VariablePlaceholder) GetTmpl(tmplName string) (*fasttemplate.Template, bool)

func (*VariablePlaceholder) SetTmpl

func (vp *VariablePlaceholder) SetTmpl(tmplName string)

Jump to

Keyboard shortcuts

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