Skip to content

Commit ed5b92b

Browse files
author
jaysun
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # go.mod
2 parents 9ddd99a + b016e19 commit ed5b92b

File tree

30 files changed

+1950
-1670
lines changed

30 files changed

+1950
-1670
lines changed

README.md

Lines changed: 7 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,24 @@
1-
[![e5355b6316b83dcf4b6be9b7544f8e331588255151.jpg](https://github.com/sunshinev/remote_pics/raw/master/e5355b6316b83dcf4b6be9b7544f8e331588255151.jpg)](https://sunshinev.github.io/go-sword-home/)
2-
3-
Go-sword(利刃)是一款基于Go语言的可视化web管理后台生成工具
4-
1+
Go-sword 利刃 V2.0.0
52

63
![GitHub last commit](https://img.shields.io/github/last-commit/sunshinev/go-sword)
74
![GitHub](https://img.shields.io/github/license/sunshinev/go-sword)
85
![GitHub repo size](https://img.shields.io/github/repo-size/sunshinev/go-sword)
96
![GitHub stars](https://img.shields.io/github/stars/sunshinev/go-sword?style=social)
107
![GitHub forks](https://img.shields.io/github/forks/sunshinev/go-sword?style=social)
118

12-
官方网站
13-
[https://sunshinev.github.io/go-sword-home/](https://sunshinev.github.io/go-sword-home/)
14-
15-
她能满足你哪些?
16-
17-
1. 你有代码洁癖,不希望工具过多干扰你的业务逻辑
18-
2. 你希望生成的页面可以自定义修改,来实现更多的功能
19-
3. 你希望代码特别简单易读,且容易自定义
20-
4. 你希望能快速构建管理后台,哪怕仅仅是将数据库里的数据可视化
21-
5. 你希望一键生成CRUD,无需复杂操作
22-
6. 你希望使用 iView 的组件,快速构建页面
23-
24-
那么 go-sword 可以满足你
25-
26-
27-
根据MySQL的表结构,创建完整的管理后台界面,开发者无需再重复手动的创建具有CRUD能力的页面
28-
只需要点击按钮即可生成完整的管理后台
29-
30-
![136e8b44d5d4acf00d5a63125928bd731587996269.jpg](https://github.com/sunshinev/remote_pics/raw/master/136e8b44d5d4acf00d5a63125928bd731587996269.jpg)
31-
32-
## 特点
33-
1. 一键生成,无需写一行代码
34-
2. 支持增加、删除、编辑、列表、批量删除、分页、检索
35-
3. 页面基于Vue.js + iView
36-
4. 针对每个数据表都生成了单独的逻辑文件,开发者可以求使用Vue或者iView来实现功能更加丰富的页面
37-
38-
![1626ee1d3300ac6db6669d63721d96381587996351.jpg](https://github.com/sunshinev/remote_pics/raw/master/1626ee1d3300ac6db6669d63721d96381587996351.jpg)
39-
40-
41-
42-
## 开始
43-
44-
### 安装
45-
```
46-
go get -u github.com/sunshinev/go-sword
47-
```
48-
### 编译
49-
50-
```
51-
go build
52-
```
53-
54-
安装完成后,确保`go-sword`命令在`GOPATH/bin`目录下,可执行
55-
56-
57-
### 启动服务
58-
```
59-
go-sword -db {db_database} -password {db_password} -user {db_uesr} -module {module_name}
60-
```
61-
62-
例如:`go-sword -db blog -password 123456 -user root -module go-sword-app`
63-
64-
以上命令,就是连接数据库`blog`,用户名`root`,密码`12345`,在go-sword命令的当前目录下创建项目`go-sword-app`
65-
66-
启动成功的提示
67-
```
68-
Go-Sword will create new project named go-sword-app in current directory
69-
70-
[Server info]
71-
Server port : 8080
72-
Project module : go-sword-app
739

74-
[db info]
75-
MySQL host : localhost
76-
MySQL port : 3306
77-
MySQL user : root
78-
MySQL password : 123456
10+
> 一款基于Go语言的可视化web管理后台生成工具包
11+
> 根据MySQL的表结构,创建CRUD的管理后台界面,开发者无需再重复手动的创建具有CRUD能力的页面,只需要点击按钮即可生成完整的管理后台
7912
80-
Start successful, server is running ...
81-
Please request: http://localhost:8080
82-
```
83-
84-
85-
#### 参数说明
86-
```
87-
+---------------------------------------------------+
88-
| |
89-
| Welcome to use Go-Sword |
90-
| |
91-
| Visualized tool |
92-
| Fastest to create CRUD background |
93-
| https://github.com/sunshinev/go-sword |
94-
| |
95-
+---------------------------------------------------+
96-
Usage of go-sword:
97-
// 要连接的数据库信息
98-
-db string
99-
MySQL database
100-
-host string
101-
MySQL Host (default "localhost")
102-
// 重要:module参数单独作解释
103-
-module string
104-
New project module, the same as 'module' in go.mod file. (default "go-sword-app/")
105-
// go-sword 服务启动的默认端口
106-
-p string
107-
Go-sword Server port (default "8080")
108-
-password string
109-
MySQL password
110-
-port int
111-
MySQL port (default 3306)
112-
-user string
113-
MySQL user
114-
```
115-
116-
#### 参数: -module
117-
`-module` 参数是代表要创建的项目名称,同时也是新项目`go.mod`文件中的`module`字段的值,这点请务必保持一致。
11813

119-
#### 注意
120-
新项目会在运行`go-sword`命令的当前目录下,直接创建`module`目录,作为新项目
14+
[官网 https://sunshinev.github.io/go-sword-home/](https://sunshinev.github.io/go-sword-home/)
12115

122-
### 开始使用服务
16+
详细请参阅文档
17+
[文档 https://go-sword-doc.osinger.com/](https://go-sword-doc.osinger.com/)
12318

124-
```
125-
Start successful, server is running ...
126-
Please request: http://localhost:8080
127-
```
128-
129-
根据服务启动的提示,直接点击`http://localhost:8080`即可进入web的可视化工具页面
13019

13120
![59384a43cbc382dec53dd76d169a5d001587995174.jpg](https://github.com/sunshinev/remote_pics/raw/master/59384a43cbc382dec53dd76d169a5d001587995174.jpg)
13221

133-
#### 重要:页面功能介绍
13422
1. 首先下拉选择MySQL 的表格,然后点击`Preview`按钮,即可渲染出需要创建的文件
13523
2. 首次创建新项目文件需要点击`select all`全部选择,首次创建包含了项目启动必需的核心文件
13624
3. 点击`Generate`按钮,既可以看到提示文件创建成功
@@ -141,74 +29,14 @@ Please request: http://localhost:8080
14129
2. 如果创建第二个管理页面,那么可以只选择 `select diff & new`按钮,然后点击`Generate`按钮
14230
3. 每次生成新的管理界面后,请重启新创建的项目
14331

144-
## 开始使用新项目
145-
进入到我们新创建的项目目录
146-
```
147-
➜ test tree -L 2
148-
.
149-
└── go-sword-app
150-
├── controller
151-
├── core
152-
├── go.mod
153-
├── go.sum
154-
├── main.go
155-
├── model
156-
├── resource
157-
├── route
158-
└── view
159-
```
160-
比如说我们,刚刚是在`test`目录运行的`go-sword`命令,创建的项目就是`test/go-sword-app`
161-
162-
我们进入`test/go-sword-app`目录下按照以下命令启动项目
163-
164-
### 初始化新项目 go mod init
165-
166-
利用`go mod`初始化项目,这里的`module`就是我们前面讲到的要与项目名称保持一致!!
167-
168-
```
169-
go mod init {module}
170-
```
171-
172-
### 启动项目
173-
174-
```
175-
go run main.go
176-
```
177-
178-
然后会看到下面的提示,点击`http://localhost:8082`既可以进入后台管理界面
179-
180-
```
181-
Enjoy your system ^ ^
182-
Generated by Go-sword
183-
https://github.com/sunshinev/go-sword
184-
185-
[Server info]
186-
Server port : 8082
187-
188-
[db info]
189-
MySQL host : localhost
190-
MySQL port : 3306
191-
MySQL user : root
192-
MySQL password : 123456
193-
194-
Start successful, server is running ...
195-
Please request: http://localhost:8082
196-
```
197-
19832
### 管理后台效果
19933

20034
1. 后端报错提醒
20135
2. 增加、删除、编辑、列表、批量删除、分页、检索
20236

20337
![1626ee1d3300ac6db6669d63721d96381587996351.jpg](https://github.com/sunshinev/remote_pics/raw/master/1626ee1d3300ac6db6669d63721d96381587996351.jpg)
20438

205-
## 一些问题
206-
1. 因为golang的map结构遍历乱序的问题,部分页面输出的字段顺序不能保证和数据库字段顺序一致
207-
2. 关于`module`的参数,可能还会有更好的解决方案
208-
3. 没有提供用户注册、登录的能力,这也不符合初衷,最开始就是想做的更加基础,快速创建页面
209-
4. 生成的项目代码,还有很大的优化空间
21039

211-
## 页面功能展示
21240

21341
### 列表
21442
![ea1f86ebc1b5c88aaf6484fa078584951587997286.jpg](https://github.com/sunshinev/remote_pics/raw/master/ea1f86ebc1b5c88aaf6484fa078584951587997286.jpg)
@@ -239,3 +67,4 @@ go-bindata -o assets/stub/stub.go -pkg stub stub/...
23967
```
24068
go-bindata -o assets/view/view.go -pkg view view/...
24169
```
70+

0 commit comments

Comments
 (0)