3 ms·
> SQL I'm working on an arel-esque fluent SQL generator now: https://github.com/lann/squirrel https://github.com/lann/squirrel I'll release it once I'm a litt
by lann 13y ago
> SQL
I'm working on an arel-esque fluent SQL generator now: https://github.com/lann/squirrel https://github.com/lann/squirrel
I'll release it once I'm a little more confident in the interface. Currently you can do things like this:
rows, err :=
Select("col").
From("tab").
Where("x = ?", 1).
RunWith(db).Query()
- rckclmbr 13y agoHonest question... how is this different from, say: rows, err := db.execute("SELECT col FROM tab WHERE x = ?", 1);
- lann 13y agoPrimarily because you can reuse partial queries and add conditional where clauses more easily. There are other features I haven't shown here as well, like building an IN expression with placeholders from a slice.
- mercurial 13y agoIt's harder to shoot yourself in the foot by mistyping SELECT, for instance, and it's clearly more composable.
- wc- 13y ago> I'll release it once I'm a little more confident in the interface. Release it now! I've said the same thing in the past about some code I was working on. Add a little readme, explicitly say it is a work in progress, and get it out there. At the very least the rush of publicizing something will push your drive to work on this codebase, and you might even gain some contributors. I'd rather use a repo that is obviously a work in progress but has active contributions from the creator over some more 'complete' but stagnant repo any day.