On Wednesday, April 9, 2014 2:57:56 AM UTC-7, Luca Guidi wrote: > > Good morning all, > Is it possible to configure Sequel in order to use a custom dataset class. > > DB[:items].class # => CustomDataset >
DB.dataset_class = CustomDataset > > I'm writing an SQL adapter on top of Sequel, and I would like to normalize > the method signature for query methods (eg. where, order). > I could use delegators: > > require 'delegate' > > class CustomDataset < SimpleDelegator > end > > CustomDataset.new(DB[:items]).where(id: 23) > > But, it has some performance downsides: > 1. I assume (correct me if I'm wrong) that DB[:items] returns a dataset > from a registry, so it doesn't need to instantiate an object for every > access. > Incorrect, it does instantiate a new Dataset. Thanks, 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 http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
