All Projects → gotomicro → ego

gotomicro / ego

Licence: MIT license
Go微服务.A simple and component-based microservice kit for go.

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to ego

Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+132.68%)
Mutual labels:  gin, gorm
laya-template
服务基本框架,template
Stars: ✭ 13 (-98.3%)
Mutual labels:  gin, gorm
Zendea
A free, open-source, self-hosted forum software written in Go 官方QQ群:656868
Stars: ✭ 116 (-84.84%)
Mutual labels:  gin, gorm
pink-lady
a template project of gin app.
Stars: ✭ 44 (-94.25%)
Mutual labels:  gin, gorm
Goweibo
Go Weibo App
Stars: ✭ 243 (-68.24%)
Mutual labels:  gin, gorm
Logrus
Hooks for logrus logging
Stars: ✭ 110 (-85.62%)
Mutual labels:  gin, gorm
Gosql
golang orm and sql builder
Stars: ✭ 141 (-81.57%)
Mutual labels:  gin, gorm
Goforum
Let's go a forum
Stars: ✭ 23 (-96.99%)
Mutual labels:  gin, gorm
Go init
一个用go组织项目结构,主要包括 gin, goredis, gorm, websocket, rabbitmq等。👉
Stars: ✭ 183 (-76.08%)
Mutual labels:  gin, gorm
Goilerplate
Clean Boilerplate of Go, Domain-Driven Design, Clean Architecture, Gin and GORM.
Stars: ✭ 173 (-77.39%)
Mutual labels:  gin, gorm
Ugin
UGin is an API boilerplate written in Go (Golang) with Gin Framework.
Stars: ✭ 110 (-85.62%)
Mutual labels:  gin, gorm
ginadmin
基于Gin开发的后台管理系统,集成了、数据库操作、日志管理、权限分配管理、多模板页面、自动分页器、数据库迁移和填充、Docker集成部署等功能、静态资源打包
Stars: ✭ 149 (-80.52%)
Mutual labels:  gin, gorm
Ginbro
Converting a MySQL database'schema to a RESTful golang APIs app in the fastest way
Stars: ✭ 97 (-87.32%)
Mutual labels:  gin, gorm
Ultimate Go
This repo contains my notes on working with Go and computer systems.
Stars: ✭ 1,530 (+100%)
Mutual labels:  gin, gorm
Duckygo
一个同时支持Session以及JWT的高性能高可用 Golang Restful API 脚手架 !
Stars: ✭ 57 (-92.55%)
Mutual labels:  gin, gorm
Gin bbs
Gin BBS App
Stars: ✭ 123 (-83.92%)
Mutual labels:  gin, gorm
Go Gin Api
基于 Gin 进行模块化设计的 API 框架,封装了常用功能,使用简单,致力于进行快速的业务研发。比如,支持 cors 跨域、jwt 签名验证、zap 日志收集、panic 异常捕获、trace 链路追踪、prometheus 监控指标、swagger 文档生成、viper 配置文件解析、gorm 数据库组件、gormgen 代码生成工具、graphql 查询语言、errno 统一定义错误码、gRPC 的使用 等等。
Stars: ✭ 730 (-4.58%)
Mutual labels:  gin, gorm
Wblog
基于gin+gorm开发的个人博客项目
Stars: ✭ 763 (-0.26%)
Mutual labels:  gin, gorm
Cmall Go
golang写的电子商城的API接口
Stars: ✭ 167 (-78.17%)
Mutual labels:  gin, gorm
go api boilerplate
🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate
Stars: ✭ 127 (-83.4%)
Mutual labels:  gin, gorm

EGO

All Contributors Go Go Report Card codecov goproxy.cn Release License: MIT Example Doc

English | 简体中文

1 Docs

The offical docs for developers.

View https://ego.gocn.vip

2 Introduction

EGO is a microservice-oriented governance framework implemented by golang, which integrates various engineering practices. Through the component-based design pattern, it is guaranteed that the business development can use various components in a unified way.

Advantages of EGO:

  • Configure drive components
  • Shield the startup details of the underlying components
  • Observation and governance of microservice components
  • Pluggable Ego-Component
  • Fail Fast principle and friendly error prompts

2.1 Improve component proficiency

For us engineers to improve component proficiency, we must first read a lot of open source component documentation and code, and then insist on using it for a long time in order to form muscle memory and improve our speed of doing business. And the time and energy invested in all of this is enormous.

To reduce this input cost and allow more developers to better use excellent open source components, EGO's approach is to standardize all open source components, encapsulate them, and unify various behaviors.

  • Unified component file name
  • Unified component configuration parameters
  • Unified component call API
  • Unify component error behavior
  • Unified component monitoring behavior

Once you have mastered one component, you can use other components by inference.

2.2 Improve the efficiency of troubleshooting

  • Unified error code
  • Component errors, slow responses, links, regular request interceptor points (both server and client will intercept)
  • Convergence error field
  • Inject key information into components: code line number, configuration name, target address, time-consuming, request data, response data
  • Debugging stage, error highlighting, formatting friendly prompts
  • In the debugging phase, the component has a built-in debug interceptor

