sqlinput

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sqlinput resolves SQL text from the three input sources every SQL-consuming subcommand supports: an inline -e expression, a positional file argument, or standard input. The resolution logic lives here so validate, format, parse, and future subcommands share one implementation and one set of error messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSQL

func ReadSQL(expr string, args []string, stdin io.Reader) (string, error)

ReadSQL resolves SQL input from three sources in priority order:

  1. expr — the -e / --expression flag value (inline SQL).
  2. args — a single positional argument treated as a file path.
  3. stdin — standard input, read until EOF.

If expr is non-empty, args must be empty (returning an error otherwise). If both expr and args are empty, stdin is consumed. An error is returned when the resolved input is empty after trimming whitespace.

stdin is an io.Reader rather than *os.File so callers can inject a bytes.Buffer or strings.Reader in tests. The cobra command passes cmd.InOrStdin().

Types

This section is empty.

Jump to

Keyboard shortcuts

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