mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-01 20:19:33 +08:00
- 引入 third_party/highgo-pq 作为 HighGo 专用驱动实现 - 调整驱动注册与连接入口,避免覆盖 postgres 驱动 - 保持 PG 数据源行为不变并补充接入文档
31 lines
393 B
Go
31 lines
393 B
Go
//go:build go1.10
|
|
// +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)
|
|
defer db.Close()
|
|
|
|
// Use the DB
|
|
txn, err := db.Begin()
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
txn.Rollback()
|
|
}
|