On Friday, October 28, 2016 at 2:33:53 PM UTC-7, Daniel Gollahon wrote: > > Hi. > > I've been using Sequel on a work project for a few months now and I > created a small extension locally for a `#one` method on Dataset. The idea > behind it is to do a LIMIT(2) query and then assert that exactly one result > was found and then return that. If 0 results or 2 results are returned, it > raises an error. I originally saw this idea in DataMapper or ROM (I don't > recall which) and find it very useful. It helps you check the assumptions > you've made about your query. Often when using `first!`, what I really want > is to know I got back the one and only possible result. It's also useful > for killing mutations (we use mutant <https://github.com/mbj/mutant> in > our codebase) and I feel like this could benefit others. > > I was wondering if you'd be interested in this as a feature and would > accept a pull request to add this to Sequel proper or as a packaged > extension. Here's a gist > <https://gist.github.com/dgollahon/1ca462ed2ed7460f7156940d97bf9f25> of > what I'm talking about. > > Thanks for all your hard work on Sequel! > - Daniel >
I don't think this is a good fit for shipping with Sequel, but I encourage you to package it as an external extension so that other users who may want it can easily use it. I'll be happy to link to such an extension on http://sequel.jeremyevans.net/plugins.html. If there are other Sequel users who have strong feelings for or against shipping this extension with Sequel, please reply to add your thoughts. 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 https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
