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

FromRow : match field with column name rather than with position #41

Open
paul-r-ml opened this issue Jan 30, 2015 · 1 comment
Open

Comments

@paul-r-ml
Copy link

Hi Nurpax,

my current software uses large tables, and therefore FromRow instances are getting a bit hard to manage, with all these "field" that I must count.
I think it would be clearer if we had a "fieldNamed :: FromField a => String -> RowParser a" combinator, allowing me to match column by name rather than by its position in a request.

What do you think about that ?

Cheers,

@nurpax
Copy link
Owner

nurpax commented Mar 4, 2015

Hi @paul-r-ml, sorry for taking so long to reply, I was on holiday w/o access to a desktop machine.

I'm not sure this is something I'd like to add. I understand that this becomes tedious with a large number of result fields.. But fieldNamed feels like moving a part of the tuple selector from the SELECT a,b,c clause into the RowParser. A naive implementation (looking up a field based on the column name on each row result set) would also be pretty slow, and a faster implementation would mean rewriting a bunch of the field parser code.

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

No branches or pull requests

2 participants