{"id":18017167,"url":"https://github.com/ncruces/go-sqlite3","last_synced_at":"2025-05-15T07:05:11.991Z","repository":{"id":65496392,"uuid":"587772905","full_name":"ncruces/go-sqlite3","owner":"ncruces","description":"Go bindings to SQLite using wazero","archived":false,"fork":false,"pushed_at":"2025-05-14T00:10:49.000Z","size":34461,"stargazers_count":678,"open_issues_count":8,"forks_count":24,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-14T02:14:51.554Z","etag":null,"topics":["no-cgo","sqlite3","wasm","wazero"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/ncruces/go-sqlite3","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ncruces.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"custom":"https://www.paypal.com/donate?hosted_button_id=33P59ELZWGMK6"}},"created_at":"2023-01-11T14:54:42.000Z","updated_at":"2025-05-14T00:10:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a547c73-f9b5-464f-b8da-cb17336dd30b","html_url":"https://github.com/ncruces/go-sqlite3","commit_stats":{"total_commits":790,"total_committers":8,"mean_commits":98.75,"dds":0.06708860759493673,"last_synced_commit":"270efcb4affc660fbb6d5e71ff667b800c5ca191"},"previous_names":["ncruces/go-sqlite"],"tags_count":111,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-sqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-sqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-sqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncruces%2Fgo-sqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncruces","download_url":"https://codeload.github.com/ncruces/go-sqlite3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292040,"owners_count":22046426,"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":["no-cgo","sqlite3","wasm","wazero"],"created_at":"2024-10-30T04:21:31.193Z","updated_at":"2025-05-15T07:05:06.981Z","avatar_url":"https://github.com/ncruces.png","language":"Go","readme":"# Go bindings to SQLite using wazero\n\n[![Go Reference](https://pkg.go.dev/badge/image)](https://pkg.go.dev/github.com/ncruces/go-sqlite3)\n[![Go Report](https://goreportcard.com/badge/github.com/ncruces/go-sqlite3)](https://goreportcard.com/report/github.com/ncruces/go-sqlite3)\n[![Go Coverage](https://github.com/ncruces/go-sqlite3/wiki/coverage.svg)](https://github.com/ncruces/go-sqlite3/wiki/Test-coverage-report)\n\nGo module `github.com/ncruces/go-sqlite3` is a `cgo`-free [SQLite](https://sqlite.org/) wrapper.\\\nIt provides a [`database/sql`](https://pkg.go.dev/database/sql) compatible driver,\nas well as direct access to most of the [C SQLite API](https://sqlite.org/cintro.html).\n\nIt wraps a [Wasm](https://webassembly.org/) [build](embed/) of SQLite,\nand uses [wazero](https://wazero.io/) as the runtime.\\\nGo, wazero and [`x/sys`](https://pkg.go.dev/golang.org/x/sys) are the _only_ direct dependencies.\n\n### Getting started\n\nUsing the [`database/sql`](https://pkg.go.dev/database/sql) driver:\n```go\n\nimport \"database/sql\"\nimport _ \"github.com/ncruces/go-sqlite3/driver\"\nimport _ \"github.com/ncruces/go-sqlite3/embed\"\n\nvar version string\ndb, _ := sql.Open(\"sqlite3\", \"file:demo.db\")\ndb.QueryRow(`SELECT sqlite_version()`).Scan(\u0026version)\n```\n\n### Packages\n\n- [`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3)\n  wraps the [C SQLite API](https://sqlite.org/cintro.html)\n  ([example usage](https://pkg.go.dev/github.com/ncruces/go-sqlite3#example-package)).\n- [`github.com/ncruces/go-sqlite3/driver`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/driver)\n  provides a [`database/sql`](https://pkg.go.dev/database/sql) driver\n  ([example usage](https://pkg.go.dev/github.com/ncruces/go-sqlite3/driver#example-package)).\n- [`github.com/ncruces/go-sqlite3/embed`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/embed)\n  embeds a build of SQLite into your application.\n- [`github.com/ncruces/go-sqlite3/vfs`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs)\n  wraps the [C SQLite VFS API](https://sqlite.org/vfs.html) and provides a pure Go implementation.\n- [`github.com/ncruces/go-sqlite3/gormlite`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/gormlite)\n  provides a [GORM](https://gorm.io) driver.\n\n### Advanced features\n\n- [incremental BLOB I/O](https://sqlite.org/c3ref/blob_open.html)\n- [nested transactions](https://sqlite.org/lang_savepoint.html)\n- [custom functions](https://sqlite.org/c3ref/create_function.html)\n- [virtual tables](https://sqlite.org/vtab.html)\n- [custom VFSes](https://sqlite.org/vfs.html)\n- [online backup](https://sqlite.org/backup.html)\n- [JSON support](https://sqlite.org/json1.html)\n- [math functions](https://sqlite.org/lang_mathfunc.html)\n- [full-text search](https://sqlite.org/fts5.html)\n- [geospatial search](https://sqlite.org/geopoly.html)\n- [Unicode support](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/unicode)\n- [statistics functions](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/stats)\n- [encryption at rest](vfs/adiantum/README.md)\n- [many extensions](ext/README.md)\n- [custom VFSes](vfs/README.md#custom-vfses)\n- [and more…](embed/README.md)\n\n### Caveats\n\nThis module replaces the SQLite [OS Interface](https://sqlite.org/vfs.html)\n(aka VFS) with a [pure Go](vfs/) implementation,\nwhich has advantages and disadvantages.\nRead more about the Go VFS design [here](vfs/README.md).\n\nBecause each database connection executes within a Wasm sandboxed environment,\nmemory usage will be higher than alternatives.\n\n### Testing\n\nThis project aims for [high test coverage](https://github.com/ncruces/go-sqlite3/wiki/Test-coverage-report).\nIt also benefits greatly from [SQLite's](https://sqlite.org/testing.html) and\n[wazero's](https://tetrate.io/blog/introducing-wazero-from-tetrate/#:~:text=Rock%2Dsolid%20test%20approach)\nthorough testing.\n\nEvery commit is [tested](https://github.com/ncruces/go-sqlite3/wiki/Support-matrix) on\nLinux (amd64/arm64/386/riscv64/ppc64le/s390x), macOS (arm64/amd64),\nWindows (amd64), FreeBSD (amd64/arm64), OpenBSD (amd64), NetBSD (amd64/arm64),\nDragonFly BSD (amd64), illumos (amd64), and Solaris (amd64).\n\nThe Go VFS is tested by running SQLite's\n[mptest](https://github.com/sqlite/sqlite/blob/master/mptest/mptest.c).\n\n### Performance\n\nPerformance of the [`database/sql`](https://pkg.go.dev/database/sql) driver is\n[competitive](https://github.com/cvilsmeier/go-sqlite-bench) with alternatives.\n\nThe Wasm and VFS layers are also benchmarked by running SQLite's\n[speedtest1](https://github.com/sqlite/sqlite/blob/master/test/speedtest1.c).\n\n### Concurrency\n\nThis module behaves similarly to SQLite in [multi-thread](https://sqlite.org/threadsafe.html) mode:\nit is goroutine-safe, provided that no single database connection, or object derived from it,\nis used concurrently by multiple goroutines.\n\nThe [`database/sql`](https://pkg.go.dev/database/sql) API is safe to use concurrently,\naccording to its documentation.\n\n### FAQ, issues, new features\n\nFor questions, please see [Discussions](https://github.com/ncruces/go-sqlite3/discussions/categories/q-a).\n\nAlso, post there if you used this driver for something interesting\n([_\"Show and tell\"_](https://github.com/ncruces/go-sqlite3/discussions/categories/show-and-tell)),\nhave an [idea](https://github.com/ncruces/go-sqlite3/discussions/categories/ideas)…\n\nThe [Issue](https://github.com/ncruces/go-sqlite3/issues) tracker is for bugs,\nand features we're working on, planning to work on, or asking for help with.\n\n### Alternatives\n\n- [`modernc.org/sqlite`](https://pkg.go.dev/modernc.org/sqlite)\n- [`crawshaw.io/sqlite`](https://pkg.go.dev/crawshaw.io/sqlite)\n- [`github.com/mattn/go-sqlite3`](https://pkg.go.dev/github.com/mattn/go-sqlite3)\n- [`github.com/zombiezen/go-sqlite`](https://pkg.go.dev/github.com/zombiezen/go-sqlite)","funding_links":["https://www.paypal.com/donate?hosted_button_id=33P59ELZWGMK6"],"categories":["Database Drivers","Go","Data Integration Frameworks","数据库驱动程序"],"sub_categories":["Relational Database Drivers","关系数据库驱动程序"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncruces%2Fgo-sqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncruces%2Fgo-sqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncruces%2Fgo-sqlite3/lists"}