Masterminds/squirrel: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 15: Line 15:


=Programming Model=
=Programming Model=
<syntaxhighlight lang='go'>
// Get a database/sql database handle
dbHandle = getDbHandle()
</syntaxhighlight>
<code>getDbHandle()</code> can be implemented as shown in: {{Internal|PostgreSQL_Support_in_Go#With_database/sql_API_and_a_pgx_Driver|Connect to a PostgreSQL Database with <tt>database/sql</tt> API and a pgx Driver}}

Revision as of 17:32, 31 May 2024

External

Internal

Overview

Squirrel is a fluent SQL generator for Go. It helps build SQL queries from composable parts representing the SQL SELECT query clauses: SELECT, FROM, JOIN, WHERE, etc. and also other DML statements.

Installation

go get github.com/Masterminds/squirrel

Programming Model

// Get a database/sql database handle
dbHandle = getDbHandle()

getDbHandle() can be implemented as shown in:

Connect to a PostgreSQL Database with database/sql API and a pgx Driver