Documentation
¶
Index ¶
- func BuildDelete(d dialect.Dialect, table introspect.Table, row map[string]any) string
- func BuildInsert(d dialect.Dialect, table introspect.Table, row map[string]any) string
- func SummaryComment(cmd string, rows, tables int, forward bool) string
- func WritePlan(w io.Writer, cmd string, forward bool, schema introspect.Schema, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDelete ¶
BuildDelete renders a single DELETE that targets one row by its primary key. Primary-key column order follows table.PrimaryKey, and composite keys are matched with an AND conjunction. Callers must ensure the table has a primary key (extract.Walk rejects tables without one). Row keys must match Column.Name.
func BuildInsert ¶
BuildInsert renders a single INSERT statement for the given row. Columns marked IsGenerated are skipped because the database rejects writes that target them. Column order follows table.Columns to keep output stable. Row keys must match Column.Name; missing keys are treated as NULL.
func SummaryComment ¶
SummaryComment returns the leading SQL comment that prefixes normal (non-plan) output, e.g., "-- subset clone: 3 rows from 3 tables, parents-first".
func WritePlan ¶
func WritePlan( w io.Writer, cmd string, forward bool, schema introspect.Schema, counts map[string]int, order []string, seed string, elapsed time.Duration, )
WritePlan renders the --plan summary: a header with table/row totals and one line per collected table, each showing its row count and a representative shortest FK path from the seed. cmd is "clone" or "delete"; forward selects the traversal direction (clone walks to FK parents, delete to referencing children). order lists the collected tables in emit order; counts holds each table's row count.
Types ¶
This section is empty.