Documentation
¶
Overview ¶
Package infer finds relationships between tables that the schema does not declare, and checks them against sampled values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Verify ¶
func Verify(ctx context.Context, q Querier, ids *IDValues, schema *model.Schema, rels []model.Relationship, timeout time.Duration) ([]model.Relationship, []string)
Verify looks the sampled child values up in the parent table and grades every unverified relationship: confirmed when at least 90% exist, likely from 50%, weak below. Weak naming guesses are dropped.
Types ¶
type IDValues ¶
type IDValues struct {
// contains filtered or unexported fields
}
IDValues keeps a few distinct sampled values of the columns that may point at other tables.
type Inferrer ¶
type Inferrer struct {
Schema *model.Schema
IDs *IDValues
Prefixes []string // table prefixes such as "wp_"
Known []model.Relationship // from presets
}
Inferrer proposes relationships for one schema.
func (*Inferrer) Relationships ¶
func (in *Inferrer) Relationships() []model.Relationship
Relationships returns the declared foreign keys, the preset relationships and those guessed from naming. Only declared ones are marked as such; the rest still need Verify.
Click to show internal directories.
Click to hide internal directories.