7 Star 5 Fork 0

Gitee 极速下载 / go-sqlite3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/mattn/go-sqlite3
克隆/下载
extension.go 798 Bytes
一键复制 编辑 原始数据 按行查看 历史
mattn 提交于 2013-09-12 09:40 . rename
package main
import (
"database/sql"
"fmt"
"github.com/mattn/go-sqlite3"
"log"
)
func main() {
sql.Register("sqlite3_with_extensions",
&sqlite3.SQLiteDriver{
Extensions: []string{
"sqlite3_mod_regexp",
},
})
db, err := sql.Open("sqlite3_with_extensions", ":memory:")
if err != nil {
log.Fatal(err)
}
defer db.Close()
// Force db to make a new connection in pool
// by putting the original in a transaction
tx, err := db.Begin()
if err != nil {
log.Fatal(err)
}
defer tx.Commit()
// New connection works (hopefully!)
rows, err := db.Query("select 'hello world' where 'hello world' regexp '^hello.*d$'")
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
var helloworld string
rows.Scan(&helloworld)
fmt.Println(helloworld)
}
}
1
https://gitee.com/mirrors/go-sqlite3.git
git@gitee.com:mirrors/go-sqlite3.git
mirrors
go-sqlite3
go-sqlite3
v1.13.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891