MCPcopy
hub / github.com/samber/mo / ExampleOk

Function ExampleOk

result_example_test.go:10–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8var err = fmt.Errorf("error")
9
10func ExampleOk() {
11 ok := Ok(42)
12 result := ok.OrElse(1234)
13 _err := ok.Error()
14
15 fmt.Println(result, _err)
16 // Output: 42 <nil>
17}
18
19func ExampleErr() {
20 ko := Err[int](err)

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
ErrorMethod · 0.80
OrElseMethod · 0.45

Tested by

no test coverage detected