mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-25 02:10:27 +08:00
- 集成 go-ora, dm, gokb 驱动,封装统一的 Database 接口实现,支持自定义 DSN 连接 - 新增 SyncEngine 同步引擎,支持基于主键的增量数据比对 (Insert/Update) - 新增 DataSyncModal 组件,实现三步走同步向导逻辑,修复 Transfer 组件空状态显示问题 - 优化 ConnectionModal 交互逻辑,支持驱动参数动态显隐 - 引入 antd/locale/zh_CN,统一应用界面的中文本地化显示
90 lines
2.8 KiB
Go
90 lines
2.8 KiB
Go
package connection
|
|
|
|
// SSHConfig holds SSH connection details
|
|
type SSHConfig struct {
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
User string `json:"user"`
|
|
Password string `json:"password"`
|
|
KeyPath string `json:"keyPath"`
|
|
}
|
|
|
|
// ConnectionConfig holds database connection details including SSH
|
|
type ConnectionConfig struct {
|
|
Type string `json:"type"`
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
User string `json:"user"`
|
|
Password string `json:"password"`
|
|
Database string `json:"database"`
|
|
UseSSH bool `json:"useSSH"`
|
|
SSH SSHConfig `json:"ssh"`
|
|
Driver string `json:"driver,omitempty"` // For custom connection
|
|
DSN string `json:"dsn,omitempty"` // For custom connection
|
|
}
|
|
|
|
// QueryResult is the standard response format for Wails methods
|
|
type QueryResult struct {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message"`
|
|
Data interface{} `json:"data"`
|
|
Fields []string `json:"fields,omitempty"`
|
|
}
|
|
|
|
// ColumnDefinition represents a table column
|
|
type ColumnDefinition struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Nullable string `json:"nullable"` // YES/NO
|
|
Key string `json:"key"` // PRI, UNI, MUL
|
|
Default *string `json:"default"`
|
|
Extra string `json:"extra"` // auto_increment
|
|
Comment string `json:"comment"`
|
|
}
|
|
|
|
// IndexDefinition represents a table index
|
|
type IndexDefinition struct {
|
|
Name string `json:"name"`
|
|
ColumnName string `json:"columnName"`
|
|
NonUnique int `json:"nonUnique"`
|
|
SeqInIndex int `json:"seqInIndex"`
|
|
IndexType string `json:"indexType"`
|
|
}
|
|
|
|
// ForeignKeyDefinition represents a foreign key
|
|
type ForeignKeyDefinition struct {
|
|
Name string `json:"name"`
|
|
ColumnName string `json:"columnName"`
|
|
RefTableName string `json:"refTableName"`
|
|
RefColumnName string `json:"refColumnName"`
|
|
ConstraintName string `json:"constraintName"`
|
|
}
|
|
|
|
// TriggerDefinition represents a trigger
|
|
type TriggerDefinition struct {
|
|
Name string `json:"name"`
|
|
Timing string `json:"timing"` // BEFORE/AFTER
|
|
Event string `json:"event"` // INSERT/UPDATE/DELETE
|
|
Statement string `json:"statement"`
|
|
}
|
|
|
|
// ColumnDefinitionWithTable represents a column with its table name (for search/autocomplete)
|
|
type ColumnDefinitionWithTable struct {
|
|
TableName string `json:"tableName"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
// UpdateRow represents a row update with keys (WHERE) and values (SET)
|
|
type UpdateRow struct {
|
|
Keys map[string]interface{} `json:"keys"`
|
|
Values map[string]interface{} `json:"values"`
|
|
}
|
|
|
|
// ChangeSet represents a batch of changes
|
|
type ChangeSet struct {
|
|
Inserts []map[string]interface{} `json:"inserts"`
|
|
Updates []UpdateRow `json:"updates"`
|
|
Deletes []map[string]interface{} `json:"deletes"`
|
|
}
|