Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
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
8
var
err = fmt.Errorf(
"error"
)
9
10
func
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
19
func
ExampleErr() {
20
ko := Err[int](err)
Callers
nothing calls this directly
Calls
3
Ok
Function · 0.85
Error
Method · 0.80
OrElse
Method · 0.45
Tested by
no test coverage detected