vapor-community / pagination

Simple Vapor 3 Pagination
MIT License
64 stars 15 forks source link

Transform Closures (Or something like that) #11

Closed gperdomor closed 5 years ago

gperdomor commented 6 years ago

Motivation Behind Feature

Now, convert the results to other structs/public responses is not posible, for example, a common case is the User model which have sensitive data like password, confirmation token, even more, but that fields can't be returned in the response, so we need to create a PublicUser struct to exclude that fields

Feature Description Maybe a solution is to pass some kind of transform closure which can be used in the pagination process

anthonycastelli commented 6 years ago

I've been out of town for a while and haven't had much time to work on doing something like that. Originally I wanted to do something that conformed to a protocol and would allow easy transformation. My goal is still that, however, I haven't given it much thought to work on it since I've just been swamped. I'll be home in a couple of weeks and will be able to start thinking about some ideas again.

LinusGeffarth commented 5 years ago

@anthonycastelli so is this possible rn? From #12, I can't really tell how to do it...