Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expr Helper

N|Solid

Build Status

ParseText parse template.

Getting Started!

Define struct

type Data struct {
  Name  string
  Value string
}

Define func want to trigger

type TestFn struct {
}

func (self *TestFn) Call(body string) string {
	fmt.Println("mock call function")
	return body
}

How to use

	test := new(TestFn)
	data := Data{
		Name:  "Nguyen Cat Pham",
		Value: "oscar",
	}
	obj := map[string]interface{}{
		"data": data,
		"fn":   test,
	}
	strParsing := `{{$x := printf "{\"serial\":%q}" "response data" }}{{.fn.Call $x}}`
	result, err := ParseText("test", strParsing, obj)
	if err != nil || result == "" {
		// handle error here
	}

Installation

Request handler requires Go v1.11+ to run.

Install the package.

$ go get github.com/onskycloud/expr

Kubernetes + Google Cloud

See KUBERNETES.md

Todos

  • Write MORE Tests
  • Add Night Mode

License

MIT

About

ParseText parse template.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages