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

Function ExampleResult_FlatMap_err

result_example_test.go:354–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

352}
353
354func ExampleResult_FlatMap_err() {
355 ko := Err[int](err)
356 result := ko.FlatMap(
357 func(i int) Result[int] {
358 return Ok(1234)
359 },
360 )
361
362 fmt.Println(result.IsError(), result.OrEmpty(), result.Error())
363 // Output: true 0 error
364}

Callers

nothing calls this directly

Calls 5

OkFunction · 0.85
IsErrorMethod · 0.80
ErrorMethod · 0.80
FlatMapMethod · 0.65
OrEmptyMethod · 0.45

Tested by

no test coverage detected