Documentation
¶
Overview ¶
Package schema provides database schema discovery and introspection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldSkipTable ¶
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
Name string
DataType string
IsNullable bool
DefaultValue sql.NullString
MaxLength sql.NullInt64
IsPrimaryKey bool
IsForeignKey bool
IsUnique bool
Comment sql.NullString
}
ColumnInfo contains information about a table column.
type ComputedField ¶
type ComputedField struct {
Name string `yaml:"name"`
Label string `yaml:"label"`
ShowInList bool `yaml:"show_in_list"`
Lambda string `yaml:"lambda"`
}
ComputedField represents a computed field with lambda function.
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
Discovery handles database schema discovery.
func NewDiscovery ¶
NewDiscovery creates a new Discovery instance.
func (*Discovery) GenerateModule ¶
func (d *Discovery) GenerateModule(tableName string) (*ModuleConfig, error)
GenerateModule generates a module configuration from table info.
func (*Discovery) GetTableInfo ¶
GetTableInfo retrieves detailed information about a table.
type Features ¶
type Features struct {
Search bool `yaml:"search"`
ExportCSV bool `yaml:"export_csv"`
Pagination bool `yaml:"pagination"`
SoftDelete bool `yaml:"soft_delete"`
BulkActions bool `yaml:"bulk_actions"`
}
Features represents module features.
type Field ¶
type Field struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Label string `yaml:"label"`
Required bool `yaml:"required,omitempty"`
PrimaryKey bool `yaml:"primary_key,omitempty"`
ShowInList bool `yaml:"show_in_list"`
ShowInForm bool `yaml:"show_in_form"`
Searchable bool `yaml:"searchable,omitempty"`
LookupTable string `yaml:"lookup_table,omitempty"`
LookupKey string `yaml:"lookup_key,omitempty"`
LookupDisplay string `yaml:"lookup_display,omitempty"`
MaxLength int `yaml:"max_length,omitempty"`
Format string `yaml:"format,omitempty"`
}
Field represents a module field.
type Filter ¶
type Filter struct {
Field string `yaml:"field"`
Type string `yaml:"type"`
Label string `yaml:"label"`
Source string `yaml:"source,omitempty"`
Query string `yaml:"query,omitempty"`
Options []Option `yaml:"options,omitempty"`
}
Filter represents a module filter.
type ForeignKeyInfo ¶
ForeignKeyInfo contains foreign key relationship information.
type ModuleConfig ¶
type ModuleConfig struct {
Module struct {
Name string `yaml:"name"`
Table string `yaml:"table"`
DisplayName string `yaml:"display_name"`
Description string `yaml:"description"`
} `yaml:"module"`
Fields []Field `yaml:"fields"`
ComputedFields []ComputedField `yaml:"computed_fields,omitempty"`
Features Features `yaml:"features"`
Filters []Filter `yaml:"filters,omitempty"`
}
ModuleConfig represents the generated module configuration.
type TableInfo ¶
type TableInfo struct {
Name string
Columns []ColumnInfo
PrimaryKey string
ForeignKeys []ForeignKeyInfo
Indexes []IndexInfo
HasValidID bool
HasDeleted bool
}
TableInfo contains information about a database table.