2.3 Automatically generate duplicate code(EGO CLI)

  • Generate code, configuration, data parsing, template separation
  • Build project code independently of language
  • Use the Go1.16 feature embed, start the webUI, and generate code
  • Project: https://github.com/gotomicro/egoctl

3 Ego Component

We have Many EGO components to support your rapid development

Component Name Code Example Doc
HTTP Server Code Example Doc
gRPC Server Code Example Doc
Governance Service Code Example Doc
Job Code Example Doc
Corn job Code Example Doc
Distributed Scheduled Job Code Example Doc
HTTP Client Code Example Doc
gRPC Client Code Example Doc
gRPC Client using ETCD Code Example Doc
gRPC Client using k8s Code Example Doc
Sentinel Code Example Doc
MySQL Code Example Doc
Redis Code Example Doc
Redis Distributed lock Code Example Doc
Mongo Code Example Doc
Kafka Code Example Doc
ETCD Code Example Doc
K8S Code Example Doc
Oauth2 Code Example

4 Definition

4.1 Framework Layer

EGO framework has three layers:

  • The core layer provides configuration, logging, monitoring and links, and is the cornerstone of other components.
  • The component layer provides various components in the client, server and task.
  • The glue layer controls the life cycle of various components, error handling.

4.2 Architecture

4.3 Life cycle

4.4 Component Layer

We consider everything to be a component and divide the component into four parts:

  • Container handles component type, configuration and component startup
  • Config configure parameters
  • Component The calling method of the component
  • Options the options of configuration and component

5 Version Requirements

  • Below v0.8.2, Go version needs to be greater than Go1.13.
  • After v0.8.3, Go version needs to be greater than Go1.16.
  • After v1.0.0, Go version needs to be greater than Go1.17.

6 Download Tool

bash <(curl -L https://raw.githubusercontent.com/gotomicro/egoctl/main/getlatest.sh)

Through the above script, you can download the protoc tools, EGO protoc plugin and egoctl.

  • /usr/local/bin/egoctl EGO Cli
  • /usr/local/bin/protoc Generate Pb tool
  • /usr/local/bin/protoc-gen-go Generate Pb tool
  • /usr/local/bin/protoc-gen-go-grpc Generate gRPC tool
  • /usr/local/bin/protoc-gen-go-errors Generate error code tool
  • /usr/local/bin/protoc-gen-openapiv2 Generate HTTP tool
  • /usr/local/bin/protoc-gen-go-http Generate HTTP tool

7 Features

  • Configuration driver The startup method of all components is component name.Load("configuration name").Build(), which can create a component instance. For example, http server below, egin is the component name, server.http is the configuration name

    egin.Load("server.http").Build()
  • friendly debug By enabling the debug configuration and export EGO_DEBUG=true on the command line,

    We can see the line number, configuration name, request address, time-consuming, request data, and response data in the request of all components in the test environment

And using Goland, you can directly click to the corresponding code path through the line number (gRPC, HTTP client support line number)

  • Tracing Use the opentelemetry protocol to automatically add Tracing to the log

    • gRPC Tracing

      image

      • Client Tracing information

      image

    • HTTP Tracing

    • Ali arms Tracing

  • Unified error message

  • Unified monitoring information

8 Quick Start

8.1 HelloWorld

Configuration

[server.http]
    port = 9001
    host = "0.0.0.0"

Code

package main
import (
   "github.com/gin-gonic/gin"
   "github.com/gotomicro/ego"
   "github.com/gotomicro/ego/core/elog"
   "github.com/gotomicro/ego/server"
   "github.com/gotomicro/ego/server/egin"
)
//  export EGO_DEBUG=true && go run main.go --config=config.toml
func main() {
   if err := ego.New().Serve(func() *egin.Component {
      server := egin.Load("server.http").Build()
      server.GET("/hello", func(ctx *gin.Context) {
         ctx.JSON(200, "Hello EGO")
         return
      })
      return server
   }()).Run(); err != nil {
      elog.Panic("startup", elog.FieldErr(err))
   }
}

8.2 Using the command line to run

export EGO_DEBUG=true # The default log is output to the logs directory, and after dev mode is enabled, the log is output to the terminal
go run main.go --config=config.toml

8.3 Result

图片

At this time, we can send a command and get the following result

➜  helloworld git:(master) ✗ curl http://127.0.0.1:9001/hello
"Hello Ego"%  

8.4 More friendly package compilation

Use build in the scripts folder, you can see the elegant version prompt.

图片

9 Changelog

Releases

10 Join us

To join our Wechat comminication group, add the ego keyword in the verification information.

wechat-qrcode

Contributors

Thanks for these wonderful people:


askuy

Wei Zheng

shaoyuan

Panda

刘文哲

zhangjunjun

devincd

Ming Deng

Angelia

Wbofeng

clannadxr

Link Duan

Costa

MEX7

LincolnZhou

optimistic9527

soeluc

Thank JetBrains for Open Source licenses support

JetBrains

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].