mirror of
https://github.com/miniflux/v2.git
synced 2024-09-06 11:29:21 +02:00
34 lines
423 B
Go
34 lines
423 B
Go
|
// +build go1.10
|
||
|
|
||
|
package pq_test
|
||
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/lib/pq"
|
||
|
)
|
||
|
|
||
|
func ExampleNewConnector() {
|
||
|
name := ""
|
||
|
connector, err := pq.NewConnector(name)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
return
|
||
|
}
|
||
|
db := sql.OpenDB(connector)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
return
|
||
|
}
|
||
|
defer db.Close()
|
||
|
|
||
|
// Use the DB
|
||
|
txn, err := db.Begin()
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
return
|
||
|
}
|
||
|
txn.Rollback()
|
||
|
}
|