Hey all,

I'm working with a legacy database and looks like our best strategy for 
managing things is going to be using Datasets and Database directly (lots 
of non-trivial queries for the domain/business objects) and I'd like to do 
something like  `DB.fetch(big_sql_query, map_to: EntityClass) { 
|entity_instance| ... }`  or `DB[sql].all_mapped_to(EntityClass) # [ 
entity_instance, entity_instance ... ]`. Something along those lines, open 
to any and all suggestions. I did some searching and didn't find exactly 
what I was looking for as an existing extension or in the core Sequel 
documentation. 

The closest I've found in this realm (and used before) is from the 
github-ds gem where you can map complex SQL to ActiveRecord instances - 
https://github.com/github/github-ds/blob/312b43b3d96bb376b87bc5e05045c306f40f2623/lib/github/sql.rb#L208-L222
 


I'm thinking I've either missed the documentation or this is something 
trivial to implement as a Sequel extension. In the end this will probably 
end up being a light-weight Repository pattern build around Sequel.

thoughts?

-a different jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to