Warning:
Fauna is decommissioning FQL v4 on June 30, 2025.

This driver is not compatible with FQL v10, the latest version. Fauna accounts created after August 21, 2024 must use FQL v10.
Ensure you migrate existing projects to the official v10 driver by the v4 EOL date: https://github.com/fauna/fauna-dotnet.

For more information, see the v4 end of life (EOL) announcement and related FAQ.

Fauna csharp driver  4.2.0
Public Member Functions | Properties | List of all members
FaunaDB.Types.IOption< T > Interface Template Reference

Represents an optional value. More...

Inherited by FaunaDB.Types.None< T >, and FaunaDB.Types.Some< T >.

Public Member Functions

IOption< U > Map< U > (Func< T, U > func)
 Apply the function passed on the optional value. More...
 
IOption< U > FlatMap< U > (Func< T, IOption< U >> func)
 Apply the function passed on the optional value. More...
 
Match< U > (Func< T, U > Some, Func< U > None)
 Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument. More...
 
void Match (Action< T > Some, Action None)
 Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument. More...
 

Properties

Value [get]
 

Detailed Description

Represents an optional value.

Definition at line 8 of file Option.cs.

Member Function Documentation

◆ FlatMap< U >()

IOption<U> FaunaDB.Types.IOption< T >.FlatMap< U > ( Func< T, IOption< U >>  func)

Apply the function passed on the optional value.

Parameters
functhe map function to be applied
Returns
If this is a some value, return a new optional with the function applied to it. If this is a none value, returns none and ignore the function.

◆ Map< U >()

IOption<U> FaunaDB.Types.IOption< T >.Map< U > ( Func< T, U >  func)

Apply the function passed on the optional value.

Parameters
functhe map function to be applied
Returns
If this is a some value, return a new optional with the function applied to it. If this is a none value, returns none and ignore the function.

◆ Match()

void FaunaDB.Types.IOption< T >.Match ( Action< T >  Some,
Action  None 
)

Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument.

IOption<string> optional = ...

result.Match( Some: value => DoSomething(value), None: () => DoSomethingElse() );

Parameters
SomeFunction to be executed case this instance contains some value
NoneFunction to be executed case this instance contains none value

◆ Match< U >()

U FaunaDB.Types.IOption< T >.Match< U > ( Func< T, U >  Some,
Func< U >  None 
)

Matches the current instance. Case it contains some value it will execute the first argument. Case it contains none value it will execute the second argument.

IOption<string> optional = ...

int parsed = result.Match( Some: value => int.Parse(value), None: () => ReturnDefaultValue() );

Parameters
SomeFunction to be executed case this instance contains some value
NoneFunction to be executed case this instance contains none value

Property Documentation

◆ Value

Definition at line 10 of file Option.cs.


The documentation for this interface was generated from the following file: