Documentation
¶
Index ¶
- func NewClient(addr net.Addr, m docmarshal.Marshaler, opts ...grpc.DialOption) (storageapi.Service, error)
- func RegisterCollectionDocumentService(registrar grpc.ServiceRegistrar, srv docpb.DocumentStoreServer, ...)
- type Client
- func (c *Client) Close() error
- func (c *Client) Create(ctx context.Context, ID string, data interface{}) error
- func (c *Client) Delete(ctx context.Context, ID string) error
- func (c *Client) Get(ctx context.Context, ID string, doc interface{}) error
- func (c *Client) Init(cc grpc.ClientConnInterface, m docmarshal.Marshaler)
- func (c *Client) InitWithCollection(cc grpc.ClientConnInterface, m docmarshal.Marshaler, collection string)
- func (c *Client) List(ctx context.Context, filters []storageapi.Filter) (storageapi.Iterator, error)
- func (c *Client) Set(ctx context.Context, ID string, data interface{}) error
- func (c *Client) Update(ctx context.Context, ID string, updates []storageapi.Update, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient( addr net.Addr, m docmarshal.Marshaler, opts ...grpc.DialOption, ) (storageapi.Service, error)
NewClient returns a grpc-based client that satisfies Service by relaying operations to remote datastore server. See NewServer for more details.
func RegisterCollectionDocumentService ¶ added in v0.0.2
func RegisterCollectionDocumentService( registrar grpc.ServiceRegistrar, srv docpb.DocumentStoreServer, collection string, )
RegisterCollectionDocumentService registers the given srv with the given registrar with a custom service description name, that enables registering one service per collection. Client.InitWithCollection should be used on the client side to talk to a service registered via this function.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Init ¶
func (c *Client) Init(cc grpc.ClientConnInterface, m docmarshal.Marshaler)
func (*Client) InitWithCollection ¶ added in v0.0.2
func (c *Client) InitWithCollection( cc grpc.ClientConnInterface, m docmarshal.Marshaler, collection string, )
InitWithCollection initializes this Client with the given grpc connection, encoding marhshaler, and uses collection to suffix the service descriptor to enable multiple collection services registered in the same server. Server should be registered with grpc via RegisterCollectionDocumentService.
func (*Client) List ¶
func (c *Client) List( ctx context.Context, filters []storageapi.Filter, ) (storageapi.Iterator, error)
func (*Client) Update ¶
func (c *Client) Update( ctx context.Context, ID string, updates []storageapi.Update, preconds ...storageapi.Precondition, ) error