Pass client to more of the runtime

This commit is contained in:
Ben Toogood
2020-05-11 17:57:39 +01:00
parent f892b41299
commit efb64b7dbb
10 changed files with 56 additions and 20 deletions

View File

@@ -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