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

Function ExampleAsInt

expr_test.go:301–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

299}
300
301func ExampleAsInt() {
302 program, err := expr.Compile("42", expr.AsInt())
303 if err != nil {
304 fmt.Printf("%v", err)
305 return
306 }
307
308 output, err := expr.Run(program, nil)
309 if err != nil {
310 fmt.Printf("%v", err)
311 return
312 }
313
314 fmt.Printf("%T(%v)", output, output)
315
316 // Output: int(42)
317}
318
319func ExampleAsInt64() {
320 env := map[string]any{

Callers

nothing calls this directly

Calls 4

CompileFunction · 0.92
AsIntFunction · 0.92
RunFunction · 0.92
PrintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…