Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //当前系统的注册管理器 CurrentRegistry registry.Registry )
Functions ¶
func NewGateHttp ¶
func NewGateHttp(opts ...conf.SetConfigItem) *gatehttp.GateHttp
Types ¶
type Service ¶
type Service interface { // The service name //Name() string // Init initialises options Init(...conf.SetConfigItem) Server() *grpc.Server Register() registry.Registry // Options returns the current options //Options() Options // Client is used to call services // Client() client.Client // Server is for handling requests and events // Server() server.Server // Run the service Run() error }
func NewService ¶
func NewService(opts ...conf.SetConfigItem) Service
type Options struct { Port int Name string ServiceID string Version string Registry registry.Registry }
func Port(port int) Option { return func(o *Options) { o.Port = port } }
func Name(name string) Option { return func(o *Options) { o.Name = name } }
func ServiceID(sid string) Option { return func(o *Options) { o.ServiceID = sid } }
func newOptions(opts ...Option) Options { //var wdPath, confPath, Logdir, BIdir *string //var ProcessID *string opt := Options{ Port: 9003, Registry: consule.NewConsulRegistry(), //.DefaultRegistry, } for _, o := range opts { o(&opt) } return opt }
Click to show internal directories.
Click to hide internal directories.