easysql/README.md
2025-12-30 14:04:10 +08:00

167 lines
6.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🗄️ EasySQL
<div align="center">
![EasySQL](https://img.shields.io/badge/EasySQL-v2.0-06b6d4?style=for-the-badge)
![Tauri](https://img.shields.io/badge/Tauri-2.0-ffc131?style=for-the-badge&logo=tauri)
![React](https://img.shields.io/badge/React-18-61dafb?style=for-the-badge&logo=react)
![TypeScript](https://img.shields.io/badge/TypeScript-5-3178c6?style=for-the-badge&logo=typescript)
![Rust](https://img.shields.io/badge/Rust-orange?style=for-the-badge&logo=rust)
**现代化多数据库管理工具**
*轻量、高性能、跨平台*
</div>
---
## ✨ 特性
- 🚀 **超轻量** - 基于 Tauri 2.0 + Rust安装包仅 ~10MB
-**高性能** - Rust 原生数据库驱动,毫秒级响应
- 🎨 **精美 UI** - Windows Metro 风格,深色主题
- 🔌 **多数据库** - 支持 MySQL、PostgreSQL、SQLite、SQL Server 等
- 🔐 **SSH 隧道** - 安全连接远程数据库
- 📝 **智能编辑器** - SQL 语法高亮、智能补全、代码片段
- 📊 **数据编辑** - 支持直接编辑表格数据
- 📤 **导入导出** - 支持 JSON、Navicat NCX 格式
## 🗃️ 支持的数据库
| 数据库 | 状态 | 说明 |
|--------|------|------|
| 🐬 MySQL | ✅ | 完全支持 |
| 🐘 PostgreSQL | ✅ | 完全支持 |
| 💾 SQLite | ✅ | 完全支持 |
| 📊 SQL Server | ✅ | 完全支持 |
| 🦭 MariaDB | ✅ | 完全支持 |
| 🍃 MongoDB | 🔜 | 开发中 |
| ⚡ Redis | 🔜 | 开发中 |
| 🔶 Oracle | 🔜 | 计划中 |
| ❄️ Snowflake | 🔜 | 计划中 |
## 🚀 快速开始
### 环境要求
- Node.js 18+
- Rust (rustup)
- [Tauri 依赖](https://tauri.app/v1/guides/getting-started/prerequisites)
### 安装
```bash
# 克隆项目
git clone https://github.com/your-repo/easysql.git
cd easysql
# 安装依赖
npm install
# 开发模式运行
npm run tauri:dev
# 构建应用
npm run tauri:build
```
## 📸 界面预览
```
┌─────────────────────────────────────────────────────────────────┐
│ 🗄️ EasySQL ─ □ ✕ │
├────────────────┬────────────────────────────────────────────────┤
│ │ 🏠 主页 │ 📝 查询1 │ 📋 users │ + │
│ + 新建连接 │ ┌──────────────────────────────────────────┐ │
│ │ │ SELECT * FROM users │ │
│ ─ 连接 ─────── │ │ WHERE status = 'active' │ │
│ │ │ ORDER BY created_at DESC │ │
│ 🐬 MySQL本地 │ │ LIMIT 100; │ │
│ 🐘 PostgreSQL │ ├──────────────────────────────────────────┤ │
│ 📊 SQL Server │ │ ┌────┬────────┬─────────┬────────────┐ │ │
│ │ │ │ id │ name │ email │ created_at │ │ │
│ ─ mydb ─────── │ │ ├────┼────────┼─────────┼────────────┤ │ │
│ 📋 users │ │ │ 1 │ Alice │ a@... │ 2024-01-01 │ │ │
│ 📋 orders │ │ │ 2 │ Bob │ b@... │ 2024-01-02 │ │ │
│ 📋 products │ │ └────┴────────┴─────────┴────────────┘ │ │
├────────────────┴────────────────────────────────────────────────┤
│ ● 就绪 · 2 行 (0.05s) EasySQL v2.0 │
└─────────────────────────────────────────────────────────────────┘
```
## 🛠️ 技术栈
- **运行时**: Tauri 2.0 (Rust + WebView)
- **后端**: Rust + SQLx + Tiberius
- **前端**: React 18 + TypeScript 5
- **样式**: Tailwind CSS 3
- **构建**: Vite 5
- **编辑器**: Monaco Editor
## 📁 项目结构
```
easysql/
├── src-tauri/ # Tauri/Rust 后端
│ ├── src/
│ │ ├── main.rs # 主程序入口
│ │ ├── commands.rs # Tauri 命令
│ │ ├── database.rs # 数据库连接管理
│ │ ├── config.rs # 配置管理
│ │ └── ssh.rs # SSH 隧道
│ ├── Cargo.toml
│ └── tauri.conf.json
├── src/ # React 前端
│ ├── components/ # UI 组件
│ │ ├── TitleBar.tsx
│ │ ├── Sidebar.tsx
│ │ ├── MainContent.tsx
│ │ ├── SqlEditor.tsx
│ │ └── ConnectionModal.tsx
│ ├── lib/
│ │ ├── tauri-api.ts # Tauri API 封装
│ │ └── hooks.ts # 自定义 Hooks
│ ├── App.tsx
│ ├── types.ts
│ └── index.css
├── index.html
├── package.json
├── tailwind.config.js
├── tsconfig.json
└── vite.config.ts
```
## ⌨️ 快捷键
| 快捷键 | 功能 |
|--------|------|
| `Ctrl+Enter` | 执行 SQL |
| `Ctrl+S` | 保存文件/保存修改 |
| `Ctrl+O` | 打开 SQL 文件 |
| `Ctrl+Shift+F` | 格式化 SQL |
| `Ctrl+Q` | 新建查询 |
| `Ctrl+W` | 关闭当前标签 |
| `Ctrl+F` | 搜索(侧边栏/表格) |
## 🔧 配置说明
连接配置保存在用户配置目录:
- Windows: `%APPDATA%\easysql\connections.json`
- macOS: `~/Library/Application Support/easysql/connections.json`
- Linux: `~/.config/easysql/connections.json`
## 🤝 贡献
欢迎提交 Issue 和 Pull Request
## 📄 License
MIT
---
<div align="center">
Made with ❤️ using Tauri + React + Rust
</div>