dbmigrate

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dbmigrate provides tools for converting between plaintext SQLite and SQLCipher-encrypted databases.

SQLCipher support requires building with CGO and a SQLite library that includes SQLCipher (e.g., via system libsqlcipher). When built with the standard mattn/go-sqlite3 amalgamation, PRAGMA key is a no-op and encryption is unavailable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptToPlaintext

func DecryptToPlaintext(dbPath, passphrase string, cipherPageSize int) error

DecryptToPlaintext converts a SQLCipher-encrypted DB back to a plaintext SQLite database.

func IsEncrypted

func IsEncrypted(dbPath string) bool

IsEncrypted checks whether a database file is encrypted by inspecting the magic header. A standard SQLite file starts with "SQLite format 3\000"; an encrypted file does not.

func IsSQLCipherAvailable

func IsSQLCipherAvailable() bool

IsSQLCipherAvailable checks whether the SQLite driver supports SQLCipher operations.

func MigrateToEncrypted

func MigrateToEncrypted(dbPath, passphrase string, cipherPageSize int) error

MigrateToEncrypted converts a plaintext SQLite DB to a SQLCipher-encrypted database. The original file is backed up and securely deleted after successful migration.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL