sqlitedb

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sqlitedb reads rowid tables of SQLite files (with committed WAL frames) in pure Go and serves them to go-rpmdb as a database/sql driver.

Index

Constants

View Source
const DriverName = "sqlite"

DriverName is the database/sql driver name go-rpmdb opens rpm sqlite databases with.

Variables

View Source
var ErrCorrupt = errors.New("sqlitedb: corrupt database")

ErrCorrupt reports a structurally invalid database file.

View Source
var ErrReadOnly = errors.New("sqlitedb: only SELECT <columns> FROM <table> is supported")

ErrReadOnly is returned for any statement other than a plain column projection.

Functions

func DecodeRecord

func DecodeRecord(rec []byte) ([]any, error)

DecodeRecord decodes an SQLite record into int64, float64, string, []byte, or nil values.

func Register

func Register() bool

Register installs the driver under DriverName unless another owns the name, and reports whether ours is registered.

Types

type Cursor

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

Cursor iterates the rows of one table b-tree in rowid order.

func (*Cursor) Err

func (c *Cursor) Err() error

Err reports the first error encountered by Next.

func (*Cursor) Next

func (c *Cursor) Next() (int64, []byte, bool)

Next returns the next row's rowid and record payload.

type DB

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

DB is an open read-only database snapshot.

func Open

func Open(path string) (*DB, error)

Open opens the database at path and overlays the committed frames of path-wal when present.

func (*DB) Close

func (db *DB) Close() error

Close releases the files.

func (*DB) Rows

func (db *DB) Rows(t *Table, columns []string) (*RowIter, error)

Rows returns an iterator over the named columns of t.

func (*DB) Scan

func (db *DB) Scan(t *Table, columns []string, fn func(rowid int64, vals []any) error) error

Scan calls fn for every row of t with the values of the named columns.

func (*DB) Table

func (db *DB) Table(name string) (*Table, error)

Table looks up a table by case-insensitive name.

type Driver

type Driver struct{}

Driver is a read-only database/sql driver over this package's file reader.

func (Driver) Open

func (Driver) Open(name string) (driver.Conn, error)

Open opens the database file named by name.

type RowIter

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

RowIter yields projected rows.

func (*RowIter) Err

func (r *RowIter) Err() error

Err reports the iteration error, if any.

func (*RowIter) Next

func (r *RowIter) Next() (int64, []any, bool)

Next returns the next row.

type Table

type Table struct {
	Name     string
	Root     uint32
	Columns  []string
	RowidCol int
	// contains filtered or unexported fields
}

Table describes one rowid table from the schema.

Jump to

Keyboard shortcuts

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