diff --git a/src/JacksonVeroneze.NET.Pagination/Cursor/Extensions/PageExtension.cs b/src/JacksonVeroneze.NET.Pagination/Cursor/Extensions/PageExtension.cs new file mode 100644 index 0000000..ec63b21 --- /dev/null +++ b/src/JacksonVeroneze.NET.Pagination/Cursor/Extensions/PageExtension.cs @@ -0,0 +1,17 @@ +namespace JacksonVeroneze.NET.Pagination.Cursor.Extensions; + +public static class PageExtension +{ + public static Page ToPage( + this ICollection source, + bool hasMore, + string? cursor) + where TType : class + { + ArgumentNullException.ThrowIfNull(source); + + PageInfo pageInfo = new(hasMore, cursor); + + return new Page(source, pageInfo); + } +} \ No newline at end of file diff --git a/src/JacksonVeroneze.NET.Pagination/JacksonVeroneze.NET.Pagination.csproj b/src/JacksonVeroneze.NET.Pagination/JacksonVeroneze.NET.Pagination.csproj index f5e95ca..c39c9f5 100644 --- a/src/JacksonVeroneze.NET.Pagination/JacksonVeroneze.NET.Pagination.csproj +++ b/src/JacksonVeroneze.NET.Pagination/JacksonVeroneze.NET.Pagination.csproj @@ -9,7 +9,7 @@ JacksonVeroneze.NET.Pagination https://github.com/jacksonveroneze/JacksonVeroneze.NET.Pagination JacksonVeroneze.NET.Pagination - Pacote utilizado para commons do EF. + Pacote utilizado para paginação. JacksonVeroneze.NET.Pagination JacksonVeroneze.NET.Pagination/blob/main/LICENSE Jackson Veroneze