Documentation
¶
Overview ¶
Package duckdb is a booba-shim that exposes upstream @duckdb/duckdb-wasm to Go-WASM programs as a database/sql driver named "duckdb" and a native Arrow API.
Under GOOS=js, importing this package for side effects registers the driver:
import _ "github.com/NimbleMarkets/booba-shim/duckdb"
db, err := sql.Open("duckdb", "my-data.duckdb?access_mode=read_only")
On any other GOOS, every public entry point returns ErrNonJSPlatform so host-side test binaries can import the package without panicking.
The page must load web/duckdb/duckdb-shim.js (via go tool booba-shim-assets) before the WASM main runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNonJSPlatform = errors.New("booba-shim/duckdb: only usable under GOOS=js")
ErrNonJSPlatform is returned by every entry point when the package is imported under a GOOS other than js. It exists so that consumers can use build-tag patterns like:
//go:build !js package data import _ "github.com/duckdb/duckdb-go/v2" //go:build js package data import _ "github.com/NimbleMarkets/booba-shim/duckdb"
and still run host-side `go test ./...` without panicking on missing JS globals.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct{}
Client is the native (non-database/sql) handle to a DuckDB-Wasm connection. Under GOOS!=js it is an opaque, non-functional placeholder.
type Error ¶
type Error struct {
// Message is the human-readable error from DuckDB or the bridge.
Message string
// Code is set if DuckDB-Wasm exposed a structured code; "" otherwise.
Code string
}
Error is the typed error returned for failures originating in the JS bridge (DuckDB-Wasm errors, connection issues, etc.).