database

package
v0.0.0-...-9a553cb Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	Name         string
	Type         string
	IsNullable   bool
	DefaultValue string
	Comment      string
	IsPrimaryKey bool
	IsAutoIncr   bool
}

ColumnInfo 列信息

type Database

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

Database 数据库连接管理器

func NewDatabase

func NewDatabase(dsn string) (*Database, error)

NewDatabase 创建新的数据库连接

func (*Database) Close

func (d *Database) Close() error

Close 关闭数据库连接

func (*Database) GetTableInfo

func (d *Database) GetTableInfo(tableName string) (*TableInfo, error)

GetTableInfo 获取表结构信息

func (*Database) ListTables

func (d *Database) ListTables() ([]string, error)

ListTables 列出所有表

type TableInfo

type TableInfo struct {
	Name        string
	Comment     string
	Columns     []ColumnInfo
	PrimaryKeys []string
}

TableInfo 表结构信息

func (*TableInfo) ToParserTableInfo

func (ti *TableInfo) ToParserTableInfo() *parser.TableInfo

ToParserTableInfo 将数据库表结构信息转换为解析器的表信息格式

Jump to

Keyboard shortcuts

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