MCPcopy
hub / github.com/expr-lang/expr / main

Function main

vm/runtime/helpers/main.go:12–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func main() {
13 var b bytes.Buffer
14 err := template.Must(
15 template.New("helpers").
16 Funcs(template.FuncMap{
17 "cases": func(op string) string { return cases(op, uints, ints, floats) },
18 "cases_int_only": func(op string) string { return cases(op, uints, ints) },
19 "cases_with_duration": func(op string) string {
20 return cases(op, uints, ints, floats, []string{"time.Duration"})
21 },
22 "array_equal_cases": func() string { return arrayEqualCases([]string{"string"}, uints, ints, floats) },
23 }).
24 Parse(helpers),
25 ).Execute(&b, nil)
26 if err != nil {
27 panic(err)
28 }
29
30 formatted, err := format.Source(b.Bytes())
31 if err != nil {
32 panic(err)
33 }
34 fmt.Print(string(formatted))
35}
36
37var ints = []string{
38 "int",

Callers

nothing calls this directly

Calls 5

casesFunction · 0.85
arrayEqualCasesFunction · 0.85
ParseMethod · 0.80
SourceMethod · 0.80
PrintMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…