Giter Club home page Giter Club logo

goms's Introduction

goms

License Language Go Report Card ci

Introduction

本库的目的是学习如何用 go 语言开发微服务.

我们先通过手动的方式一步一步地构建一个微服务,感受开发过程中的痛点.然后,再用微服务框架开发,发现这些痛点是怎样被框架解决,这样有助于我们理解框架为何这样设计,达到知其所以然的目的.

目前微服务框架有两种:

  • 一种以库的形式提供中间件的 sdk 模式,如 Kratos;
  • 一种以进程的形式提供中间件的 sidecar 模式,也叫 service mesh,如 Istio.

两者各有优势:

  • sdk 模式以函数调用的方式使用中间件;
  • sidecar 模式以进程间通讯的方式使用中间件;

因此:

  • sdk 模式的性能优于 sidecar 模式;
  • sidecar 模式的解耦性优于 sdk 模式;

以上介绍的是微服务的实现,微服务的另一个重要方面是设计,这部分内容参考领域驱动设计(DDD).

Repositories

  • eDocker. 主题应用容器化, docker 是广泛使用的打包应用和依赖的容器.

  • eModule. 主题依赖管理, go module 是 go 标准的依赖管理工具.

  • eYaml. 主题数据序列化, yaml 格式,常用作配置/编排文件.

  • eFlag. 主题命令行参数处理, 使用准库 flag 包.

  • eHttp. 主题 http 服务, 使用 Gin 框架.

  • eGrpc. 主题 rpc 服务, 使用 gRPC 框架.

  • eConf. 主题服务的配置, 一个简单的 conf 包.

  • eMysql. 主题关系型数据库, 常用的 MySQL.

  • eRedis. 主题缓存数据库, 常用的 Redis.

  • eTest. 主题测试, 覆盖各种类型的测试.

  • eApi. 主题 API 管理, 使用 swagger 等工具.

  • eK8s. 主题微服务部署, 使用 K8s 部署一组微服务.

  • eIstio. 主题微服务治理, 使用 Istio 治理一组微服务.

  • eKratos. 主题微服务框架, 使用 Kratos 开发一个微服务.

Issue management

欢迎提交 bugs 和 feature 报告.

goms's People

Contributors

aivuca avatar fuwensun avatar xxxertetet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gomyhaha go2020my

goms's Issues

重构 eModule

1,独立出helloword,hello,word三个库
2,goms 直接依赖 helloword, 间接依赖 hello 和 word
3,helloword 直接依赖 hello 和 word
这样在go.mod中显示直接依赖和间接依赖的区别

加强 eYaml

当要解析的 yaml 文件找不到时,自动生成一个 yaml 文件,并解析它.
这样在 install 模式使用时,不用依赖 yaml 文件.

开发 eK8s

大体思路,
1,从一个极简的服务编排开始,只带 api 接口

只带 api 接口是极简,比带 MySQL 的简单的多,因此 v1.0.0 不要带上 eMysql 模块.

dao 包单元测试

主要问题:
dao 外部依赖 mysql 库?

解决方案:

func TestMain(){     
	tearup(){   
		bash 文件启动 mysql docker 
		连接 mysql docker
	}
	
	调用 dao 函数进行测试
	
	teardown(){
		关闭 mysql 连接
		关闭 msyql docker
	}
}

可行???

加eApi

1,swagger
2,createuser() 要返回user或uid,入参和出参要分开,不然mock时没法mock出参

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.