mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-03 04:08:36 +08:00
✨ feat(sql-audit): 新增 SQL 审计中心并完善事务追踪
- 新增脱敏审计存储、筛选、保留策略、完整性校验与 JSON/CSV 导出 - 覆盖查询编辑器、事务、导入同步、对象操作、AI/MCP 与 Web 运行时入口 - 完善事务完整语句日志、Windows 快捷键映射及 SQL 分析布局 - 补充多语言、健康状态、数据目录迁移和回归测试
This commit is contained in:
@@ -81,7 +81,34 @@ func (a *App) resolveDataSyncEndpointConfig(raw connection.ConnectionConfig, sel
|
||||
}
|
||||
|
||||
// DataSync executes a data synchronization task
|
||||
func (a *App) DataSync(config sync.SyncConfig) sync.SyncResult {
|
||||
func (a *App) DataSync(config sync.SyncConfig) (result sync.SyncResult) {
|
||||
auditStartedAt := time.Now()
|
||||
defer func() {
|
||||
runConfig := normalizeRunConfig(config.TargetConfig, config.TargetDatabase)
|
||||
auditMessage := ""
|
||||
if !result.Success {
|
||||
auditMessage = "data synchronization task failed"
|
||||
}
|
||||
auditResult := connection.QueryResult{
|
||||
Success: result.Success,
|
||||
Message: auditMessage,
|
||||
Data: map[string]int64{
|
||||
"affectedRows": int64(result.RowsInserted + result.RowsUpdated + result.RowsDeleted),
|
||||
},
|
||||
}
|
||||
a.recordSQLAuditQuery(sqlAuditQueryInput{
|
||||
Config: runConfig,
|
||||
Database: config.TargetDatabase,
|
||||
DBType: resolveDDLDBType(runConfig),
|
||||
QueryID: generateQueryID(),
|
||||
SQL: fmt.Sprintf("SYNC DATA TABLES_%d", len(config.Tables)),
|
||||
Source: "sync",
|
||||
CommitMode: "auto",
|
||||
Duration: time.Since(auditStartedAt),
|
||||
StatementCount: len(config.Tables),
|
||||
Result: auditResult,
|
||||
})
|
||||
}()
|
||||
if err := ensureDataSyncTargetProtection(config); err != nil {
|
||||
return sync.SyncResult{
|
||||
Success: false,
|
||||
|
||||
Reference in New Issue
Block a user