FunctionalDdd.RailwayOrientedProgramming
1.1.1
See the version list below for details.
dotnet add package FunctionalDdd.RailwayOrientedProgramming --version 1.1.1
NuGet\Install-Package FunctionalDdd.RailwayOrientedProgramming -Version 1.1.1
<PackageReference Include="FunctionalDdd.RailwayOrientedProgramming" Version="1.1.1" />
paket add FunctionalDdd.RailwayOrientedProgramming --version 1.1.1
#r "nuget: FunctionalDdd.RailwayOrientedProgramming, 1.1.1"
// Install FunctionalDdd.RailwayOrientedProgramming as a Cake Addin #addin nuget:?package=FunctionalDdd.RailwayOrientedProgramming&version=1.1.1 // Install FunctionalDdd.RailwayOrientedProgramming as a Cake Tool #tool nuget:?package=FunctionalDdd.RailwayOrientedProgramming&version=1.1.1
Railway Oriented Programming
Structs
Result
Result object holds the result of an operation or Error
It is defined as
public readonly struct Result<TValue>
{
public TValue Value => IsSuccess ? _value! : throw new InvalidOperationException;
public Error Error => IsFailure ? _error! : throw new InvalidOperationException;
public bool IsSuccess => !IsFailure;
public bool IsFailure { get; }
public static implicit operator Result<TValue>(TValue value) => Result.Success(value);
public static implicit operator Result<TValue>(Error error) => Result.Failure<TValue>(error);
}
Maybe
Maybe object holds a value or nothing. It is defined as
public readonly struct Maybe<T> :
IEquatable<T>,
IEquatable<Maybe<T>>
where T : notnull
{
public T Value;
public bool HasValue;
public bool HasNoValue;
}
Functions
Bind
Bind calls the given function if the result is in success state and return the new result.
Tap
Tap calls the given function if the result is in success state and returns the same result.
Compensate
Compensate for failed result by calling the given function.
Ensure
Ensure calls the given function if the result is in success state. If the function returns false, the attached error is returned.
Map
Map calls the given function if the result is in success state.
The return value is wrapped in Result
as success.
Combine
Combine combines multiple Result
objects. It will return a Result
with all the errors if any of the Result
objects have failed.
If all the errors are of type ValidationError
, then it will return a ValidationError
with all the errors.
Otherwise it will return an AggregatedError
ParallelAsync
Parallel runs multiple tasks in parallel and returns multiple tasks. BindAsync
will await all the task and call the given function.
Finally
Finally unwraps the Result
and returns the success value or the error.
Maybe
Maybe states if it contains a value or not. It has the following methods:
- HasValue - returns true if it has a value.
- HasNoValue - returns true if it does not have a value.
- Value - returns the value if it has a value. Otherwise
InvalidOperationException
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- T4.Build (>= 0.2.4)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on FunctionalDdd.RailwayOrientedProgramming:
Package | Downloads |
---|---|
FunctionalDdd.FluentValidation
Convert fluent validation errors to FunctionalDdd Validation errors. |
|
FunctionalDdd.Asp
These extension methods are used to convert the ROP Result object to ActionResult. If the Result is in a failed state, it returns the corresponding HTTP error code. |
|
FunctionalDdd.CommonValueObjects
To avoid passing around strings, it is recommended to use RequiredString to obtain strongly typed properties. The source code generator will automate the implementation process. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.0-alpha.55 | 37 | 11/22/2024 |
2.0.0-alpha.52 | 53 | 11/7/2024 |
2.0.0-alpha.48 | 43 | 11/2/2024 |
2.0.0-alpha.47 | 45 | 10/30/2024 |
2.0.0-alpha.44 | 102 | 10/18/2024 |
2.0.0-alpha.42 | 57 | 10/14/2024 |
2.0.0-alpha.39 | 73 | 6/27/2024 |
2.0.0-alpha.38 | 69 | 4/24/2024 |
2.0.0-alpha.33 | 68 | 4/17/2024 |
2.0.0-alpha.26 | 78 | 4/9/2024 |
2.0.0-alpha.21 | 80 | 4/1/2024 |
2.0.0-alpha.19 | 65 | 3/5/2024 |
2.0.0-alpha.18 | 69 | 2/28/2024 |
2.0.0-alpha.17 | 72 | 2/26/2024 |
2.0.0-alpha.15 | 81 | 1/30/2024 |
2.0.0-alpha.8 | 67 | 1/27/2024 |
2.0.0-alpha.6 | 101 | 1/5/2024 |
1.1.1 | 999 | 11/15/2023 |
1.1.0-alpha.32 | 112 | 11/2/2023 |
1.1.0-alpha.30 | 208 | 11/1/2023 |
1.1.0-alpha.28 | 99 | 10/28/2023 |
1.1.0-alpha.27 | 95 | 10/28/2023 |
1.1.0-alpha.24 | 78 | 10/20/2023 |
1.1.0-alpha.23 | 90 | 10/13/2023 |
1.1.0-alpha.21 | 101 | 10/1/2023 |
1.1.0-alpha.20 | 85 | 9/30/2023 |
1.1.0-alpha.19 | 100 | 9/30/2023 |
1.1.0-alpha.18 | 98 | 9/29/2023 |
1.1.0-alpha.17 | 81 | 9/22/2023 |
1.1.0-alpha.13 | 69 | 9/16/2023 |
1.1.0-alpha.4 | 142 | 6/9/2023 |
1.1.0-alpha.3 | 87 | 6/8/2023 |
1.0.1 | 1,186 | 5/12/2023 |
0.1.0-alpha.40 | 120 | 4/6/2023 |
0.1.0-alpha.39 | 121 | 4/3/2023 |
0.1.0-alpha.38 | 144 | 4/2/2023 |
0.1.0-alpha.37 | 123 | 3/31/2023 |
0.1.0-alpha.35 | 128 | 3/29/2023 |
0.1.0-alpha.34 | 109 | 3/28/2023 |
0.1.0-alpha.32 | 148 | 3/18/2023 |
0.1.0-alpha.30 | 133 | 3/11/2023 |
0.1.0-alpha.27 | 124 | 3/7/2023 |
0.1.0-alpha.24 | 130 | 2/15/2023 |
0.1.0-alpha.22 | 128 | 2/15/2023 |
0.1.0-alpha.20 | 136 | 2/13/2023 |
0.0.1-alpha.14 | 145 | 1/4/2023 |
0.0.1-alpha.4 | 134 | 12/30/2022 |