db

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name       string
	Type       string
	NotNull    bool
	PrimaryKey bool
}

Column represents column info

func (*Column) ToErd

func (c *Column) ToErd() string

ToErd returns ERD formatted column

func (*Column) ToMermaid added in v0.4.0

func (c *Column) ToMermaid() string

ToMermaid returns Mermaid formatted column

type ForeignKey

type ForeignKey struct {
	FromColumn string
	ToTable    string
	ToColumn   string
}

ForeignKey represents foreign key info

type Index added in v0.1.0

type Index struct {
	Name    string
	Columns []string
	Unique  bool
}

Index represents index definition

func (*Index) ToErd added in v0.1.0

func (i *Index) ToErd() string

ToErd returns ERD formatted index

type Schema

type Schema struct {
	Tables []*Table
}

Schema represents schema info

func NewSchema

func NewSchema(tables []*Table) *Schema

NewSchema returns a new Schema instance

func (*Schema) Subset

func (s *Schema) Subset(tableName string, distance int) *Schema

Subset returns subset of a schema

func (*Schema) ToErd

func (s *Schema) ToErd(showIndex bool) string

ToErd returns ERD formatted schema

func (*Schema) ToMermaid added in v0.4.0

func (s *Schema) ToMermaid(showComment bool) string

ToMermaid returns Mermaid formatted table

type SchemaExplorer

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

SchemaExplorer represents schema explorer

func NewSchemaExplorer

func NewSchemaExplorer(schema *Schema) *SchemaExplorer

NewSchemaExplorer returns a new SchemaExplorer instance

func (*SchemaExplorer) Explore

func (e *SchemaExplorer) Explore(tableName string, distance int) []string

Explore returns surrounding tables from table

type Table

type Table struct {
	Name        string
	Columns     []*Column
	ForeignKeys []*ForeignKey
	Indexes     []*Index
}

Table represents table info

func (*Table) GetNonPrimaryKeyColumns

func (t *Table) GetNonPrimaryKeyColumns() []*Column

GetNonPrimaryKeyColumns returns Non-Primary key columns

func (*Table) GetPrimaryKeyColumns

func (t *Table) GetPrimaryKeyColumns() []*Column

GetPrimaryKeyColumns returns Primary key columns

func (*Table) ToErd

func (t *Table) ToErd(showIndex bool) string

ToErd returns ERD formatted table

func (*Table) ToMermaid added in v0.4.0

func (t *Table) ToMermaid(showComment bool) string

ToMermaid returns Mermaid formatted table

type UndirectedGraph

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

UndirectedGraph represents undirected graph

func NewUndirectedGraph

func NewUndirectedGraph() *UndirectedGraph

NewUndirectedGraph returns a new UndirectedGraph instance

func (*UndirectedGraph) GetRowColumns

func (g *UndirectedGraph) GetRowColumns(row string) []string

GetRowColumns returns columns of row

func (*UndirectedGraph) PutSymmetric

func (g *UndirectedGraph) PutSymmetric(row string, col string, value bool)

PutSymmetric put value to symmetric matrix

Jump to

Keyboard shortcuts

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