consumers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 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 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

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 New

func New() *Index

New returns an empty Index.

func (*Index) AddColumn

func (x *Index) AddColumn(table, column string, site Site)

AddColumn records that site depends on table.column (and on table).

func (*Index) AddRelation

func (x *Index) AddRelation(table string, site Site)

AddRelation records that site references table.

func (*Index) Column

func (x *Index) Column(table, column string) []Site

Column lists the sites depending on table.column, in source order.

func (*Index) Columns

func (x *Index) Columns() []string

Columns lists the "table.column" keys with at least one site, sorted.

func (*Index) Len

func (x *Index) Len() int

Len is the number of indexed columns.

func (*Index) Merge

func (x *Index) Merge(o *Index)

Merge adds every site of o.

func (*Index) Relation

func (x *Index) Relation(table string) []Site

Relation lists the sites referencing table, in source order.

func (*Index) Relations

func (x *Index) Relations() []string

Relations lists the tables with at least one site, sorted.

func (*Index) String

func (x *Index) String() string

String renders the index as "table.column" lines with their sites indented.

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.

func (Site) String

func (s Site) String() string

Jump to

Keyboard shortcuts

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