driver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package driver provides a lightweight database/sql driver for tinySQL.

The driver exposes tinySQL through the standard `database/sql` API and supports both in-memory and file-backed databases. Key features:

  • DSN formats: `mem://` and `file:/path/to/db.gob?options` (see `parseDSN`).
  • Optional Write-Ahead Log (WAL) and autosave for durability.
  • Reader/writer pools and simple MVCC-style snapshots for transactions.
  • Simple, safe placeholder binding: sequential `?` and numbered `$1`/`:1`.

Use `sql.Open("tinysql", dsn)` to create a connection. See `applyDSNOption` and `applyQueryOptions` for available DSN options and defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenInMemory added in v0.5.1

func OpenInMemory(tenant string) (*sql.DB, error)

OpenInMemory returns a *sql.DB backed by an in-memory tinySQL server. If tenant is empty the default tenant is used.

func SetDefaultDB

func SetDefaultDB(db *storage.DB)

SetDefaultDB allows external code to provide a storage.DB instance that will be used by the driver when opening connections. This is useful for embedding environments (WASM) that want to keep a reference to the underlying DB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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