当前位置:网站首页>基于 Vue + Codemirror 实现 SQL 在线编辑器
基于 Vue + Codemirror 实现 SQL 在线编辑器
2022-06-11 19:33:00 【柯晓楠】
一、项目介绍
本项目是基于 Vue2 + Codemirror 开发的 Web 版 SQL 编辑器,提供了以下功能:
- 在线运行 SQL 语句
- 实时命令提示(支持表名、字段名、SQL关键词提示)
- 查看 SQL 执行结果
- 提交 SQL 命令集
- 快捷使用命令集
- SQL 语句格式化
- SQL code differ
- 动态设置编辑器配置项
- 实时查看表结构
前端项目地址:https://gitee.com/web1024cn/vue-sqleditor
本项目提供了配套的后端示例代码(基于 Node + Express 实现)
项目后端地址:https://gitee.com/web1024cn/sqleditor-server
二、项目下载
clone 项目:
git clone https://gitee.com/web1024cn/vue-sqleditor.git
安装依赖:
npm install
启动:
npm run serve
访问:
http://localhost:8080
三、效果演示
- 编辑器效果:

- 展示查询结果:

- 实时表名、字段名、关键词提示:

- SQL执行异常提示:

- 查看命令保存记录:

- 保存命令的 code differ 查看:

- 动态设置编辑器配置项:

- 快捷使用命令集:

四、代码介绍
- 项目中使用了 [email protected] 实现编辑器功能;
- 使用 axios 实现 HTTP 请求,在 vue.config.js 中配置了 webpack-server 的代理解决跨域问题;
- 封装 axios 请求模块,规范 API 格式;
- 使用 vuex modules 和 vuex-persistedstate 实现前端数据缓存;
- 使用 [email protected] 模块处理日期格式化。
五、后端示例代码
Vue SQLEditor 在线 SQL 编辑器项目的后端示例代码,是基于 Node + Exopress 实现,数据库使用 Mysql。
安装:
# clone 项目
git clone https://gitee.com/web1024cn/sqleditor-server.git
# 安装依赖
npm install
# 启动项目
npm start
项目的访问地址为 http://127.0.0.1:3000,本项目没有提供页面,均为 RESTful api 接口。
接口说明:
- 执行SQL语句 http://127.0.0.1:3000/ext (method:post,params:{sql:’’})
- 查询所有表名 http://127.0.0.1:3000/query/tables (method:get)
- 查询指定表下的字段 http://127.0.0.1:3000/query/field (method:get)
代码说明:
- 基于 [email protected] 开发
- 使用 [email protected] 模块连接 MySQL 数据库
- 使用 mysql 模块提供的 pool 实例实现数据连接池
- 使用 nodemon 管理热部署,需要先安装 nodemon
注意:项目使用了 nodemon 管理热部署,需要先在本地安装 nodemon !本项目使用的 nodemon 为全局安装。
边栏推荐
- 【图像去噪】基于绝对差分中值滤波、加权中值滤波法、改进加权中值滤波实现脉冲噪声图像去噪附matlab代码
- 无监督图像分类《SCAN:Learning to Classify Images without》代码分析笔记(1):simclr
- Anaconda installation, jupyter notebook default startup path modification and nbextensions plug-in installation
- Review of software testing technology
- Skywalking source code analysis Part 5 - server configuration configuration module startup
- Hdu3527 (Hangdian) spy problem
- [Multisim Simulation] using operational amplifier to generate sawtooth wave
- Introduction to go language (VI) -- loop statement
- Pyramid test principle: 8 tips for writing unit tests
- Template and requirements of curriculum design of reinforced concrete structure in autumn 21 of Dagong [standard answer]
猜你喜欢

Anaconda installation, jupyter notebook default startup path modification and nbextensions plug-in installation

Go语言入门(六)——循环语句
![[signal denoising] signal denoising based on FFT and fir with matlab code](/img/4c/782afe2652a674d64fccd8d28304ed.png)
[signal denoising] signal denoising based on FFT and fir with matlab code

【视频去噪】基于SALT实现视频去噪附Matlab代码

关于富文本储存数据库格式转译问题

Activate function formulas, derivatives, image notes

Yolov3 pytoch code and principle analysis (I): runthrough code

Gmail: how do I recall an outgoing message?

Detailed explanation of iSCSI (IV) -- actual configuration of iSCSI server

2022 the latest software testing classic summarized by major manufacturers. After reading it, I'm not afraid I won't get an offer
随机推荐
Bottomsheetdialog usage details, setting fillet, fixed height, default full screen, etc
金字塔测试原理:写好单元测试的8个小技巧,一文总结
YOLOv3 Pytorch代码及原理分析(二):网络结构和 Loss 计算
Introduction to typescript
Hdu3527 (Hangdian) spy problem
【mysql进阶】10种数据类型的区别以及如何优化表结构(三)
This article introduces you to the infrastructure of sofaregistry
使用贝叶斯优化进行深度神经网络超参数优化
MOS transistor 24n50 parameters of asemi, 24n50 package, 24n50 size
激活函数公式、导数、图像笔记
【图像分割】基于马尔可夫随机场实现图像分割附matlab代码
Yolov3 pytoch code and principle analysis (II): network structure and loss calculation
【求助】請問如何讓微信公眾號文章在外部瀏覽器中打開後還能顯示下方的精選留言?
CMU 15 - 445 cours de base de données Leçon 5 version texte - Pool tampon
Picture bed: picgo+ Tencent cloud +typera
Pyqt5 tips - button vertical display method, QT designer sets button vertical display.
Practice of Flink CDC in Dajian cloud warehouse
Course design for construction organization, School of distance and continuing education, Dalian University of technology [standard answer]
谷歌提出超强预训练模型CoCa,在ImageNet上微调Top-1准确率达91%!在多个下游任务上SOTA!...
Pymysql uses cursor operation database method to encapsulate!!!