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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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