Pass client to more of the runtime
This commit is contained in:
@@ -3,6 +3,8 @@ package store
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/client"
|
||||
)
|
||||
|
||||
// Options contains configuration for the Store
|
||||
@@ -17,6 +19,8 @@ type Options struct {
|
||||
Table string
|
||||
// Context should contain all implementation specific options, using context.WithValue.
|
||||
Context context.Context
|
||||
// Client to use for RPC
|
||||
Client client.Client
|
||||
}
|
||||
|
||||
// Option sets values in Options
|
||||
@@ -52,6 +56,13 @@ func WithContext(c context.Context) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithClient sets the stores client to use for RPC
|
||||
func WithClient(c client.Client) Option {
|
||||
return func(o *Options) {
|
||||
o.Client = c
|
||||
}
|
||||
}
|
||||
|
||||
// ReadOptions configures an individual Read operation
|
||||
type ReadOptions struct {
|
||||
Database, Table string
|
||||
|
Reference in New Issue
Block a user