subset

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetSubsetQueries

func SetSubsetQueries(graph *Graph) error

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent(id int, componentGraph map[int][]*Edge, tables map[int]*entries.Table) *Component
type ComponentLink struct {
	// contains filtered or unexported fields
}
func NewComponentLink(idx int, c *Component) *ComponentLink

type CondensedEdge

type CondensedEdge struct {
	// contains filtered or unexported fields
}

func NewCondensedEdge

func NewCondensedEdge(id int, from, to *ComponentLink, originalEdge *Edge) *CondensedEdge

type CycleEdge

type CycleEdge struct {
	// contains filtered or unexported fields
}

func NewCycleEdge

func NewCycleEdge(id int, from, to string, tables []*entries.Table) *CycleEdge

type Edge

type Edge struct {
	// contains filtered or unexported fields
}

func NewEdge

func NewEdge(id, idx int, isNullable bool, a *TableLink, b *TableLink) *Edge

func (*Edge) From added in v0.2.1

func (e *Edge) From() *TableLink

func (*Edge) ID added in v0.2.1

func (e *Edge) ID() int

func (*Edge) Index added in v0.2.1

func (e *Edge) Index() int

func (*Edge) IsNullable added in v0.2.1

func (e *Edge) IsNullable() bool

func (*Edge) To added in v0.2.1

func (e *Edge) To() *TableLink

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph - the graph representation of the DB tables. Is responsible for finding the cycles in the graph and searching subset Path for the tables

func NewGraph

func NewGraph(
	ctx context.Context, tx pgx.Tx, tables []*entries.Table, vr []*domains.VirtualReference,
) (*Graph, error)

NewGraph creates a new graph based on the provided tables by finding the references in DB between them

func (*Graph) GetCycledTables

func (g *Graph) GetCycledTables() (res [][]string)

func (*Graph) GetCycles

func (g *Graph) GetCycles() [][]*Edge

func (*Graph) GetSortedTablesAndDependenciesGraph

func (g *Graph) GetSortedTablesAndDependenciesGraph() ([]toolkit.Oid, map[toolkit.Oid][]toolkit.Oid)

GetSortedTablesAndDependenciesGraph - returns the sorted tables in topological order and the dependencies graph where the key is the table OID and the value is the list of table OIDs that depend on the key table

func (*Graph) GetTables added in v0.2.1

func (g *Graph) GetTables() []*entries.Table

func (*Graph) ReversedGraph added in v0.2.1

func (g *Graph) ReversedGraph() [][]*Edge

func (*Graph) Tables added in v0.2.1

func (g *Graph) Tables() []*entries.Table

type Key

type Key struct {
	Name       string
	Expression string
}

func NewKeysByColumn

func NewKeysByColumn(cols []string) []*Key

func NewKeysByReferencedColumn

func NewKeysByReferencedColumn(cols []*domains.ReferencedColumn) []*Key

func (*Key) GetKeyReference

func (k *Key) GetKeyReference(t *entries.Table) string

type Path

type Path struct {
	// contains filtered or unexported fields
}

func NewPath

func NewPath(rootVertex int) *Path

func (*Path) AddEdge

func (p *Path) AddEdge(e *CondensedEdge, scopeId int) int

AddEdge adds the edge to the path and return it scope

func (*Path) AddVertex

func (p *Path) AddVertex(v int)

func (*Path) Len

func (p *Path) Len() int

type ScopeEdge

type ScopeEdge struct {
	// contains filtered or unexported fields
}
type TableLink struct {
	// contains filtered or unexported fields
}
func NewTableLink(idx int, t *entries.Table, keys []*Key, polymorphicExprs []string) *TableLink

func (*TableLink) Index added in v0.2.1

func (tl *TableLink) Index() int

func (*TableLink) Keys added in v0.2.1

func (tl *TableLink) Keys() []*Key

func (*TableLink) PolymorphicExprs added in v0.2.1

func (tl *TableLink) PolymorphicExprs() []string

func (*TableLink) Table added in v0.2.1

func (tl *TableLink) Table() *entries.Table

Jump to

Keyboard shortcuts

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