Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add row mappers. #354

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add row mappers. #354

wants to merge 2 commits into from

Conversation

jasperblues
Copy link

  • Add a row mapper and result set extract protocol that allow functional transformation of the result set to the domain model type.

These methods simplify the implementation of a DAO (data access object):

  • Reduces boiler plate code
  • Multiple methods listByFoo, listByBar, findById, etc can use the common mapping method.

Analogous to Spring JDBC RowMapper and ResultSetExtractor:

@ccgus
Copy link
Owner

ccgus commented Apr 3, 2015

Thanks for doing this- I'll have to take a closer look at this and see if it's something that'll fit in FMDB or not. I'm trying to keep it super slim as possible these days, though I really should have some sort of "neat stuff to have" folder of add-ons.

@jasperblues
Copy link
Author

You're welcome. For me this small addition addresses something that is something missing. But its up to you whether its appropriate for the fmdb core (I understand your concerns). If not, I'll create a separate pod outside the project and add it in that way. In fact this would be an interesting experiment to see how many people star it, as an indication of general utility. . . . . or, as you say, it could be an add-on sub-spec.

@azplanlos
Copy link

Maybe you also want to have a look on SISQLiteContext - a class extending FMDB by CoreData like convenience functions. Tried to keep it lightweight and suitable for big data sources and still you can access the core db underneath by utilizing FMDB.

@jasperblues
Copy link
Author

@azplanlos Thanks, will take a look! But this particular change is just a very small change - a handful of lines of code to map a result set to a model object. When implementing a Data Access Object (DAO) we'd want this for findBy, listBy, etc methods. We could simply define a method to do this, but it adds some structure - functional style mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants