Represents the result of an operation. Usually a coercion operation.
More...
Inherited by FaunaDB.Types.Failure< T >, and FaunaDB.Types.Success< T >.
|
IResult< U > | Map< U > (Func< T, U > func) |
| Apply the function passed on the result value. More...
|
|
IResult< U > | FlatMap< U > (Func< T, IResult< U >> func) |
| Apply the function passed on the result value. More...
|
|
U | Match< U > (Func< T, U > Success, Func< string, U > Failure) |
| Matches the current instance. Case it represents a successful result it will execute the first argument. Case it represents a failure object it will execute the second argument. More...
|
|
void | Match (Action< T > Success, Action< string > Failure) |
| Matches the current instance. Case it represents a successful result it will execute the first argument. Case it represents a failure object it will execute the second argument. More...
|
|
|
T | Value [get] |
| Extracts the resulting value or throw an exception if the operation has failed. More...
|
|
IOption< T > | ToOption [get] |
| Gets an IOption<T> type containing the result value if the operation was successful, or Option.None<T>() if it was a failure More...
|
|
bool | isSuccess [get] |
| Return true if the operation was successful More...
|
|
bool | isFailure [get] |
| Return true if the operation has failed More...
|
|
Represents the result of an operation. Usually a coercion operation.
Definition at line 8 of file Result.cs.
◆ FlatMap< U >()
Apply the function passed on the result value.
- Parameters
-
func | the map function to be applied |
- Returns
- If this is a successful result, returns the map function result. If this is a failure, returns a new failure with the same error message.
◆ Map< U >()
Apply the function passed on the result value.
- Parameters
-
func | the map function to be applied |
- Returns
- If this is a successful result, return a new successful result with the map function result. If this is a failure, returns a new failure with the same error message.
◆ Match()
Matches the current instance. Case it represents a successful result it will execute the first argument. Case it represents a failure object it will execute the second argument.
IResult<string> result = ...
result.Match( Success: value => DoSomething(), Failure: reason => DoSomethingElse(reason) );
- Parameters
-
Success | Action to be executed case this instance represents a successful result |
Failure | Action to be executed case this instance represents a failure result |
◆ Match< U >()
Matches the current instance. Case it represents a successful result it will execute the first argument. Case it represents a failure object it will execute the second argument.
IResult<string> result = ... int parsed = result.Match( Success: value => int.Parse(value), Failure: reason => ReturnDefaultValue() );
- Parameters
-
Success | Function to be executed case this instance represents a successful result |
Failure | Function to be executed case this instance represents a failure result |
◆ isFailure
Return true if the operation has failed
Definition at line 81 of file Result.cs.
◆ isSuccess
Return true if the operation was successful
Definition at line 76 of file Result.cs.
◆ ToOption
Gets an IOption<T> type containing the result value if the operation was successful, or Option.None<T>() if it was a failure
Definition at line 71 of file Result.cs.
◆ Value
Extracts the resulting value or throw an exception if the operation has failed.
- Exceptions
-
InvalidOperationException | |
Definition at line 65 of file Result.cs.
The documentation for this interface was generated from the following file:
- /tmp/build/1a4543b4/fauna-csharp-repository/FaunaDB.Client/Types/Result.cs