-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from josdeweger/dev
Merge to master v2.4.0
- Loading branch information
Showing
19 changed files
with
174 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>2.3.0</Version> | ||
<Version>2.4.0</Version> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using CSharpFunctionalExtensions; | ||
|
||
namespace SheetToObjects.Core | ||
{ | ||
internal static class MaybeExtensions | ||
{ | ||
public static Maybe<T> OnEmpty<T>(this Maybe<T> maybe, Func<T> resultFunc) | ||
{ | ||
if(maybe.HasNoValue) | ||
return Maybe<T>.From(resultFunc()); | ||
|
||
return maybe; | ||
} | ||
|
||
public static Maybe<TResult> OnValue<T, TResult>(this Maybe<T> maybe, Func<T, TResult> resultFunc) | ||
{ | ||
if(maybe.HasNoValue) | ||
return Maybe<TResult>.None; | ||
|
||
return Maybe<TResult>.From(resultFunc(maybe.Value)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using CSharpFunctionalExtensions; | ||
|
||
namespace SheetToObjects.Lib.Extensions | ||
{ | ||
internal static class ResultExtensions | ||
{ | ||
public static Result<TResult, TError> OnValidationSuccess<TResult, TError>(this Result<TResult, TError> result, Func<TResult, TResult> func) | ||
where TError : class | ||
{ | ||
if (result.IsSuccess) | ||
return Result.Ok<TResult, TError>(func(result.Value)); | ||
|
||
return Result.Fail<TResult, TError>(result.Error); | ||
} | ||
|
||
public static Result<TResult, TError> OnValidationFailure<TResult, TError>(this Result<TResult, string> result, Func<string, TError> func) | ||
where TError : class | ||
{ | ||
if (result.IsFailure) | ||
return Result.Fail<TResult, TError>(func(result.Error)); | ||
|
||
return Result.Ok<TResult, TError>(result.Value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace SheetToObjects.Lib | ||
{ | ||
public class ParsedModel<TModel> where TModel : new() | ||
{ | ||
public TModel Value { get; } | ||
public int RowIndex { get; } | ||
|
||
public ParsedModel(TModel value, int rowIndex) | ||
{ | ||
Value = value; | ||
RowIndex = rowIndex; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.