// PgPltemplateByTmplname retrieves a row from 'pg_catalog.pg_pltemplate' as a PgPltemplate.
//
// Generated from index 'pg_pltemplate_name_index'.
483461
func PgPltemplateByTmplname(db XODB, tmplname pgtypes.Name) (*PgPltemplate, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, tmplname, tmpltrusted, tmpldbacreate, tmplhandler, tmplinline, tmplvalidator, tmpllibrary, tmplacl ` +
		`FROM pg_catalog.pg_pltemplate ` +
		`WHERE tmplname = $1`

	// run query
	XOLog(sqlstr, tmplname)
	pp := PgPltemplate{}

	err = db.QueryRow(sqlstr, tmplname).Scan(&pp.Tableoid, &pp.Cmax, &pp.Xmax, &pp.Cmin, &pp.Xmin, &pp.Ctid, &pp.Tmplname, &pp.Tmpltrusted, &pp.Tmpldbacreate, &pp.Tmplhandler, &pp.Tmplinline, &pp.Tmplvalidator, &pp.Tmpllibrary, &pp.Tmplacl)
	if err != nil {
		return nil, err
	}

	return &pp, nil
}
831361
func NewTemplate() *Template {
	return &Template{
		Conditions: make(map[string]interface{}),
		Outputs:    make(map[string]Output),
		Parameters: make(map[string]Parameter),
		Resources:  make(map[string]Resource),
	}
}
425485
func (t *templateHandler) AddTemplate(name, tpl string) error {
	h := t.getTemplateHandler(name)
	_, err := h.addTemplate(name, tpl)
	if err != nil {
		return err
	}
	return nil
}
1076967
func newTemplate(source string) *Template {
	return &Template{
		source:   source,
		helpers:  make(map[string]reflect.Value),
		partials: make(map[string]*partial),
	}
}
441428
func (s *TemplateService) RegisterTemplate(p *RegisterTemplateParams) (*RegisterTemplateResponse, error) {
	resp, err := s.cs.newRequest("registerTemplate", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r RegisterTemplateResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
97063
func (s *TestRenderTemplateInput) SetTemplateName(v string) *TestRenderTemplateInput {
	s.TemplateName = &v
	return s
}
1158244
func RegisterPartialTemplate(name string, tpl *Template) {
	partialsMutex.Lock()
	defer partialsMutex.Unlock()

	if partials[name] != nil {
		panic(fmt.Errorf("Partial already registered: %s", name))
	}

	partials[name] = newPartial(name, "", tpl)
}
400600
func (a *ArgType) NewTemplateFuncs() template.FuncMap {
	return template.FuncMap{
		"colcount":           a.colcount,
		"colnames":           a.colnames,
		"colnamesmulti":      a.colnamesmulti,
		"colnamesquery":      a.colnamesquery,
		"colnamesquerymulti": a.colnamesquerymulti,
		"colprefixnames":     a.colprefixnames,
		"colvals":            a.colvals,
		"colvalsmulti":       a.colvalsmulti,
		"fieldnames":         a.fieldnames,
		"fieldnamesmulti":    a.fieldnamesmulti,
		"goparamlist":        a.goparamlist,
		"reniltype":          a.reniltype,
		"retype":             a.retype,
		"shortname":          a.shortname,
		"convext":            a.convext,
		"schema":             a.schemafn,
		"colname":            a.colname,
		"hascolumn":          a.hascolumn,
		"hasfield":           a.hasfield,
		"getstartcount":      a.getstartcount,
	}
}
1026563
func (f *Fpdf) CreateTemplateCustom(corner PointType, size SizeType, fn func(*Tpl)) Template {
	return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f)
}
434648
func (p *partial) template() (*Template, error) {
	if p.tpl == nil {
		var err error

		p.tpl, err = Parse(p.source)
		if err != nil {
			return nil, err
		}
	}

	return p.tpl, nil
}
1083140
func (b *Bundle) AddTemplateString(filename, soyfile string) *Bundle {
	b.files = append(b.files, soyFile{filename, soyfile})
	return b
}
852217
func NewTemplate(input string) (*Template, error) {
	hm, err := NewHelperMap()
	if err != nil {
		return nil, errors.WithStack(err)
	}
	t := &Template{
		Input:   input,
		Helpers: hm,
	}
	err = t.Parse()
	if err != nil {
		return t, errors.WithStack(err)
	}
	return t, nil
}
131249
func (r *Registry) Template(name string) (Template, bool) {
	for _, t := range r.Templates {
		if t.Node.Name == name {
			return t, true
		}
	}
	return Template{}, false
}
110603
func ParsePathTemplate(pathTmpl string) *PathTemplate {
	tmpl := &PathTemplate{}
	tmpl.PathTemplate = pathTmpl
	vIndex := strings.Index(pathTmpl, "{")
	if vIndex == -1 {
		tmpl.httpHandlePath = pathTmpl
	} else {
		tmpl.httpHandlePath = pathTmpl[:vIndex]
	}

	tmpl.splittedPathTemplate = strings.Split(pathTmpl, "/")
	tmpl.isVariables = make([]bool, len(tmpl.splittedPathTemplate))

	re := regexp.MustCompile("^\\{(.+)\\}$")
	for idx, param := range tmpl.splittedPathTemplate {
		if re.MatchString(param) {
			key := re.FindStringSubmatch(param)[1]
			tmpl.PathParameters = append(tmpl.PathParameters, key)
			tmpl.isVariables[idx] = true
			continue
		}
	}

	return tmpl
}
317831
func (s *UpdateCustomVerificationEmailTemplateInput) SetTemplateName(v string) *UpdateCustomVerificationEmailTemplateInput {
	s.TemplateName = &v
	return s
}
358990
func PublishingTemplate(t amqp.Publishing) PublisherOpt {
	return func(p *Publisher) {
		p.tmpl = t
	}
}
1006577
func (s *CreateEnvironmentInput) SetTemplateName(v string) *CreateEnvironmentInput {
	s.TemplateName = &v
	return s
}