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 ¶
ReadSQL resolves SQL input from three sources in priority order:
- expr — the -e / --expression flag value (inline SQL).
- args — a single positional argument treated as a file path.
- 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.