input

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Overview

Package input reads SQL statements from a stream and hands them to a runner one at a time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Input

func Input(ctx context.Context, r io.Reader, fn func(ctx context.Context, input string) error, opts ...Option) error

Input reads statements from r until EOF or ctx is cancelled.

Statements are split at top-level semicolons using the SQL lexer, so a semicolon inside a string literal or a comment does not end a statement, and a statement may span lines. In interactive mode a failing statement is reported and the loop continues; otherwise the first error ends the run so a script fails fast.

Types

type Option

type Option func(*option)

Option configures Input.

func Interactive added in v0.2.2

func Interactive(v bool) Option

Interactive forces terminal behaviour on or off: a prompt is shown and an error does not end the session. When unset, it is on exactly when the reader is a terminal.

func NoDelimeter

func NoDelimeter(v bool) Option

NoDelimeter strips the trailing `;` before a statement is run, for drivers such as Oracle that reject it.

Jump to

Keyboard shortcuts

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