micro/go-micro.go

43 lines
707 B
Go
Raw Normal View History

2015-12-21 02:50:16 +03:00
/*
Go micro provides a pluggable library to build microservices.
import (
micro "github.com/micro/go-micro"
)
2015-12-21 02:52:58 +03:00
service := micro.NewService()
2015-12-21 02:50:16 +03:00
h := service.Server().NewHandler(&Greeter{})
service.Server().Handle(h)
service.Run()
2015-12-21 02:52:58 +03:00
req := service.Client().NewRequest(service, method, request)
2015-12-21 02:50:16 +03:00
rsp := response{}
2015-12-21 02:52:58 +03:00
err := service.Client().Call(req, rsp)
2015-12-21 02:50:16 +03:00
*/
package gomicro
import (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/server"
)
type Service interface {
Client() client.Client
Server() server.Server
Run() error
String() string
}
type Option func(*Options)
var (
2015-12-21 04:12:29 +03:00
HeaderPrefix = "X-Micro-"
2015-12-21 02:50:16 +03:00
)
func NewService(opts ...Option) Service {
return newService(opts...)
}