package micro import ( "git.nspix.com/golang/micro/gateway/cli" "git.nspix.com/golang/micro/gateway/http" "git.nspix.com/golang/micro/gateway/rpc" "git.nspix.com/golang/micro/registry" "time" ) var ( std *Service ) func Init(opts ...Option) *Service { std = New(opts...) return std } func Node() *registry.ServiceNode { if std == nil{ panic("init first") } return std.Node() } func HttpServe() *http.Server { if std == nil{ panic("init first") } return std.HttpServe() } func RPCServe() *rpc.Server { if std == nil{ panic("init first") } return std.RPCServe() } func CliServe() *cli.Server { if std == nil{ panic("init first") } return std.CliServe() } func PeekService(name string) ([]*registry.ServiceNode, error) { if std == nil{ panic("init first") } return std.PeekService(name) } func Handle(method string, cb HandleFunc, opts ...HandleOption) { if std == nil{ panic("init first") } std.Handle(method, cb, opts...) } func NewRequest(name, method string, body interface{}) (req *Request, err error) { if std == nil{ panic("init first") } return std.NewRequest(name, method, body) } func DeferTick(duration time.Duration, callback HandleTickerFunc, opts ...TickOption) int64 { if std == nil{ panic("init first") } return std.DeferTick(duration, callback, opts...) } func Environment() string { if std == nil{ panic("init first") } return std.Environment() }