{"id":19624243,"url":"https://github.com/logoove/sqlite","last_synced_at":"2025-04-28T05:31:33.489Z","repository":{"id":38225850,"uuid":"376226178","full_name":"logoove/sqlite","owner":"logoove","description":"一个不使用cgo的database/sql标准sqlite3驱动,原驱动`modernc.org/sqlite`,但是速度不行,搬迁过来,这样就能在goframe和其他框架中使用.","archived":false,"fork":false,"pushed_at":"2023-10-16T06:37:38.000Z","size":15308,"stargazers_count":66,"open_issues_count":2,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-18T15:34:29.828Z","etag":null,"topics":["sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logoove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-12T07:10:39.000Z","updated_at":"2024-06-14T07:45:30.000Z","dependencies_parsed_at":"2024-06-18T15:39:40.481Z","dependency_job_id":null,"html_url":"https://github.com/logoove/sqlite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logoove%2Fsqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logoove%2Fsqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logoove%2Fsqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logoove%2Fsqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logoove","download_url":"https://codeload.github.com/logoove/sqlite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224096915,"owners_count":17255189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sqlite","sqlite3"],"created_at":"2024-11-11T11:37:23.510Z","updated_at":"2024-11-11T11:37:24.295Z","avatar_url":"https://github.com/logoove.png","language":"Go","readme":"# sqlite\n\n一个不使用cgo的database/sql标准sqlite3驱动,原驱动`modernc.org/sqlite`,增加对goframe2+框架的支持(最新goframe已经有不使用cgo驱动了).\n\n### 常规使用方法\n~~~\n\t\"github.com/jmoiron/sqlx\"\n\t_ \"github.com/logoove/sqlite\"\n    \n  var db *sqlx.DB\n\ntype User struct {\n\tId   int64  `db:\"id\"`\n\tName string `db:\"name\"`\n}\n\nfunc main() {\n\tdb, _ = sqlx.Open(\"sqlite\", \"./db.db\")\n\tdb.Exec(`CREATE TABLE users (\n  \"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT,\n  \"name\" char(15) NOT NULL\n);`)\n\tdb.Exec(`insert into users(name) values(?)`, \"李白\")\n\tdb.Exec(`insert into users(name) values(?)`, \"白居易\")\n\tvar rows []User\n\tdb.Select(\u0026rows, \"SELECT id,name FROM users ORDER BY id\")\n\tfmt.Println(rows)\n}  \n~~~\n\n### goframe2.0+使用方法\n在manifeat/config/config.yaml配置\n~~~\n_ \"github.com/logoove/go/sqlite\" //加在internal\\cmd\\cmd.go文件中\n\n# 数据库连接配置\ndatabase:\n  default:\n    type: \"sqlite\"\n    link: \"./resource/db.db\" #数据库路径根据自己的填写\n    debug:  true\n~~~\n\n### goframe2.0+ 非配置\n~~~\n\"github.com/gogf/gf/v2/database/gdb\"\n_ \"github.com/logoove/go/sqlite\" //这是专门用于goframe2.0以上的驱动, 单文件写在main.go中, mvc架构放在internal\\cmd\\cmd.go\n\ndb, _ := gdb.New(gdb.ConfigNode{\n\t\tLink: \"sqlite::@file(xx/db.db)\", //支持相对路径和绝对路径\n\t})\ndb.SetDebug(true) //可以显示sql语句\nlist, _ := db.Model(\"zanzhu\").Where(\"1=1\").Order(\"id desc\").Limit(page, pagesize).All() //简单查询, 可以不用建立数据表结构体\n\n~~~\n### 更新日志\n2023-10-09 v1.16.1 修复对goframe支持,更新到gitlab.com/cznic/sqlite最新1.26同步.对于goframe2以下版本可能不能使用.\n\n2022-3-22 v1.15.3 新增win amd64编译,解决内存泄漏问题.\n\n2021-11-3 v1.13.0 新增更多系统编译,支持sqlite 3.36.0","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogoove%2Fsqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogoove%2Fsqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogoove%2Fsqlite/lists"}