meh
This commit is contained in:
18
options.go
18
options.go
@@ -1,6 +1,8 @@
|
||||
package micro
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli"
|
||||
"github.com/micro/go-micro/broker"
|
||||
"github.com/micro/go-micro/client"
|
||||
@@ -20,6 +22,10 @@ type Options struct {
|
||||
Registry registry.Registry
|
||||
Transport transport.Transport
|
||||
|
||||
// Registration options
|
||||
RegisterTTL time.Duration
|
||||
RegisterInterval time.Duration
|
||||
|
||||
// Before and After funcs
|
||||
BeforeStart []func() error
|
||||
AfterStop []func() error
|
||||
@@ -117,6 +123,18 @@ func Action(a func(*cli.Context)) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func RegisterTTL(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
o.RegisterTTL = t
|
||||
}
|
||||
}
|
||||
|
||||
func RegisterInterval(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
o.RegisterInterval = t
|
||||
}
|
||||
}
|
||||
|
||||
// Before and Afters
|
||||
|
||||
func BeforeStart(fn func() error) Option {
|
||||
|
Reference in New Issue
Block a user