fstore

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 6 Imported by: 2

README

fstore

fstore have bunch of go-template functions.

go get github.com/rytsh/liz/fstore

Documentation

Overview

Example
tpl := templatex.New(store.WithAddFuncsTpl(
	FuncMapTpl(),
))

output, err := tpl.ExecuteBuffer(
	templatex.WithContent(
		`{{ $v := codec.JsonDecode (codec.StringToByte .) }}{{ $v.data.name }}`,
	),
	templatex.WithData(`{"data": {"name": "Hatay"}}`),
)
if err != nil {
	fmt.Printf("%v", err)
	return
}

fmt.Printf("%s", output)
Output:

Hatay

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncMap

func FuncMap(opts ...Option) map[string]interface{}

func FuncMapTpl

func FuncMapTpl(opts ...Option) func(t *templatex.Template) map[string]interface{}

Types

type Option

type Option func(options *options)

func WithDisableFuncs

func WithDisableFuncs(disableFuncs ...string) Option

func WithLog

func WithLog(log logz.Adapter) Option

func WithSpecificFuncs

func WithSpecificFuncs(specificFuncs ...string) Option

func WithTemplatex

func WithTemplatex(t *templatex.Template) Option

func WithTrust

func WithTrust(trust bool) Option

func WithWorkDir

func WithWorkDir(workDir string) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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