go-sqlbuilder
(unfinished) a very simple sql builder for golang.
TODO
-
dialect support for mysql/postgresql/sqlite etc... Only support mysql now. (escape character and placeholder were hard coded)
- (done) escape character (mysql:`) (postgres:") [
✔️ ] - placeholder for params binding (mysql:?) (postgres:$index)
- etc...
- (done) escape character (mysql:`) (postgres:") [
-
more statement support (group/having/join etc...)
-
more examples (you could find some examples in test file now)
-
more helpful usages
-
Long-term planning:
Maybe this package could be a micro ORM?Or add a simple scanner or DAO adapter?
I have already done a veeeeeery simple and crude demo but it's too simple.
In general, I hope this package as simple as possible. Waiting for above unitl I have enough free time (long after...).
Installation
go get -u github.com/DropFan/go-sqlbuilder
Usage (unfinished)
// TODO
Click here to get examples.
import (
builder "github.com/DropFan/go-sqlbuilder"
)
var (
b = builder.New()
q *Query
)
b.Select(fields...).
From("user").
Where(ageGT1, nameInNames).
And(sexEqFemale).
And().
Or(ageBetweenCond).
Or(nameEqCoder).
OrderBy(ageDesc, nameAsc).
Limit(0, 100)
q, err = b.Build()Contacts
Author: Tiger(DropFan)
Email: DropFan@Gmail.com
Wechat: DropFan
Telegram: DropFan

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
