Squirrel is not an ORM.
Squirrel helps you build SQL queries from composable parts:
users := Select("*").From("users")
active := users.Where(Eq{"deleted_at": nil})
sql, args, err := active.ToSql()
sql == "SELECT * FROM users WHERE deleted_at IS NULL"Squirrel can also execute queries directly:
stooges := users.Where(Eq{"username": []string{"moe", "larry", "curly", "shemp"}})
three_stooges := stooges.Limit(3)
rows, err := three_stooges.RunWith(db).Query()
// Behaves like:
rows, err := db.Query("SELECT * FROM users WHERE username IN (?,?,?,?) LIMIT 3",
"moe", "larry", "curly", "shemp")Squirrel makes conditional query building a breeze:
if len(q) > 0 {
users = users.Where("name LIKE ?", fmt.Sprint("%", q, "%"))
}Squirrel wants to make your life easier:
// StmtCache caches Prepared Stmts for you
dbCache := NewStmtCache(db)
// StatementBuilder keeps your syntax neat
mydb := StatementBuilder.RunWith(dbCache)
select_users := mydb.Select("*").From("users")Builder is released under the MIT License.

