// Compile amber and create a Go Template (html/templates) instance.
// Necessary runtime functions will be injected and the template will be ready to be executed.
977632
func (c *Compiler) Compile() (*template.Template, error) {
	return c.CompileWithName(filepath.Base(c.filename))
}
325339
func Compile(input string, options Options) (*template.Template, error) {
	comp := New()
	comp.Options = options

	err := comp.Parse(input)
	if err != nil {
		return nil, err
	}

	return comp.Compile()
}
581543
func AddSourceTemplates(t *template.Template) {
	template.Must(t.Parse(`{{define "weblistcss"}}` + weblistPageCSS + `{{end}}`))
	template.Must(t.Parse(`{{define "weblistjs"}}` + weblistPageScript + `{{end}}`))
}
1235495
func (stmt CreateStmt) Compile(d Dialect, p *Parameters) (string, error) {
	// Compiled elements
	compiled := make([]string, len(stmt.table.creates))

	var err error
	for i, create := range stmt.table.creates {
		if compiled[i], err = create.Create(d); err != nil {
			return "", err
		}
	}

	return fmt.Sprintf(
		"CREATE TABLE \"%s\" (\n  %s\n);",
		stmt.table.Name(),
		strings.Join(compiled, ",\n  "),
	), nil
}
379090
func (rs RuleSpec) Compile(sm *StateMap) Rule {
	if rs.Include != "" {
		return IncludeRule{
			StateMap:  sm,
			StateName: rs.Include,
		}
	}
	return NewRegexpRule(rs.Regexp, rs.Type, rs.SubTypes,
		strings.Split(rs.State, " "))
}
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
}
1282845
func main() {
	var (
		extractLiteralTemplate = createTemplate("templates/extract/literal.go.tmpl")
		extractMapTemplate     = createTemplate("templates/extract/map_string_string.go.tmpl")
	)

	for _, opt := range options {
		filename := generateFilename(opt.Name)
		filepath := "../opt/" + filename

		if shouldBeGenerated(filepath) {
			switch opt.DefaultValue.(type) {
			case nil, bool, int, string, []string, map[string][]string:
				generateFile(extractLiteralTemplate, opt.Name, filepath)
			case map[string]string:
				generateFile(extractMapTemplate, opt.Name, filepath)
			default:
				fmt.Printf("cannot generate extract option file for %s: unhandled type %#v", opt.Name, opt.DefaultValue)
				os.Exit(1)
			}
		}
	}
}
1058460
func Compile(ctx context.Context, rawStmt ast.StmtNode) (plan.Plan, error) {
	info := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema)

	node := rawStmt
	err := resolver.ResolveName(node, info, ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	p, err := plan.Optimize(ctx, node, info)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return p, nil
}
412943
func init() {
	var err error
	fm := template.FuncMap{
		"tabs":     Tabs,
		"slice":    toSlice,
		"oneof":    oneof,
		"constant": constant,
		"goifyAtt": GoifyAtt,
		"add":      Add,
	}
	if enumValT, err = template.New("enum").Funcs(fm).Parse(enumValTmpl); err != nil {
		panic(err)
	}
	if formatValT, err = template.New("format").Funcs(fm).Parse(formatValTmpl); err != nil {
		panic(err)
	}
	if patternValT, err = template.New("pattern").Funcs(fm).Parse(patternValTmpl); err != nil {
		panic(err)
	}
	if minMaxValT, err = template.New("minMax").Funcs(fm).Parse(minMaxValTmpl); err != nil {
		panic(err)
	}
	if lengthValT, err = template.New("length").Funcs(fm).Parse(lengthValTmpl); err != nil {
		panic(err)
	}
	if requiredValT, err = template.New("required").Funcs(fm).Parse(requiredValTmpl); err != nil {
		panic(err)
	}
}
1085192
func Template(runOnStartup bool) POption {
	return func(p *POptions) {
		p.template = true
		p.runOnStartup = runOnStartup
	}
}
1006257
func (a *MandrillAPI) TemplateRender(templateName string, templateContent []Var, mergeVars []Var) (string, error) {
	if templateName == "" {
		return "", errors.New("templateName cannot be blank")
	}
	var response map[string]interface{}
	var params map[string]interface{} = make(map[string]interface{})
	params["template_name"] = templateName
	params["template_content"] = templateContent
	params["merge_vars"] = mergeVars
	err := parseMandrillJson(a, templates_render_endpoint, params, &response)
	var retval string = ""
	var ok bool = false
	if err == nil {
		retval, ok = response["html"].(string)
		if ok != true {
			log.Fatal("Received response with html parameter, however type was not string, this should not happen")
		}
	}
	return retval, err
}
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
}
347971
func (client *Client) CreateTemplate(ctx context.Context, template Template) (string, error) {
	content := map[string]interface{}{
		"name":     template.Name,
		"template": template.Content,
	}

	if err := client.request(ctx, "POST", "templates", content, &template); err != nil {
		return "", err
	}

	return template.ID, nil
}
391288
func (c *Compiler) Compile(ctx context.Context) (*flux.Spec, error) {
	transpiler := NewTranspilerWithConfig(
		c.dbrpMappingSvc,
		Config{
			Cluster:                c.Cluster,
			DefaultDatabase:        c.DB,
			DefaultRetentionPolicy: c.RP,
		},
	)
	return transpiler.Transpile(ctx, c.Query)
}
400412
func (c *Compiler) Compile(ctx context.Context, stmtNode ast.StmtNode) (*ExecStmt, error) {
	return c.compile(ctx, stmtNode, false)
}
1041694
func (j JoinOnStmt) Compile(d Dialect, params *Parameters) (string, error) {
	// Compile the clauses of the join statement
	clauses, err := j.ArrayClause.Compile(d, params)
	if err != nil {
		return "", err
	}
	return fmt.Sprintf(
		` %s %s ON %s`,
		j.method,
		j.table.Compile(d, params),
		clauses,
	), nil
}
947457
func (m *MockCompiler) Compile(arg0 pkg.Compilable) (pkg0.CompiledPackageRecord, bool, error) {
	ret := m.ctrl.Call(m, "Compile", arg0)
	ret0, _ := ret[0].(pkg0.CompiledPackageRecord)
	ret1, _ := ret[1].(bool)
	ret2, _ := ret[2].(error)
	return ret0, ret1, ret2
}