skip to content
Alvin Lucillo

Squirrel to generate SQL

/ 1 min read

💻 Tech

Recently, I learned about this Go package that generates SQL statement: squirrel. What I like about it is it’s lightweight and does the job — SQL query generation. Note that it’s not an ORM.

import (
	"fmt"

	sq "github.com/Masterminds/squirrel"
)

func main() {
	qry, _, _ := sq.Select("name", "age").From("person").ToSql()

	fmt.Println(qry)
}