Documentation
¶
Overview ¶
Package introspect implements the `gco introspect` command for generating schema files from an existing database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectProvider ¶
DetectProvider infers the database provider from a connection string.
func GenerateSchema ¶
GenerateSchema produces .gcorm schema text from introspected table info.
func WriteSchemaFile ¶
WriteSchemaFile writes generated schema to a file.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
Name string
DataType string
IsNullable bool
IsPrimaryKey bool
IsUnique bool
Default string
Comment string
}
ColumnInfo describes a single database column.
type ForeignKeyInfo ¶
type ForeignKeyInfo struct {
Name string
Columns []string
RefTable string
RefColumns []string
OnDelete string
OnUpdate string
}
ForeignKeyInfo describes a foreign key relationship.
type TableInfo ¶
type TableInfo struct {
Name string
Schema string // database schema/namespace
Columns []ColumnInfo
Indexes []IndexInfo
FKs []ForeignKeyInfo
}
TableInfo represents a database table discovered during introspection.
Click to show internal directories.
Click to hide internal directories.