templates

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StructTemplate = `
type {{.StructName}} struct{
{{.Fields.String}}
}`

Functions

func CutFirstToLower

func CutFirstToLower(s string) string

Abc => a

func EsimFuncMap

func EsimFuncMap() map[string]interface{}

func FirstToLower

func FirstToLower(s string) string

Abc => abc

func Shorten

func Shorten(s string) string

Shorten shorten the string

Types

type HtmlTpl

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

HtmlTpl is the representation of the html parsed template

func (HtmlTpl) Execute

func (ht HtmlTpl) Execute(tplName string, text string, data interface{}) (string, error)

type StructInfo

type StructInfo struct {
	StructName string

	Fields pkg.Fields
}

func NewStructInfo

func NewStructInfo() StructInfo

func (StructInfo) String

func (si StructInfo) String() string

type TextTpl

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

TextTpl is the representation of the text parsed template

func (TextTpl) Execute

func (tt TextTpl) Execute(tplName string, text string, data interface{}) (string, error)

type Tpl

type Tpl interface {
	//Execute applies a parsed template to the specified data object,
	Execute(tplName string, text string, data interface{}) (string, error)
}

func NewHtmlTpl

func NewHtmlTpl() Tpl

func NewTextTpl

func NewTextTpl() Tpl

Jump to

Keyboard shortcuts

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