1 Star 0 Fork 0

suzd/go-sqlcipher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 884 Bytes
一键复制 编辑 原始数据 按行查看 历史
suzd 提交于 2025-03-11 09:45 +08:00 . gitee.com/suzd2025/go-sqlcipher
package main
import (
"database/sql"
"fmt"
"log"
sqlite3 "gitee.com/suzd2025/go-sqlcipher"
)
func main() {
sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
return conn.CreateModule("github", &githubModule{})
},
})
db, err := sql.Open("sqlite3_with_extensions", ":memory:")
if err != nil {
log.Fatal(err)
}
defer db.Close()
_, err = db.Exec("create virtual table repo using github(id, full_name, description, html_url)")
if err != nil {
log.Fatal(err)
}
rows, err := db.Query("select id, full_name, description, html_url from repo")
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
var id, fullName, description, htmlURL string
rows.Scan(&id, &fullName, &description, &htmlURL)
fmt.Printf("%s: %s\n\t%s\n\t%s\n\n", id, fullName, description, htmlURL)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/suzd2025/go-sqlcipher.git
git@gitee.com:suzd2025/go-sqlcipher.git
suzd2025
go-sqlcipher
go-sqlcipher
v1.5.1

搜索帮助