{"id":13489941,"url":"https://github.com/glebarez/sqlite","last_synced_at":"2025-03-28T05:31:26.799Z","repository":{"id":37668005,"uuid":"432813333","full_name":"glebarez/sqlite","owner":"glebarez","description":"The pure-Go SQLite driver for GORM","archived":false,"fork":true,"pushed_at":"2024-06-12T23:44:04.000Z","size":361,"stargazers_count":619,"open_issues_count":20,"forks_count":40,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T03:35:28.158Z","etag":null,"topics":["driver","golang","gorm","gorm-driver","gorm-orm","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"go-gorm/sqlite","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glebarez.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}},"created_at":"2021-11-28T20:07:15.000Z","updated_at":"2024-10-31T03:00:38.000Z","dependencies_parsed_at":"2023-10-15T17:15:20.955Z","dependency_job_id":null,"html_url":"https://github.com/glebarez/sqlite","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebarez%2Fsqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebarez%2Fsqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebarez%2Fsqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebarez%2Fsqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glebarez","download_url":"https://codeload.github.com/glebarez/sqlite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978200,"owners_count":20703675,"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":["driver","golang","gorm","gorm-driver","gorm-orm","sqlite","sqlite3"],"created_at":"2024-07-31T19:00:38.281Z","updated_at":"2025-03-28T05:31:26.096Z","avatar_url":"https://github.com/glebarez.png","language":"Go","readme":"![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/glebarez/fb4d23f63d866b3e1e58b26d2f5ed01f/raw/badge-gorm-tests.json)\n![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/glebarez/fb4d23f63d866b3e1e58b26d2f5ed01f/raw/badge-sqlite-version.json)\n\u003cbr\u003e[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fglebarez%2Fsqlite\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=baidu.svg\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n# Pure-Go SQLite driver for GORM\nPure-go (without cgo) implementation of SQLite driver for [GORM](https://gorm.io/)\u003cbr\u003e\u003cbr\u003e\nThis driver has SQLite embedded, you don't need to install one separately.\n\n# Usage\n\n```go\nimport (\n  \"github.com/glebarez/sqlite\"\n  \"gorm.io/gorm\"\n)\n\ndb, err := gorm.Open(sqlite.Open(\"sqlite.db\"), \u0026gorm.Config{})\n```\n\n### In-memory DB example\n```go\ndb, err := gorm.Open(sqlite.Open(\":memory:\"), \u0026gorm.Config{})\n```\n\n### Foreign-key constraint activation\nForeign-key constraint is disabled by default in SQLite. To activate it, use connection URL parameter:\n```go\ndb, err := gorm.Open(sqlite.Open(\":memory:?_pragma=foreign_keys(1)\"), \u0026gorm.Config{})\n```\nMore info: [https://www.sqlite.org/foreignkeys.html](https://www.sqlite.org/foreignkeys.html)\n\n# FAQ\n## How is this better than standard GORM SQLite driver?\nThe [standard GORM driver for SQLite](https://github.com/go-gorm/sqlite) has one major drawback: it is based on a [Go-bindings of SQLite C-source](https://github.com/mattn/go-sqlite3) (this is called [cgo](https://go.dev/blog/cgo)). This fact imposes following restrictions on Go developers:\n- to build and run your code, you will need a C compiler installed on a machine\n- SQLite has many features that need to be enabled at compile time (e.g. [json support](https://www.sqlite.org/json1.html)). If you plan to use those, you will have to include proper build tags for every ```go``` command to work properly (```go run```, ```go test```, etc.).\n- Because of C-compiler requirement, you can't build your Go code inside tiny stripped containers like (golang-alpine)\n- Building on GCP is not possible because Google Cloud Platform does not allow gcc to be executed.\n\n**Instead**, this driver is based on pure-Go implementation of SQLite (https://gitlab.com/cznic/sqlite), which is basically an original SQLite C-source AST, translated into Go! So, you may be sure you're using the original SQLite implementation under the hood.\n\n## Is this tested good ?\nYes, The CI pipeline of this driver employs [whole test base](https://github.com/go-gorm/gorm/tree/master/tests) of GORM, which includes more than **12k** tests (see badge on the page-top). Testing is run against latest major releases of Go:\n- 1.18\n- 1.19\n\nIn following environments:\n- Linux\n- Windows\n- MacOS\n\n## Is it fast?\nWell, it's slower than CGo implementation, but not terribly. See the [bechmark of underlying pure-Go driver vs CGo implementation](https://github.com/glebarez/go-sqlite/tree/master/benchmark).\n\n## Included features\n-  JSON1 (https://www.sqlite.org/json1.html)\n-  Math functions (https://www.sqlite.org/lang_mathfunc.html)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglebarez%2Fsqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglebarez%2Fsqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglebarez%2Fsqlite/lists"}