sqlread

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sqlread reads what a SQL statement a script writes does to tables, from its text alone: the tables it writes and by which verb, the tables it reads, the schema a table name is in, and whether a name carries a part the script computes ({its source}). The script flow graph and an application's diagram read statements through it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasHole

func HasHole(names []string) bool

HasHole reports whether any name carries a computed part.

func SchemaOf

func SchemaOf(table string) string

SchemaOf is the schema a table name written in SQL is in: its qualifier, or public for an unqualified name, which is where an application database's search path finds it. A three-part name's middle part is the schema.

func TablesIn

func TablesIn(sql string) []string

TablesIn lists the tables a rendered SQL statement reads. A computed part of a name is kept as {its source}, so "warehouse.public.{t}" is reported as that rather than dropped or guessed.

Types

type Write

type Write struct{ Verb, Table string }

Write is one table a statement writes, with the verb it writes it by.

func LastWrite

func LastWrite(sql string) (Write, bool)

LastWrite is the write a card names for a statement: the statement's own target, which follows any its common table expressions write.

func WritesOf

func WritesOf(sql string) []Write

WritesOf is every table a statement writes, in the order it names them: the target of a statement that starts with its verb, or, for one that starts with WITH, each common table expression's target and the target of the statement that follows them.

Jump to

Keyboard shortcuts

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