Skip to content

sqlite: add Conn.Serialize wrapping sqlite3_serialize#12

Merged
anacrolix merged 1 commit into
go-llsqlite:masterfrom
theraphim:serialize
Apr 23, 2026
Merged

sqlite: add Conn.Serialize wrapping sqlite3_serialize#12
anacrolix merged 1 commit into
go-llsqlite:masterfrom
theraphim:serialize

Conversation

@theraphim
Copy link
Copy Markdown
Collaborator

Returns the complete contents of a named database as a Go-owned []byte, freeing the SQLite-allocated buffer before returning.

This is entirely vibe coded. It's also something very trivial which helps doing backups if you have a service which uses sqlite, this way you can, for example, expose a /backup/db endpoint and then do curl localhost/backup/db | rustic backup --stdin.

Returns the complete contents of a named database as a Go-owned []byte,
freeing the SQLite-allocated buffer before returning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@anacrolix
Copy link
Copy Markdown
Contributor

I'd argue about just exposing a pointer to the serialized database and letting the caller decide to allocate it but: 1) It's serialized on demand so that's not possible and 2) It matches the sqlite API here so it's a win.

@anacrolix
Copy link
Copy Markdown
Contributor

Possibly the C helpers used aren't the most modern, but that's a separate issue. Nice vibe code lol.

@anacrolix anacrolix merged commit 297aa8e into go-llsqlite:master Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants