Open clh021 opened 2 years ago
go-kit的架构如图分为三层结构:Transport层,Endpoint层,Service层。 Transport层主要负责与传输协议HTTP,GRPC,THRIFT等相关的逻辑; Endpoint层主要负责request/response格式的转换,以及公用拦截器相关的逻辑; Service层则专注于业务逻辑,就是我们的业务类、接口等相关信息存放。 go-kit除了经典的分层架构外,还在endpoint层提供了很多公用的拦截器,如log,metric,tracing,circuitbreaker,rate-limiter等,来保障业务系统的可用性。
作者:Feng_Sir 链接:https://www.jianshu.com/p/a4f81147f9ec 來源:简书 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
尝试将一个接口输出同时支持 http和命令行的调用返回
推荐以下工具:
原生flag包 https://github.com/spf13/cobra https://github.com/urfave/cli
https://www.jianshu.com/p/a4f81147f9ec