{"id":37143207,"url":"https://github.com/maxmcd/sqinn-go","last_synced_at":"2026-01-14T16:48:34.810Z","repository":{"id":312396439,"uuid":"1047127502","full_name":"maxmcd/sqinn-go","owner":"maxmcd","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-29T19:41:08.000Z","size":5233,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-11T03:15:26.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxmcd.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-29T19:34:23.000Z","updated_at":"2025-08-29T19:36:09.000Z","dependencies_parsed_at":"2025-08-30T10:41:44.822Z","dependency_job_id":"bed91082-9181-4730-904b-1041c9f15f21","html_url":"https://github.com/maxmcd/sqinn-go","commit_stats":null,"previous_names":["maxmcd/sqinn-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maxmcd/sqinn-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fsqinn-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fsqinn-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fsqinn-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fsqinn-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmcd","download_url":"https://codeload.github.com/maxmcd/sqinn-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmcd%2Fsqinn-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28426489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T16:48:34.082Z","updated_at":"2026-01-14T16:48:34.805Z","avatar_url":"https://github.com/maxmcd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![Sqinn](logo.png \"Sqinn\")\n\n[![GoDoc Reference](https://pkg.go.dev/badge/github.com/cvilsmeier/sqinn-go/v2)](http://godoc.org/github.com/cvilsmeier/sqinn-go/v2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/cvilsmeier/sqinn-go)](https://goreportcard.com/report/github.com/cvilsmeier/sqinn-go)\n[![Build Status](https://github.com/cvilsmeier/sqinn-go/actions/workflows/linux.yml/badge.svg)](https://github.com/cvilsmeier/sqinn-go/actions/workflows/linux.yml)\n[![Build Status](https://github.com/cvilsmeier/sqinn-go/actions/workflows/windows.yml/badge.svg)](https://github.com/cvilsmeier/sqinn-go/actions/workflows/windows.yml)\n[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](http://unlicense.org/)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\nSqinn-Go is a Go (Golang) library for accessing SQLite databases without cgo.\nIt uses Sqinn \u003chttps://github.com/cvilsmeier/sqinn\u003e under the hood.\nIt starts Sqinn as a child process (`os/exec`) and communicates with\nSqinn over stdin/stdout/stderr. The Sqinn child process then does the SQLite\nwork.\n\nIf you want SQLite but do not want cgo, Sqinn-Go can be a solution.\n\n\u003e [!NOTE]\n\u003e This work is sponsored by Monibot - Easy Server and Application Monitoring.\n\u003e Try out Monibot at [https://monibot.io](https://monibot.io?ref=sqinn-go).\n\u003e It's free.\n\n\nUsage\n------------------------------------------------------------------------------\n\n```bash\ngo get -u github.com/cvilsmeier/sqinn-go/v2\n```\n\n```go\nimport (\n\t\"fmt\"\n\t\"github.com/cvilsmeier/sqinn-go/v2\"\n)\n\nfunc main() {\n\t// Launch sqinn, close when done.\n\tsq := sqinn.MustLaunch(sqinn.Options{\n\t\tDb: \":memory:\", // use a transient in-memory database\n\t})\n\tdefer sq.Close()\n\t// Create a table, cleanup when done\n\tsq.MustExecSql(\"CREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, name TEXT)\")\n\tdefer sq.MustExecSql(\"DROP TABLE users\")\n\t// Insert users\n\tsq.MustExecParams(\"INSERT INTO users (id, name) VALUES (?, ?)\", 3, 2, []sqinn.Value{\n\t\tsqinn.Int32Value(1), sqinn.StringValue(\"Alice\"),\n\t\tsqinn.Int32Value(2), sqinn.StringValue(\"Bob\"),\n\t\tsqinn.Int32Value(3), sqinn.StringValue(\"Carol\"),\n\t})\n\t// Query users\n\trows := sq.MustQueryRows(\n\t\t\"SELECT id, name FROM users WHERE id \u003e= ? ORDER BY id\",\n\t\t[]sqinn.Value{sqinn.Int32Value(0)},      // query parameters\n\t\t[]byte{sqinn.ValInt32, sqinn.ValString}, // fetch id as int, name as string\n\t)\n\tfor _, values := range rows {\n\t\tfmt.Printf(\"user id=%d, name=%s\\n\", values[0].Int32, values[1].String)\n\t}\n\t// Output:\n\t// user id=1, name=Alice\n\t// user id=2, name=Bob\n\t// user id=3, name=Carol\n}\n```\n\nFor usage examples, see `examples` directory.\n\n\nBuilding\n------------------------------------------------------------------------------\n\nThe library includes a prebuilt embedded build of sqinn for linux_amd64 and\nwindows_amd64.\n\nIf you do not want to use a prebuilt sqinn binary, you can compile sqinn\nyourself. See \u003chttps://github.com/cvilsmeier/sqinn\u003e for instructions.\nYou must then specify the path to sqinn like so:\n\n```go\nsq := sqinn.MustLaunch(sqinn.Options{\n\tSqinn: \"/path/to/sqinn\",\n})\n```\n\n\nPros and Cons\n------------------------------------------------------------------------------\n\n### Advantages\n\n- No need to have gcc installed on development machines.\n- Go cross compilation works.\n- Faster build speed than cgo (1s vs 3s for sample program).\n- Smaller binary size than cgo (2MB vs 10MB for sample program).\n\n\n### Disadvantages\n\n- No built-in connection pooling.\n- Sqinn-Go is not a Golang `database/sql` Driver.\n- Sqinn covers only a subset of SQLite's C APIs.\n\n\nPerformance\n------------------------------------------------------------------------------\n\nPerformance tests show that, for many use-cases, Sqinn-Go performance is better\nthan cgo solutions.\n\nSee \u003chttps://github.com/cvilsmeier/go-sqlite-bench\u003e for details.\n\n\nTesting\n------------------------------------------------------------------------------\n\nSqinn-Go comes with a large set of automated unit tests. Follow these steps to\nexecute all tests on linux/amd64 or windows/amd64:\n\nGet and test Sqinn-Go\n\n```bash\ngo mod init test\ngo get -v -u github.com/cvilsmeier/sqinn-go/v2\ngo test github.com/cvilsmeier/sqinn-go/v2\n```\n\n\nCheck test coverage\n\n```bash\ngo test github.com/cvilsmeier/sqinn-go/v2 -coverprofile=cover.out\ngo tool cover -html=cover.out\n```\n\nTest coverage is ~ 90% (as of August 2025)\n\n\nDiscussion\n------------------------------------------------------------------------------\n\n### Go without cgo\n\nSqinn-Go is Go without cgo, as it does not use cgo, nor does it depend on third-party\ncgo packages. However, Sqinn-Go has a runtime dependency on Sqinn, which is a\nprogram written in C. Sqinn has to be installed separately on each machine\nwhere a Sqinn-Go application is executing. For this to work, Sqinn has to be\ncompiled for every target platform. As an alternative, pre-built Sqinn binaries\nfor common platforms are included in sqinn-go or can be downloaded from the\nSqinn releases page \u003chttps://github.com/cvilsmeier/sqinn/releases\u003e.\n\n\n### No database/sql driver\n\nDatabase/sql is Go's default abstraction layer for SQL databases. It is widely\nused and there are many third-party packages built on top of it. Sqinn-Go does\nnot implement the database/sql interfaces. The reason is that the sql package\nprovides low-level function calls to prepare statements, bind parameters, fetch\ncolumn values, and so on. Sqinn could do that, too. But, since for every\nfunction call, Sqinn-Go has to make a inter-process communication\nrequest/response roundtrip to a sqinn child process, this would be very slow.\nInstead, Sqinn-Go provides higher-level Exec/Query interfaces that should be\nused in favor of low-level fine-grained functions.\n\n\n### Concurrency\n\nSqinn/Sqinn-Go performs well in non-concurrent as well as concurrent settings,\nas shown in the performance section. However, a single Sqinn instance\nis inherently single-threaded, requests are served one-after-another.\n\nIf you want true concurrency at the database level, you can spin up multiple\nSqinn instances. You may even implement a connection pool. But be aware that\nwhen accessing a SQLite database concurrently, the dreaded SQLITE_BUSY error\nmight occur. The PRAGMA busy_timeout might help to avoid SQLITE_BUSY errors.\n\n\n\nChangelog\n------------------------------------------------------------------------------\n\n### v2.1.0\n\n- bind and scan functions for converting go types to sqinn values and back\n\n\n### v2.0.2\n\n- better prebuilts (gzip and build constraints)\n\n\n### v2.0.1\n\n- ValXy const is now byte (was untyped)\n\n\n### v2.0.0\n\n- Major Version 2 (streaming protocol, less memory, faster)\n- Include prebuilt sqinn v2.0.0 (SQLite v3.50.4 (2025-07-30))\n\n\n### v1.2.0 (2023-10-05)\n\n- Added marshalling benchmark\n- Removed 'pure Go' claim\n- Removed travis build\n- Added github workflow with sqinn v1.1.27\n- Updated min. go version 1.19\n- Updated samples\n\n\n### v1.1.2 (2021-05-27)\n\n- Fixed negative int32 marshalling\n\n\n### v1.1.1 (2021-03-27)\n\n- Added more docs for Values\n- Added example for handling NULL values\n- Added example for sqlite specialties\n\n\n### v1.1.0 (2020-06-14)\n\n- Use IEEE 745 encoding for float64 values, needs sqinn v1.1.0 or higher.\n\n\n### v1.0.0 (2020-06-10)\n\n- First version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmcd%2Fsqinn-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmcd%2Fsqinn-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmcd%2Fsqinn-go/lists"}