Code Monkey home page Code Monkey logo

go-zero-demo's Introduction

go-zero使用程序

功能试用

  • 错误提示
    • rpc和api通过使用code包方便传递给调用方错误信息
  • 支持中间件,方便扩展
  • 内建服务发现、负载均衡(基于grpc和etcd那一套)
  • 内建限流、熔断、降载,且自动触发,自动恢复
    • RestFul 通过内置的中间件已经实现。
    • GRPC 通过内置的Interceptor的已经实现。
  • API 参数自动校验
    • 在api文件和proto文件添加tag自动校验
  • 超时级联控制 context 传递?
  • 数据库缓存代码自动化生成,自动缓存控制
    # 内置工具通过sql文件自动化生成,也可以通过数据库表生成
    
    # 带redis缓存版本,操作MySQL版本
    goctl model mysql ddl -c -src user.sql -dir ./model
    
    # 不带redis缓存版本,只操作MySQL版本
    goctl model mysql ddl -src user.sql -dir ./model
  • 链路跟踪
  • 服务监控 服务监控目前没有支持服务对redis和mysql的调用监控。
    • promethus部署
  • 日志收集
  • 高并发支撑,高并发

运行

# 运行rpc服务
cd rpc
make run  

# 运行rest服务
cd api
make run 

创建用户

curl -v -X POST "http://localhost:8888/v1/user" \
  -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"password\": \"123456\", \"username\": \"frank\"}"

获取用户信息

curl -v "http://localhost:8888/v1/user/4"

压力测试

./wrktest.sh

参考资料

go-zero-demo's People

Contributors

feixiao avatar

Watchers

 avatar  avatar  avatar

Forkers

a95241815

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.