Add store to options (#1600)
This commit is contained in:
10
options.go
10
options.go
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/micro/go-micro/v2/debug/trace"
|
||||
"github.com/micro/go-micro/v2/registry"
|
||||
"github.com/micro/go-micro/v2/server"
|
||||
"github.com/micro/go-micro/v2/store"
|
||||
"github.com/micro/go-micro/v2/transport"
|
||||
)
|
||||
|
||||
@@ -26,6 +27,7 @@ type Options struct {
|
||||
Config config.Config
|
||||
Client client.Client
|
||||
Server server.Server
|
||||
Store store.Store
|
||||
Registry registry.Registry
|
||||
Transport transport.Transport
|
||||
Profile profile.Profile
|
||||
@@ -51,6 +53,7 @@ func newOptions(opts ...Option) Options {
|
||||
Config: config.DefaultConfig,
|
||||
Client: client.DefaultClient,
|
||||
Server: server.DefaultServer,
|
||||
Store: store.DefaultStore,
|
||||
Registry: registry.DefaultRegistry,
|
||||
Transport: transport.DefaultTransport,
|
||||
Context: context.Background(),
|
||||
@@ -118,6 +121,13 @@ func Server(s server.Server) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Store sets the store to use
|
||||
func Store(s store.Store) Option {
|
||||
return func(o *Options) {
|
||||
o.Store = s
|
||||
}
|
||||
}
|
||||
|
||||
// Registry sets the registry for the service
|
||||
// and the underlying components
|
||||
func Registry(r registry.Registry) Option {
|
||||
|
||||
Reference in New Issue
Block a user