FAQ
You'll find this group is largely hostile to the chained
blah().blah().blah() syntax style of library you're using, hwich is what
Frank is probably referring to.

Not everyone feels that way though; interesting library, I'll give it a try
this week and see how it fares against real-world-problems~

~
Doug.
On Sunday, December 8, 2013 9:32:32 PM UTC+8, Marcus Holmes wrote:

Fair enough. I found I was endlessly writing the same code to set up
transactions, prepare statements, etc. and wanted a cleaner, DRY-er way to
do it.

I don't see the code style being different? apart from the yoda
comparisons, that is. What's the difference that's sticking out?

On Sunday, December 8, 2013 6:24:17 PM UTC+8, Frank Schröder wrote:

I don't see the benefit. Sure, you'll save a couple of lines of code but
at the expense of introducing a code style that's different than the rest.
Most of the SQL boilerplate I've had in my code was in the row mapper
function which does the Scan and constructs an object. Other than that the
plain database/sql commands are simple and readable enough IMHO.
On Friday, December 6, 2013 4:25:39 PM UTC+11, Marcus Holmes wrote:

repo is here: https://bitbucket.org/marcus_holmes/sqlcommand

it allows database commands to be chained together and the error dealt
with at the end, reducing the amount of boilerplate that needs to be written

e.g.:

sc := scf.NewCommand("SELECT bar, qux FROM foo WHERE id=?')
if
!sc.Begin().Prepare().QueryRow(idValue).Scan(&resultBar,&resultQux).CloseAll().IsValid(){
//bad thing happened
}

any comments welcome, especially suggestions for improvements.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 21 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 6, '13 at 5:25a
activeDec 9, '13 at 11:44a
posts21
users8
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase