package storage import ( "dbview/service/internal/common/manager/storage/types" ) // StorageInterface 定义存储接口 type StorageInterface interface { // 连接管理 // CreateConnection 新增第一个参数 kind,表示连接类别:"database" | "server" | "other"。 // type 表示具体子类型(例如 mysql/postgres 或 ssh),version 表示版本号或次级信息。 CreateConnection(groupID, name, description, kind, typ, version, server string, port int, username, password, database, connectionString string, useSSHTunnel bool, color string, autoConnect bool, displayOrder int) (*types.ConnectionWithDetails, error) GetConnection(connID string) (*types.ConnectionWithDetails, error) UpdateConnection(connID string, req *types.UpdateConnectionRequest) (*types.ConnectionWithDetails, error) DeleteConnection(connID string) error MoveConnection(connID, targetGroupID string) (*types.ConnectionWithDetails, error) GetAllConnections() ([]types.ConnectionWithDetails, error) // 连接分组管理 CreateConnectionGroup(parentID, name, description, icon string, displayOrder int) (*types.ConnectionGroup, error) GetConnectionGroup(groupID string, loadConnections bool, recursive bool) (*types.ConnectionGroup, error) UpdateConnectionGroup(groupID, name, description, icon string, displayOrder int) (*types.ConnectionGroup, error) DeleteConnectionGroup(groupID string, cascadeDeleteChildren, cascadeDeleteConnections bool) error MoveConnectionGroup(groupID, newParentID string) error GetRootConnectionGroup(loadConnections bool, recursive bool) (*types.ConnectionGroup, error) GetConnectionGroupTree(loadConnections bool) (*types.ConnectionGroup, error) // Script 管理(通用脚本) CreateScript(connectionID, groupID, name, description, content string, favorite bool) (*types.Script, error) GetScript(scriptID string) (*types.Script, error) UpdateScript(scriptID, name, description, content string, favorite bool) (*types.Script, error) DeleteScript(scriptID string) error UpdateScriptExecutionStats(scriptID string) error ListScripts(connID string) ([]types.Script, error) // 脚本分组管理 CreateScriptGroup(parentID, name, description string) (*types.ScriptGroup, error) GetScriptGroup(groupID string, loadScripts bool, recursive bool) (*types.ScriptGroup, error) UpdateScriptGroup(groupID, name, description string) (*types.ScriptGroup, error) DeleteScriptGroup(groupID string, cascadeDeleteChildren, cascadeDeleteScripts bool) error MoveScriptGroup(groupID, newParentID string) error GetRootScriptGroup(loadScripts bool, recursive bool) (*types.ScriptGroup, error) GetScriptGroupTree(loadScripts bool) (*types.ScriptGroup, error) // 配置管理 CreateDefaultConfig() error } // 类型别名,保持向后兼容 type ConnectionGroup = types.ConnectionGroup type Script = types.Script type ScriptGroup = types.ScriptGroup