package
module
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Aug 2, 2017
License: Apache-2.0
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
pgo
- go的基础开发框架,在这里集成了日志,配置文件,数据库等东西,目前仅支持web,thrift,jsonrpc2和rpcx的开发
开发流程
- go版本
- IDE推荐
- 目录结构
![结构图片 Alt text](https://github.com/penguinn/pgo/raw/v1.0.0/doc/construction.jpeg)
- 第一个红框表示GOPATH的路径
- 第二个红框是go get下来生成的二进制文件保存的地方,最好把这个路径添加到PATH
- 第三个红框是go get下载的github项目保存的目录
- 第四个红框是我们自己的gitlab的地址,我们以后的项目都在这个目录下开发(此图中MedPush就是一个项目)
- 第五个红框是govendor生成的包管理目录
- 第六个是没个项目的Dockerfile,用于docker build
- 日志库
- 配置文件
- 依赖包管理-govendor
- 单元测试工具-gotests
- 数据库介绍
配置文件详解
实例模板 中的components配置内容是通过关键字自动生成相应组件(选择使用),另可新增配置,新增配置同样可在自己的项目中通过viper获得
server
- type: 选择web、thrift、jsonrpc2和rpcx中的一种
- addr: 服务启动port
- log: 选择seelog的配置文件,若这个字段不填,则使用默认配置
components.router
- type: 可选web和jsonrpc2,分别部署不同形式的handler
- default:为一个数组,里面包括不同的路径路由到不同的handler上
components.mysql
mysql配置,如果不是用mysql可以删除掉mysql的配置
- type: 必填container,用于生成mysql子容器
- default:在mysql的container中生成default数据库
- type: 表示数据库的种类
- Driver: 表示底层使用的驱动器
- DSN: 表示写库的位置
- Reads: 表示读库的位置
- local:在container中生成local数据库
components.mongo
mongo配置,如果不适用mongo数据库可以删除掉mongo的配置
- type: 必填container,用于生成mongo子容器
- default: 在mongo的container中生成default数据库
- type:表示数据库的种类
- Addresses:mongo地址,可以传入数组
components.redis
- type: 必填container,用于生成redis子容器
- default: 在redis的container中生成default数据库
- Password:如果redis没有密码,请传入空字符串
components.template
导入web模板
开发实例
- web开发
- thrift开发
- 基于http的jsonrpc2开发
Documentation
¶
func Init(configFile string, args ...interface{}) error
Source Files
¶
Directories
¶
|
|
|
|
database
|
|
|
|
|
|
|
|
Package jsonrpc helps JSON-RPC 2.0 implements.
|
Package jsonrpc helps JSON-RPC 2.0 implements. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.