Giter Site home page Giter Site logo

pgo's Introduction

pgo

  • go的基础开发框架,在这里集成了日志,配置文件,数据库等东西,目前仅支持http,thrift,jsonrpc2和rpcx的开发

开发流程

  1. go版本
  • 1.8.3
  1. IDE推荐
  • gogland
  1. 目录结构
    Alt text
  • 第一个红框表示GOPATH的路径
  • 第二个红框是go get下来生成的二进制文件保存的地方,最好把这个路径添加到PATH
  • 第三个红框是go get下载的github项目保存的目录
  • 第四个红框是我们自己的gitlab的地址,我们以后的项目都在这个目录下开发(此图中MedPush就是一个项目)
  • 第五个红框是govendor生成的包管理目录
  • 第六个是没个项目的Dockerfile,用于docker build
  1. 日志库
  1. 配置文件
  1. 依赖包管理-govendor
  1. 单元测试工具-gotests
  1. 数据库介绍

配置文件详解

实例模板 中的components配置内容是通过关键字自动生成相应组件(选择使用),另可新增配置,新增配置同样可在自己的项目中通过viper获得

server

  1. type: 选择http、thrift、jsonrpc2和rpcx中的一种
  2. addr: 服务启动port
  3. log: 选择seelog的配置文件,若这个字段不填,则使用默认配置

components.router

  1. type: 可选http和jsonrpc2,分别部署不同形式的handler
  2. default:为一个数组,里面包括不同的路径路由到不同的handler上

components.mysql

mysql配置,如果不是用mysql可以删除掉mysql的配置

  1. type: 必填container,用于生成mysql子容器
  2. default:在mysql的container中生成default数据库
  • type: 表示数据库的种类
  • Driver: 表示底层使用的驱动器
  • DSN: 表示写库的位置
  • Reads: 表示读库的位置
  1. local:在container中生成local数据库

components.mongo

mongo配置,如果不适用mongo数据库可以删除掉mongo的配置

  1. type: 必填container,用于生成mongo子容器
  2. default: 在mongo的container中生成default数据库
  • type:表示数据库的种类
  • Addresses:mongo地址,可以传入数组

components.redis

  1. type: 必填container,用于生成redis子容器
  2. default: 在redis的container中生成default数据库
  • Password:如果redis没有密码,请传入空字符串

components.template

导入web模板

开发实例

  1. http开发
  1. thrift开发
  1. 基于http的jsonrpc2开发

pgo's People

Contributors

penguinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

puwenhan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.