mysql

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mysql provides database schema introspection for MySQL and MariaDB databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inspector

type Inspector struct {
	DB *sql.DB
}

Inspector implements schema introspection for MySQL / MariaDB.

func New

func New(db *sql.DB) *Inspector

New returns a new MySQL Inspector.

func (*Inspector) ColumnMeta added in v0.1.7

func (i *Inspector) ColumnMeta(ctx context.Context, tableName string) ([]model.ColumnMeta, error)

func (*Inspector) Columns

func (i *Inspector) Columns(ctx context.Context, tableName string) ([]string, error)

Columns returns column descriptors for tableName in "name|type|pk" format, where pk is "1" for primary-key columns, "0" otherwise.

func (*Inspector) Indexes added in v0.1.7

func (i *Inspector) Indexes(ctx context.Context, tableName string) ([]model.Index, error)

func (*Inspector) Relations

func (i *Inspector) Relations(ctx context.Context, tableName string) ([]string, error)

Relations returns foreign-key descriptors for tableName in "fromCol -> targetTable.targetCol" format.

func (*Inspector) Tables

func (i *Inspector) Tables(ctx context.Context) ([]string, error)

Tables returns all user-defined table names in the current database.

Jump to

Keyboard shortcuts

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