移除/Doc到单独的Doc文档库

This commit is contained in:
changyu72
2016-04-28 17:48:49 +08:00
parent d6488ecbd7
commit 2709e67081
14 changed files with 8 additions and 370 deletions

View File

@@ -34,6 +34,7 @@ Lessgo 是一款Go语言开发的简单、稳定、高效、灵活的 web开发
- 核心框架:[lessgo](https://github.com/lessgo/lessgo)
- 框架扩展:[lessgoext](https://github.com/lessgo/lessgoext)
- 项目Demo[demo](https://github.com/lessgo/demo)
- 框架文档 [document](https://github.com/lessgo/doc)
##框架下载
@@ -42,6 +43,12 @@ go get -u github.com/lessgo/lessgo
go get -u github.com/lessgo/lessgoext
```
##系统文档
- [综述](https://github.com/lessgo/doc/Introduction.md)
- [安装部署](https://github.com/lessgo/doc/Install.md)
- [开始lessgo之旅](https://github.com/lessgo/doc/Develop01.md)
- [更多(文档目录)](https://github.com/lessgo/doc/Index.md)
##项目目录组织
─Project 项目开发目录
├─Config 配置文件目录
@@ -97,12 +104,6 @@ go get -u github.com/lessgo/lessgoext
├─Logger 运行日志输出目录
└─Main.go 应用入口文件
##系统文档
- [综述](doc/Introduction.md)
- [安装部署](doc/Install.md)
- [开始lessgo之旅](doc/Develop01.md)
- [更多(文档目录)](doc/Index.md)
##贡献者名单
贡献者 |贡献概要
--------------------------------|--------------------------------------------------
@@ -110,7 +111,7 @@ go get -u github.com/lessgo/lessgoext
[changyu72](https://github.com/changyu72)|第二作者 (主要架构设计者)
##开源协议
Lessgo 项目采用商业应用友好的 [MIT](https://github.com/lessgo/lessgo/raw/master/doc/LICENSE) 协议发布。
Lessgo 项目采用商业应用友好的 [MIT](https://github.com/lessgo/lessgo/raw/master/LICENSE) 协议发布。
##项目联系
* 官方QQ群Go-Web 编程 42730308 [![Go-Web 编程群](http://pub.idqqimg.com/wpa/images/group.png)](http://jq.qq.com/?_wv=1027&k=fzi4p1)

View File

@@ -1,68 +0,0 @@
#开始Lessgo之旅
```sh
$ lessgo new appname
```
##1. 项目构建完成后,创建的项目目录如下:
─Project 项目目录
├─BusinessAPI 业务模块后端目录
│ ├─BusRouter.go 业务模块路由文件
│ ├─BusCommon Business公共目录
│ │ ├─Middleware 中间件目录
│ │ └─Model 数据模型
│ │ └─... 其他
│ ├─Home模块目录
│ │ ├─IndexHandle.go Index操作
│ │ ├─IndexModel.go Index数据模型及模板函数
│ └─... 创建要开发的模块目录(后端代码)
├─BusinessView 业务模块前端目录 (url: /bus)
│ ├─Home模块目录 (url:/)
│ │ ├─index.tpl ExampleHandle对应的模板文件
│ │ ├─index.html 无需绑定操作的静态html文件
│ │ ├─index.css css文件
│ │ ├─index.js js文件
│ └─...创建要开发的模块目录(前端代码)
├─Common 后端公共目录
│ ├─Middleware 中间件目录
│ └─Model 数据模型
├─Config 配置文件目录
│ ├─app.config 系统应用配置文件
│ └─db.config 数据库配置文件
├─Logger 运行日志输出目录
├─Static 前端公共目录 (url: /static)
│ ├─Tpl 公共tpl模板目录
│ ├─Js 公共js目录 (url: /static/js)
│ ├─Css 公共css目录 (url: /static/css)
│ ├─Img 公共img目录 (url: /static/img)
│ └─Plugin 公共js插件 (url: /static/plugin)
├─Swagger 系统API文档自动构建工具
├─SystemAPI 系统模块后端目录
│ ├─SysRouter.go 系统模块路由文件
│ ├─SysCommon 后端公共目录
│ │ ├─Middleware 中间件目录
│ │ └─Model 数据模型
│ │ └─... 其他
│ ├─Xxx Xxx子模块目录
│ │ ├─ExampleHandle.go Example操作
│ │ ├─ExampleModel.go Example数据模型及模板函数
│ │ └─... Xxx的子模块目录
│ └─... 其他子模块目录
├─SystemView 系统模块前端目录 (url: /sys)
│ ├─Xxx Xxx子模块目录 (url: /sys/xxx)
│ │ ├─example.tpl ExampleHandle对应的模板文件
│ │ ├─example2.html 无需绑定操作的静态html文件
│ │ ├─xxx.css css文件(可有多个)
│ │ ├─xxx.js js文件(可有多个)
│ │ └─... Xxx的子模块目录
├─Uploads 默认上传下载目录
└─Main.go 应用入口文件
##2.开发流程
- 规划好要开发的业务模块功能(分析设计阶段工作)
- 在/BusinessAPI/下建立本模块后端目录(模块还可以进一步细分为子模块,依次可以递归建立)
- 在/BusinessView/下建立本模块前端目录(模块还可以进一步细分为子模块,依次可以递归建立),目录层次与本模块后端目录对应;
- 在本模块后端目录下建立代码文件(一般分为模块Handle.go与模块Model.go),编写服务端代码;
- 在/BusinessAPI/SysRouter.go(业务模块路由)注册开发完成的handle的路由
- 编写服务端gp文件对应的test文件进行单元测试
- web应用在本模块前端目录下开发前端的html、tpl、js、css等代码包括调用服务端API功能的代码移动端app应用则通过相关工具开发应用调用开发的服务端API
- lessgo run 进行模块代码运行调试。

View File

@@ -1,46 +0,0 @@
# APP配置项(App.config)
[info] --框架基本信息
email=henrylee_cn@foxmail.com
license=MIT
licenseurl=https://github.com/lessgo/lessgo/raw/master/doc/LICENSE
version=0.4.0
description=A simple, stable, efficient and flexible web framework.
host=127.0.0.1:8080
contact=henrylee_cn@foxmail.com
termsofserviceurl=https://github.com/lessgo/lessgo
[filecache] --静态文件缓存配置项
maxcapmb=256 --最大缓存(内存MB)
cachesecond=600 --缓存的刷新时间(秒)
singlefileallowmb=64 --单文件缓存限制(单文件大小超过MB的不缓存)
[listen] --http服务器参数
enablehttps=false --允许https
httpscertfile=
httpskeyfile=
graceful=false
address=0.0.0.0:8080 --IP地址与端口
readtimeout=0 --读超时
writetimeout=0 --写超时
[session] --Session配置项
cookielifetime=3600
enablesetcookie=true
domain=
enable=false
cookiename=lessgosessionID
provider=memory --保存方式: memory=内存
providerconfig={"cookieName":"gosessionid", "enableSetCookie,omitempty": true, "gclifetime":3600, "maxLifetime": 3600, "secure": false, "sessionIDHashFunc": "sha1", "sessionIDHashKey": "", "cookieLifeTime": 3600, "providerConfig": ""}
gcmaxlifetime=3600
[log] --日志配置项
level=debug --日志级别
asyncchan=1000 --并发数开关
[system] --系统配置项
maxmemorymb=64 --最大内存
crossdomain=false --是否允许跨域调用
appname=lessgo --应用名称
debug=true --调试模式
casesensitive=false

View File

@@ -1,17 +0,0 @@
# 数据库访问配置项(DB.config)
[defaultdb] --默认数据库
name=preset --数据库名称
tablesnake=true --表名使用snake风格或保持不变
tablespace= --表命名空间
maxidleconns=1 --最大空闲连接数,超过该数量的会释放
showexectime=false --显示执行时间
showsql=false --显示执行的SQL
tablefix=prefix --表命名空间是前缀还是后缀prefix | suffix
connstring=Common/DB/sqlite.db --连接字符串
disablecache=false --禁止缓存
columnpace= -- 列命名空间
maxopenconns=1 --最大打开连接数
driver=sqlite3 --数据库驱动类型
columnsnake=true -- 列名使用snake风格或保持不变
columnfix=prefix 列命名空间是前缀还是后缀prefix | suffix

View File

@@ -1,71 +0,0 @@
#1动态路由
##1.1 源码中注册handle
在每个handle文件中在init()调用
Regester(name, description handlePattern string, method []string, handleOrMiddleware ...Handler):
说明:
注册一个原子操作,可以任意指定中间件:
* name @操作名称
* description @操作描述
* method @方法列表
* handlePattern @操作名+匹配参数
* handleOrMiddleware @操作和中间件均实现Handler接口,根据传入顺序不同,执行顺序也不同
实现:
通过Caller()获取函数所在路径 p
设置HandleMap map[string]Handler的值 HandleMap[p>>handlePattern]=handleOrMiddleware。
##1.2 源码中注册middleware
- RegesterMiddleware(name, description string, middleware Handler)
说明:
- 注册一个中间件,
- name @中间件名称
- description @中间件描述
- 设置MiddlewareMap map[string]Handler的值 MiddlewareMap[name]=handleOrMiddleware。
##1.3 后台配置
- 显示HandleMap的列表字段有name,description,handlePattern,已被哪些模块调用;
- 显示MiddlewareMap的列表字段有name,description,已被哪些模块调用;
- 创建模块:
- 设置模块modulePattern、name和description
- 选择父模块parentPattern
- 自由组合Handle和Middleware
- 该模块下某条完整的url匹配即为path.Join(parentPattern, modulePattern, handlePattern)
- 选择状态(启用、禁用),
- 保存配置在数据库。
模块列表以折叠树形式呈现,其字段有:
name,description, modulePattern, 父模块, 状态(已启用、已禁用、配置失败), 修改, 删除。
##1.4 路由的特别要求
- 每个节点有status字段进行状态标记与控制
- 支持节点创建;
- 支持节点移除。
#2 动态路由实现
- 以中间件方式实现状态控制。
#3 配置管理功能
- 1. 操作和模块的中间件在后台配置;
- 2. 可以对操作和模块进行禁用与启用控制;
- 3. 操作和模块均支持url重定向设置
- 4. 支持Home关闭与开启
- 5. 选择是否开启url简写模式。/home/index/index?a=0简写为a=0/home/index/index/0简写为/index/index/0
#4 编译期实现的自动化
- 1. 依赖路径,智能配置路由;
- 2. 操作有名称与描述字段其中描述一般在写API时很有用写死
- 3. 模块有名称与描述字段,写死;
- 4. url中可以省略"home"模块;
- 5. 默认各个操作与模块均为启用状态;
- 6. 默认Home为启用状态
- 7. 若开启简写模式则应该能自动补全简写的url。
#五、技术实现
1. 核心架构采用echo2二次开发
2. 数据库模块采用xorm

View File

@@ -1,32 +0,0 @@
# 导航目录
- [综述](Introduction.md)
- [安装部署](Install.md)
- [开始Lessgo之旅](Develop01.md)
- [系统配置项]( )
- [App.config](Develop02-1.md)
- [DB.config](Develop02-2.md)
- [运行时路由](Develop03.md)
- [带描述Handle]( )
- [基于xorm的model开发]( )
- [中间件开发]( )
- [Session]( )
- [多数据库连接]( )
- [文件上传下载]( )
- [系统log]( )
- [Swagger]( )
- [模块开发实例]( )
- [服务端开发]( )
- [web客户端开发]( )
- [框架API]( )
- [扩展模块]( )
- [Admin管理模块]( )
- [SQLMAP引擎]( )
- [帐号权限模块]( )
- [相关参考](.md)
- [echo v2]()
- [xorm]()

View File

@@ -1,26 +0,0 @@
#框架下载
- 下载框架源码与框架扩展源码
```sh
go get -u github.com/lessgo/lessgo
go get -u github.com/lessgo/lessgoext
```
- 下载第三方依赖包,解压至 GOPATH/src 目录下 [[点击下载 ZIP]](https://github.com/lessgo/dependency/archive/master.zip)
#安装部署工具
```sh
cd %GOPATH%/src/github.com/lessgo/lessgoext/lessgo
go install
```
#创建项目
利用项目构建工具自动创建新项目(在项目目录下运行cmd)
```sh
$ lessgo new appname
```
#运行项目
以热编译模式运行在项目目录下运行cmd
```sh
$ cd appname
$ lessgo run
```
运行后在浏览器打开http://localhost:8080 即可看到项目首页.

View File

@@ -1,103 +0,0 @@
#概述
Lessgo 是一款Go 语言开发的简单、稳定、高效、灵活的 web开发框架。它的项目组织形式经过精心设计实现前后端分离、系统与业务分离完美兼容MVC与MVVC等多种开发模式非常利于企业级应用与API接口的开发。当然最值得关注的是它突破性地支持了运行时路由重建开发者可在Admin后台轻松实现启用/禁用模块与操作,添加/移除中间件等功能同时它推荐以HandlerFunc与MiddlewareFunc为基础的函数式编程也令开发变得更加灵活富有趣味性。
此外它也博采众长,核心架构基于[echo v2](https://github.com/labstack/echo)并增强优化,数据库引擎内置为[xorm](https://github.com/go-xorm/xorm),模板引擎内置为[pongo2](https://github.com/flosch/pongo2),其他某些功能模块改写自[beego](https://github.com/astaxie/beego)以及其他优秀开源项目。(在此感谢这些优秀的开源项目)
#适用场景
- 网站
- web应用
- Restful API服务应用
- 企业应用
#主要特点:
- 使用简单、运行稳定高效
- 兼容流行系统模式如:MVC、MVVC、Restful...
- 强大的运行时路由重建
- 多异构数据库支持
- 优化的项目目录组织最佳实践,满足复杂企业应用需要
- swagger集成智能API文档
- 集成统一的日志
- SQLMAP方式的动态SQL配置执行API(开发中)
- 开箱即用的权限体系(计划)
#项目架构
![Lessgo Web Framework](https://github.com/lessgo/lessgo/raw/master/doc/LessgoWebFramework.jpg)
#框架构成
- 核心框架:[lessgo](https://github.com/lessgo/lessgo)
- 框架扩展:[lessgoext](https://github.com/lessgo/lessgoext)
- 项目Demo[demo](https://github.com/lessgo/lessgoext)
#框架下载
```sh
go get -u github.com/lessgo/lessgo
go get -u github.com/lessgo/lessgoext
```
#项目目录组织
─Project 项目开发目录
├─Config 配置文件目录
│ ├─app.config 系统应用配置文件
│ └─db.config 数据库配置文件
├─Common 后端公共目录
│ ├─Middleware 中间件目录
│ └─Model 数据模型
│ └─... 其他
├─Static 前端公共目录 (url: /static)
│ ├─Tpl 公共tpl模板目录
│ ├─Js 公共js目录 (url: /static/js)
│ ├─Css 公共css目录 (url: /static/css)
│ ├─Img 公共img目录 (url: /static/img)
│ └─Plugin 公共js插件 (url: /static/plugin)
├─SystemAPI 系统模块后端目录
│ ├─SysRouter.go 系统模块路由文件
│ ├─SysCommon 后端公共目录
│ │ ├─Middleware 中间件目录
│ │ └─Model 数据模型
│ │ └─... 其他
│ ├─Xxx Xxx子模块目录
│ │ ├─ExampleHandle.go Example操作
│ │ ├─ExampleModel.go Example数据模型及模板函数
│ │ └─... Xxx的子模块目录
│ └─... 其他子模块目录
├─SystemView 系统模块前端目录 (url: /sys)
│ ├─Xxx Xxx子模块目录 (url: /sys/xxx)
│ │ ├─example.tpl ExampleHandle对应的模板文件
│ │ ├─example2.html 无需绑定操作的静态html文件
│ │ ├─xxx.css css文件(可有多个)
│ │ ├─xxx.js js文件(可有多个)
│ │ └─... Xxx的子模块目录
├─BusinessAPI 业务模块后端目录
│ ├─BusRouter.go 业务模块路由文件
│ ├─BusCommon Business公共目录
│ │ ├─Middleware 中间件目录
│ │ └─Model 数据模型
│ │ └─... 其他
│ ├─Xxx Xxx子模块目录
│ │ ├─ExampleHandle.go Example操作
│ │ ├─ExampleModel.go Example数据模型及模板函数
│ │ └─... Xxx的子模块目录
│ └─... 其他子模块目录
├─BusinessView 业务模块前端目录 (url: /bus)
│ ├─Xxx Xxx子模块目录 (url: /bus/xxx)
│ │ ├─example.tpl ExampleHandle对应的模板文件
│ │ ├─example2.html 无需绑定操作的静态html文件
│ │ ├─xxx.css css文件(可有多个)
│ │ ├─xxx.js js文件(可有多个)
│ │ └─... Xxx的子模块目录
├─Uploads 默认上传下载目录
├─Logger 运行日志输出目录
└─Main.go 应用入口文件
#贡献者名单
贡献者 |贡献概要
--------------------------------|--------------------------------------------------
[henrylee2cn](https://github.com/henrylee2cn)|第一作者 (主要代码实现者)
[changyu72](https://github.com/changyu72)|第二作者 (主要架构设计者)
#开源协议
Lessgo 项目采用商业应用友好的 [MIT](https://github.com/lessgo/lessgo/raw/master/doc/LICENSE) 协议发布。
#项目联系
* 官方QQ群Go-Web 编程 42730308 [![Go-Web 编程群](http://pub.idqqimg.com/wpa/images/group.png)](http://jq.qq.com/?_wv=1027&k=fzi4p1)
![Lessgo Server](https://github.com/lessgo/lessgo/raw/master/doc/server.jpg)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB