templates

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 8 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 FirstToUpper added in v0.1.3

func FirstToUpper(s string) string

func Shorten

func Shorten(s string) string

Shorten shorten the string.

Types

type HTMLTpl added in v0.0.9

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

HtmlTpl is the representation of the html parsed template.

func (HTMLTpl) Execute added in v0.0.9

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

type Option added in v0.1.2

type Option func(c *StructInfo)

func WithLogger added in v0.1.2

func WithLogger(logger log.Logger) Option

func WithTpl added in v0.1.2

func WithTpl(tpl Tpl) Option

type StructInfo

type StructInfo struct {
	StructName string

	Fields pkg.Fields
	// contains filtered or unexported fields
}

func NewStructInfo

func NewStructInfo(options ...Option) *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 added in v0.0.9

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