Skip to content

Commit

Permalink
Init Project
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteFlyCoding committed Apr 26, 2024
0 parents commit 2bff143
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# sql_executor

## 需求

使用 Beego 框架实现一个程序,要求该程序中包含两个接口:
- 查询接口:执行 SELECT 语句,一次接收一条 SQL,并将查询结果返回;
- 修改接口:执行 UPDATE、DELETE、INSERT 语句,一次接收一条或多条 SQL,并返回 SQL 的执行结果;
这些接口接收到的 SQL 语句,最终传递到后台数据库执行;

要求:
1. 需要有设计文档,设计文档中需包含实现原理、接口及参数等信息,可以写在程序 README 中;
2. MySQL 的配置信息(连接地址、端口号等),通过配置文件定义;
3. SQL 语句需要通过合法性校验,如果不合法则直接报错(SQL 解析可以调研并使用三方包);
4. 如果修改接口接收到的是多个 SQL,要求启动多个协程并发到数据库执行,注意程序和数据库的并发安全问题;
5. 修改接口需要支持数据库的事务特性,即用户可以指定传入 SQL 中的某几条必须在同一个事务中执行;
6. 要求程序接收到退出信号时,需要等待当前执行中的任务都执行完毕后再退出;
7. 程序中要求包含中文注释和单元测试;
8. 不需要写前端界面,仅有接口即可。

0 comments on commit 2bff143

Please sign in to comment.