sqlscript

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sqlscript executes a multi-statement SQL script one statement at a time.

Executing a whole script in a single Exec is a convenience of some SQLite drivers only. The cgosqlite backend selected for TinyGo builds runs the first statement and silently ignores the rest, so every caller must split first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, executor Executor, script string) error

Exec runs every statement in script in order.

func Split

func Split(script string) []string

Split divides a SQL script into individual statements. Semicolons inside string literals, quoted identifiers, comments, and CREATE TRIGGER bodies do not terminate a statement.

Types

type Executor

type Executor interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

Executor is the subset of *sql.DB and *sql.Tx used to run a script.

Jump to

Keyboard shortcuts

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