dbinfo

package
v0.0.0-...-c243d67 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(cfg Config) error

Types

type Config

type Config struct {
	VTParams mysql.ConnParams
}

type DBHelper

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

func NewDBHelper

func NewDBHelper(vtParams *mysql.ConnParams) *DBHelper

func (*DBHelper) GetConnection

func (dbh *DBHelper) GetConnection() (*mysql.Conn, func(), error)

type ForeignKey

type ForeignKey struct {
	ColumnName           string `json:"columnName"`
	ConstraintName       string `json:"constraintName"`
	ReferencedTableName  string `json:"referencedTableName"`
	ReferencedColumnName string `json:"referencedColumnName"`
}

type Index

type Index struct {
	Name      string
	Columns   []string `json:"columns"`
	NonUnique bool     `json:"nonUnique,omitempty"`
}

type Info

type Info struct {
	FileType        string            `json:"fileType"`
	Tables          []*TableInfo      `json:"tables"`
	GlobalVariables map[string]string `json:"globalVariables"`
}

func Get

func Get(cfg Config) (*Info, error)

func Load

func Load(fileName string) (*Info, error)

type PrimaryKey

type PrimaryKey struct {
	Columns []string `json:"columns"`
}

type TableColumn

type TableColumn struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	KeyType    string `json:"keyType,omitempty"`
	IsNullable bool   `json:"isNullable,omitempty"`
	Extra      string `json:"extra,omitempty"`
}

type TableInfo

type TableInfo struct {
	Name        string         `json:"name"`
	Rows        int            `json:"rows"`
	Columns     []*TableColumn `json:"columns"`
	PrimaryKey  *PrimaryKey    `json:"primaryKey,omitempty"`
	Indexes     []*Index       `json:"indexes,omitempty"`
	ForeignKeys []*ForeignKey  `json:"foreignKeys,omitempty"`
}

Jump to

Keyboard shortcuts

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