1 Star 0 Fork 1

suzd/go-sqlite3-sqlcipher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
extension.go 810 Bytes
一键复制 编辑 原始数据 按行查看 历史
suzd 提交于 2025-02-22 14:50 +08:00 . gitee.com/wefuture/go-sqlite3-sqlcipher
package main
import (
"database/sql"
"fmt"
"gitee.com/wefuture/go-sqlite3-sqlcipher"
"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)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wefuture/go-sqlite3-sqlcipher.git
git@gitee.com:wefuture/go-sqlite3-sqlcipher.git
wefuture
go-sqlite3-sqlcipher
go-sqlite3-sqlcipher
v1.0.1

搜索帮助