DataResult
The outcome of a database operation, which either carries a value or the failure that replaced it.
Every terminal method on a client query returns one of these rather than throwing, for the class of failures the database itself reports: a constraint the row violated, a deadlock, a RAISE EXCEPTION from a routine, a statement that ran out of time. Those are conditions an application is expected to have an answer for, and a return type says so where a catch two frames up does not.
It does not cover every way a call can fail. A query the database refused to parse, a row that does not fit the class it was asked for, a type the registry has never heard of - those are bugs in the calling code, and they are thrown. OctaviusClient names the split exactly.
Type Parameters
The type of the value carried on success.
Inheritors
Types
Functions
Returns the carried value, throwing the failure in its place.
Applies transform to the value of a DataResult.Success, and returns a DataResult.Failure as it stands.
Runs action on the failure if this is a DataResult.Failure, and returns this result either way.
Runs action on the carried value if this is a DataResult.Success, and returns this result either way.