schema

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldSkipTable

func ShouldSkipTable(tableName string) bool

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

func NewDiscovery(db *sql.DB, verbose bool) *Discovery

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

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

GetTableInfo retrieves detailed information about a table

func (*Discovery) GetTables

func (d *Discovery) GetTables() ([]string, error)

GetTables returns all user tables in the database

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

type ForeignKeyInfo struct {
	Column           string
	ReferencedTable  string
	ReferencedColumn string
}

ForeignKeyInfo contains foreign key relationship information

type IndexInfo

type IndexInfo struct {
	Name     string
	Columns  []string
	IsUnique bool
}

IndexInfo contains index 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 Option

type Option struct {
	Value string `yaml:"value"`
	Label string `yaml:"label"`
}

Option represents a filter option

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

Jump to

Keyboard shortcuts

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