wcdb

package
v1.6.19 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SQLITE_OK             = 0
	SQLITE_ROW            = 100
	SQLITE_DONE           = 101
	SQLITE_OPEN_READONLY  = 0x00000001
	SQLITE_OPEN_READWRITE = 0x00000002
	SQLITE_OPEN_CREATE    = 0x00000004
	SQLITE_BUSY           = 5
	SQLITE_LOCKED         = 6

	COL_INT   = 1
	COL_FLOAT = 2
	COL_TEXT  = 3
	COL_BLOB  = 4
	COL_NULL  = 5
)

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(dylibPath string) error

Bootstrap loads the WCDB dylib from the given absolute path.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func OpenPlain

func OpenPlain(dbPath string, writable bool) (*DB, error)

OpenPlain opens an unencrypted SQLite database with the bundled WCDB SQLite symbols. The caller must Bootstrap first. writable=false opens readonly.

func OpenWithEncKey

func OpenWithEncKey(dbPath, encKeyHex, saltHex string) (*DB, error)

OpenWithEncKey opens a WCDB-encrypted SQLite file using the raw-key path: encKeyHex is the 64-hex post-PBKDF2 enc_key (as harvested by `wxkey scan`) and saltHex is the 32-hex SQLCipher salt taken from the file's first 16 bytes. Skips PBKDF2 entirely; opening cost drops to a couple of HMACs.

func OpenWithEncKeyWritable

func OpenWithEncKeyWritable(dbPath, encKeyHex, saltHex string) (*DB, error)

func OpenWithKeyMap

func OpenWithKeyMap(dbPath string, keys map[string]string) (*DB, error)

OpenWithKeyMap opens dbPath after reading the SQLCipher salt from the file header (first 16 bytes) and looking up the matching enc_key in keys (salt-hex -> enc_key-hex). wechat-cli intentionally supports only this schema-2 raw-key path; missing salts must be fixed by refreshing wxkey's key map.

func OpenWithKeyMapWritable

func OpenWithKeyMapWritable(dbPath string, keys map[string]string) (*DB, error)

func (*DB) BackupTo

func (d *DB) BackupTo(dstPath string) error

BackupTo writes a plaintext SQLite snapshot of the opened database. Source may be encrypted; destination is opened without sqlite3_key_v2, so the backup lands as a normal unencrypted SQLite file. The final rename is atomic.

func (*DB) Close

func (d *DB) Close()

func (*DB) Exec

func (d *DB) Exec(sql string) error

func (*DB) ExecArgs

func (d *DB) ExecArgs(sql string, args ...any) error

func (*DB) Prepare

func (d *DB) Prepare(sql string) (*Stmt, error)

func (*DB) Query

func (d *DB) Query(sql string, args ...any) ([]Row, error)

type Row

type Row map[string]any

type Stmt

type Stmt struct {
	// contains filtered or unexported fields
}

func (*Stmt) Close

func (s *Stmt) Close()

func (*Stmt) Exec

func (s *Stmt) Exec(args ...any) error

Jump to

Keyboard shortcuts

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