nebula

package module
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

nebula

Version

go版本:go 1.13 micro版本:micro 自建镜像2.2.0

Install

go get github.com/Wall-js/nebula
export GOPROXY=https://goproxy.cn,direct golang替换国源

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPRIVATE=*.hiqio.com,*.gitlab.com,*.gitee.com //跳过私有库

Demo

服务配置规范

####节点命名

/集群名/命名空间/类型(srv,api,web,evt)/系统/版本(/id)(括号部分可不使用)

/default/nebula/srv/nebula-core/v0.1(/nebula.core.srv)

/cluster/namespace/type/system/version(/appId)
Type

页面web,接口api,服务srv,事件evt

Starting
func main() {
	nebula.SetName("nebula.core.srv")
	hello.RegisterHelloHandler(nebula.Service.Server(), new(handler.Hello))
	micro.RegisterSubscriber("nebula.core.srv.hello", nebula.Service.Server(), new(subscriber.Hello))
	micro.RegisterSubscriber("nebula.core.srv.hello", nebula.Service.Server(), subscriber.Handler)
	nebula.Run()
}
Config

-confAddr 127.0.0.1:8500 -prefix nebula/config -t

    version := nebula.Conf.Get("version").String("unknown")
    name := nebula.Conf.Get("config","name").String("unknown")
Web
func main() {
	nebula.SetName("go.micro.api.greeter")
	router := gin.New()
	say := new(Say)
	router.GET("/greeter", say.Anything)
	// Register Handler
	nebula.Web.Handle("/", router)
	nebula.RunWeb()
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Conf, _       = config.NewConfig()
	Service       micro.Service
	Web           web.Service
	DefaultPrefix string
	PrefixSlice   []string

	AppId string

	ConfAddr string

	Test bool
)

Functions

func AddPrefix added in v1.18.7

func AddPrefix(s string)

func AddTestPrefix added in v1.19.5

func AddTestPrefix(s *string)

func BeforeStart added in v1.18.8

func BeforeStart(f ...func())

func CommonProcess added in v1.18.7

func CommonProcess()

func Run

func Run()

func RunProcess added in v1.17.5

func RunProcess(process func(context.Context, context.CancelFunc) error)

func RunWeb added in v1.17.4

func RunWeb()

func SetName added in v1.17.4

func SetName(s string)

func SetVersion added in v1.18.7

func SetVersion(version string)

Types

type RunLevel added in v1.21.1

type RunLevel int
const (
	DEBUG RunLevel = iota
	TEST
	PROD
)

Jump to

Keyboard shortcuts

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