Giter Club home page Giter Club logo

ego's Introduction

EGO

Go Go Report Card codecov goproxy.cn Release License: MIT

帮助文档

https://ego.gocn.vip

介绍

EGO是一个集成里各种工程实践的框架。通过组件化的设计模式,保证了业务方能够统一的调用方式启动各种组件

使用EGO的优势

  • 配置化驱动组件
  • 屏蔽底层组件启动细节
  • 微服务组件的可观测、可治理
  • 可插拔的Ego-Component组件
  • Fail Fast理念和错误友好提示

功能

特性介绍

  • 配置驱动 所有组件启动方式为组件名称.Load("配置名称").Build(),可以创建一个组件实例。如以下http serveregin是组件名称,server.http是配置名称
egin.Load("server.http").Build()
  • 友好的debug 可以看到所有组件的请求参数和响应参数信息
  • 链路 使用opentrace协议,自动将链路加入到日志里
  • 统一的错误信息
  • 统一的监控信息

Quick Start

HelloWorld

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))
   }
}

使用命令行运行

export EGO_DEBUG=true # 默认日志输出到logs目录,开启dev后日志输出到终端
go run main.go --config=config.toml

如下所示

图片

这个时候我们可以发送一个指令,得到如下结果

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

更加友好的包编译

使用scripts文件夹里的包编译,可以看到优雅的version提示

图片

ego's People

Contributors

askuy avatar flycash avatar neoyeelf avatar sevennt avatar shaoyuan1943 avatar

Watchers

 avatar

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.