ego

package module
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 7 Imported by: 4

README

说明

简单易用又强大的微服务golang框架。

特性

  • http服务
  • 定时任务
  • 丰富的中间件:请求日志、JWT认证,跨域,Recover,全局链路
  • 集成Redis,Mysql,Jwt,Etcd客户端等基础组件
  • 配置项
  • 参数验证器
  • curl组件
  • Swagger

Getting Started

  • Install
go get github.com/ebar-go/ego
  • main
package main

import (
	"github.com/ebar-go/ego"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	aggregator := ego.NewAggregatorServer()

	httpServer := ego.NewHTTPServer(":8080").
		RegisterRouteLoader(func(router *gin.Engine) {
			router.GET("/", func(ctx *gin.Context) {
				ctx.String(http.StatusOK, "home")
			})
		})


	aggregator.WithServer(httpServer)

	aggregator.Run()
}

文档

详细文档地址:https://ebar-go.github.io

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCServer added in v1.1.0

func NewGRPCServer(addr string) *grpc.Server

NewGRPCServer creates a new grpc server instance.

func NewHTTPServer added in v1.1.0

func NewHTTPServer(addr string) *http.Server

NewHttpServer creates a new http server instance.

Types

type Engine added in v1.1.3

type Engine struct {
	// contains filtered or unexported fields
}

Engine includes the components and servers

func (*Engine) NonBlockingRun added in v1.1.3

func (engine *Engine) NonBlockingRun()

NonBlockingRun runs the engine with block until os.Exit.

func (*Engine) Run added in v1.1.3

func (engine *Engine) Run()

Run runs the engine with blocking mode.

func (*Engine) WithComponent added in v1.1.3

func (engine *Engine) WithComponent(components ...component.Component) *Engine

WithComponent use the provided components.

func (*Engine) WithServer added in v1.1.3

func (engine *Engine) WithServer(servers ...server.Server) *Engine

WithServer use the provided servers.

type NamedEngine added in v1.1.3

type NamedEngine struct {
	*Engine
	// contains filtered or unexported fields
}

NamedEngine define engine with name.

func New added in v1.1.3

func New() *NamedEngine

New creates a new NamedEngine instance with default name.

func NewNamedEngine added in v1.1.3

func NewNamedEngine(name string) *NamedEngine

NewNamedEngine creates a new named engine.

func (*NamedEngine) Run added in v1.1.3

func (engine *NamedEngine) Run()

Run override engine Run function.

Directories

Path Synopsis
examples
echo Module
grpc Module
utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL