Documentation
¶
Index ¶
- type LoadConfig
- type SaveConfig
- type SchemaEditor
- func (se *SchemaEditor) CreateColumn(schemaIndex, tableIndex int, name, dataType string, ...) *models.Column
- func (se *SchemaEditor) CreateSchema(name, description string) *models.Schema
- func (se *SchemaEditor) CreateTable(schemaIndex int, name, description string) *models.Table
- func (se *SchemaEditor) DeleteColumn(schemaIndex, tableIndex int, columnName string) bool
- func (se *SchemaEditor) DeleteSchema(schemaIndex int) bool
- func (se *SchemaEditor) DeleteTable(schemaIndex, tableIndex int) bool
- func (se *SchemaEditor) GetAllColumns(schemaIndex, tableIndex int) map[string]*models.Column
- func (se *SchemaEditor) GetAllSchemas() []*models.Schema
- func (se *SchemaEditor) GetAllTables() []*models.Table
- func (se *SchemaEditor) GetColumn(schemaIndex, tableIndex int, columnName string) *models.Column
- func (se *SchemaEditor) GetDatabase() *models.Database
- func (se *SchemaEditor) GetSchema(schemaIndex int) *models.Schema
- func (se *SchemaEditor) GetTable(schemaIndex, tableIndex int) *models.Table
- func (se *SchemaEditor) GetTablesInSchema(schemaIndex int) []*models.Table
- func (se *SchemaEditor) Run() error
- func (se *SchemaEditor) UpdateColumn(schemaIndex, tableIndex int, oldName, newName, dataType string, ...) bool
- func (se *SchemaEditor) UpdateSchema(schemaIndex int, name, owner, description string)
- func (se *SchemaEditor) UpdateTable(schemaIndex, tableIndex int, name, description string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadConfig ¶
LoadConfig holds the configuration for loading a database
type SaveConfig ¶
SaveConfig holds the configuration for saving a database
type SchemaEditor ¶
type SchemaEditor struct {
// contains filtered or unexported fields
}
SchemaEditor represents the interactive schema editor
func NewSchemaEditor ¶
func NewSchemaEditor(db *models.Database) *SchemaEditor
NewSchemaEditor creates a new schema editor
func NewSchemaEditorWithConfigs ¶
func NewSchemaEditorWithConfigs(db *models.Database, loadConfig *LoadConfig, saveConfig *SaveConfig) *SchemaEditor
NewSchemaEditorWithConfigs creates a new schema editor with load/save configurations
func (*SchemaEditor) CreateColumn ¶
func (se *SchemaEditor) CreateColumn(schemaIndex, tableIndex int, name, dataType string, isPrimaryKey, isNotNull bool) *models.Column
CreateColumn creates a new column and adds it to a table
func (*SchemaEditor) CreateSchema ¶
func (se *SchemaEditor) CreateSchema(name, description string) *models.Schema
CreateSchema creates a new schema and adds it to the database
func (*SchemaEditor) CreateTable ¶
func (se *SchemaEditor) CreateTable(schemaIndex int, name, description string) *models.Table
CreateTable creates a new table and adds it to a schema
func (*SchemaEditor) DeleteColumn ¶
func (se *SchemaEditor) DeleteColumn(schemaIndex, tableIndex int, columnName string) bool
DeleteColumn removes a column from a table
func (*SchemaEditor) DeleteSchema ¶
func (se *SchemaEditor) DeleteSchema(schemaIndex int) bool
DeleteSchema removes a schema from the database
func (*SchemaEditor) DeleteTable ¶
func (se *SchemaEditor) DeleteTable(schemaIndex, tableIndex int) bool
DeleteTable removes a table from a schema
func (*SchemaEditor) GetAllColumns ¶
func (se *SchemaEditor) GetAllColumns(schemaIndex, tableIndex int) map[string]*models.Column
GetAllColumns returns all columns in a table
func (*SchemaEditor) GetAllSchemas ¶
func (se *SchemaEditor) GetAllSchemas() []*models.Schema
GetAllSchemas returns all schemas
func (*SchemaEditor) GetAllTables ¶
func (se *SchemaEditor) GetAllTables() []*models.Table
GetAllTables returns all tables across all schemas
func (*SchemaEditor) GetColumn ¶
func (se *SchemaEditor) GetColumn(schemaIndex, tableIndex int, columnName string) *models.Column
GetColumn returns a column by name
func (*SchemaEditor) GetDatabase ¶
func (se *SchemaEditor) GetDatabase() *models.Database
GetDatabase returns the current database
func (*SchemaEditor) GetSchema ¶
func (se *SchemaEditor) GetSchema(schemaIndex int) *models.Schema
GetSchema returns a schema by index
func (*SchemaEditor) GetTable ¶
func (se *SchemaEditor) GetTable(schemaIndex, tableIndex int) *models.Table
GetTable returns a table by schema and table index
func (*SchemaEditor) GetTablesInSchema ¶
func (se *SchemaEditor) GetTablesInSchema(schemaIndex int) []*models.Table
GetTablesInSchema returns all tables in a specific schema
func (*SchemaEditor) UpdateColumn ¶
func (se *SchemaEditor) UpdateColumn(schemaIndex, tableIndex int, oldName, newName, dataType string, isPrimaryKey, isNotNull bool, defaultValue interface{}, description string) bool
UpdateColumn updates an existing column's properties
func (*SchemaEditor) UpdateSchema ¶
func (se *SchemaEditor) UpdateSchema(schemaIndex int, name, owner, description string)
UpdateSchema updates an existing schema's properties
func (*SchemaEditor) UpdateTable ¶
func (se *SchemaEditor) UpdateTable(schemaIndex, tableIndex int, name, description string)
UpdateTable updates an existing table's properties