sqlite

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sqlite is the sqlite database plugin. Scripts import it as scriptling.sqlite and get a relational API shared with the sql plugin:

import scriptling.sqlite as sqlite
conn = sqlite.connect("app.db")
conn.execute("create table t (id integer primary key, name text)")
conn.execute("insert into t (name) values (?)", "ada")
rows = conn.query("select * from t where name = ?", "ada")
conn.close()

The database file must fall inside the host's allowed paths (":memory:" is always allowed). The same library serves two modes: an external plugin process (plugins/sqlite/cmd) and compiled-in registration (build tag plugin_sqlite) — Build is the single registration for both.

Index

Constants

View Source
const ConnectSource = `def connect(path=":memory:", timeout_ms=5000):
    return Connection(path, timeout_ms=timeout_ms)
`

ConnectSource is the scriptling-source wrapper for connect() used in external plugin mode, where a Go function cannot return an instance over the wire: it constructs the Connection class through the plugin object protocol instead. In compiled-in mode the Go builtin below is used.

View Source
const Description = "SQLite embedded database (pure Go)"

Description is the plugin metadata description.

Variables

This section is empty.

Functions

func Build

func Build(policy plugin.PolicySource) *object.Library

Build returns the scriptling.sqlite library. policy is read at call time so an external plugin sees the policy its handshake delivered (the handshake always precedes the first function call).

func RegisterInProcess

func RegisterInProcess(registrar interface {
	RegisterLibrary(*object.Library)
	RegisterScriptLibrary(name string, script string) error
}, policy *plugin.Policy)

RegisterInProcess registers both halves for embedders and tests: the native twin library and the scriptling.sqlite script module.

func ScriptModule

func ScriptModule() string

ScriptModule is the user-facing scriptling.sqlite module for compiled-in registration: the Connection wrapper (with get_orm) plus the shared ORM kit, importing the native twin.

Types

This section is empty.

Directories

Path Synopsis
Command sqlite serves the sqlite database plugin over the Scriptling plugin protocol (stdio JSON-RPC).
Command sqlite serves the sqlite database plugin over the Scriptling plugin protocol (stdio JSON-RPC).

Jump to

Keyboard shortcuts

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