templates

package
v0.0.0-...-6d34543 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 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, 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, text string, data interface{}) (string, error)

type Tpl

type Tpl interface {
	// Execute applies a parsed template to the specified data object.
	Execute(tplName, 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