Skip to content

Design Doc

fall simply edited this page Dec 19, 2020 · 2 revisions

Table of Contents

Template

Template

Hello, I'm {{name}} from {{City}}, {{from_state}}

Regular Expression

Hello, I'm (?P<name>.*) from (?P<City>.*), (?P<from_state>.*)

Pull

Method Header

func (t Template) Pull(input string) map[string]interface{}

Input

Hello, I'm John from Dallas, TX

Output

{
	name: "John",
	City: "Dallas",
	from_state: "TX"
}

Template to Regex - Regex101
String to Data - Regex101

Populate

Method Header

func (t Template) Populate(data map[string]interface{}) string

Template

Hello, I'm {{name}} from {{City}}, {{from_state}}

Input

{
	name: "John",
	City: "Dallas",
	from_state: "TX"
}

Output

Hello, I'm John from Dallas, TX
Clone this wiki locally