Documentation
¶
Overview ¶
Package consumers indexes which Go statements depend on which relation columns: the side of a schema change a diff tool cannot see. The vet analyzer fills one Index per package (its analysis result); a migration reads the merged index to list what a DROP or a type change reaches, and to confirm nobody reads a column before it goes.
Index ¶
- type Index
- func (x *Index) AddColumn(table, column string, site Site)
- func (x *Index) AddRelation(table string, site Site)
- func (x *Index) Column(table, column string) []Site
- func (x *Index) Columns() []string
- func (x *Index) Len() int
- func (x *Index) Merge(o *Index)
- func (x *Index) Relation(table string) []Site
- func (x *Index) Relations() []string
- func (x *Index) String() string
- type Site
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index maps relations and their columns to the sites depending on them.
func (*Index) AddRelation ¶
AddRelation records that site references table.
type Site ¶
type Site struct {
Pos token.Position
// Owner is the package path and the declaration the statement belongs to
// ("app/orders.listOrders", "app/orders.(*Repo).Find"); the package path alone when
// the statement sits outside any declaration.
Owner string
}
Site is one place in Go source that depends on a column: the position of the reference inside the SQL template, and the declaration holding the statement.