Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateOffset ¶
CalculateOffset calculates `OFFSET` value for query.
Types ¶
type Database ¶
func (Database) ExecuteQuery ¶ added in v0.0.3
ExecuteQuery is dedicated to `INSERT`, `UPDATE` and `DELETE` queries. Prefer this if you are 100% sure that the query arguments are SQL Injection free. It is a fast operation as it issues a single network round-trip (`Query`). The query string must be prepared with `fmt.Sprintf` function using appropriate formatters.
fmt.Sprintf(`INSERT INTO table (name, age, active) VALUES (%q, %d, %t)`)
func (Database) PreparedQuery ¶ added in v0.0.3
PreparedQuery is dedicated to `INSERT`, `UPDATE` and `DELETE` queries. Prefer this if you are not 100% sure that the query arguments are SQL Injection free. It is a slow operation as it triples the number of network round-trips (`Prepare`, `Execute` and `Close`). The query must use `?` placeholders.
`INSERT INTO table (name, age, active) VALUES (?, ?, ?)`