Documentation
¶
Index ¶
- func NewClient(addr net.Addr, m docmarshal.Marshaler, opts ...grpc.DialOption) (document.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 any) error
- func (c *Client) Delete(ctx context.Context, ID string) error
- func (c *Client) Get(ctx context.Context, ID string, doc any) 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 []document.Filter) (document.Iterator, error)
- func (c *Client) Set(ctx context.Context, ID string, data any) error
- func (c *Client) Update(ctx context.Context, ID string, updates []document.Update, ...) error
- type Server
- func (s *Server) Create(ctx context.Context, req *docpb.CreateDocumentRequest) (res *docpb.CreateDocumentResponse, err error)
- func (s *Server) Delete(ctx context.Context, req *docpb.DeleteDocumentRequest) (res *docpb.DocumentResponse, err error)
- func (s *Server) Get(ctx context.Context, req *docpb.GetDocumentRequest) (res *docpb.GetDocumentResponse, err error)
- func (s *Server) Init(other document.Service, m docmarshal.Marshaler)
- func (s *Server) List(req *docpb.ListDocumentRequest, list docpb.DocumentStore_ListServer) error
- func (s *Server) Set(ctx context.Context, req *docpb.SetDocumentRequest) (res *docpb.DocumentResponse, err error)
- func (s *Server) Update(ctx context.Context, req *docpb.UpdateDocumentRequest) (*docpb.UpdateDocumentResponse, 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, ) (document.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 ¶
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 ¶
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.
type Server ¶
type Server struct {
docpb.UnimplementedDocumentStoreServer
// contains filtered or unexported fields
}
Server wraps another document.Service and exposes it through a grpc interface.
func NewServer ¶
func NewServer(other document.Service, m docmarshal.Marshaler) *Server
NewServer allocates storage for a new Server and initializes it.
func (*Server) Create ¶
func (s *Server) Create( ctx context.Context, req *docpb.CreateDocumentRequest, ) (res *docpb.CreateDocumentResponse, err error)
Create satisfies proto.DocumentStoreServer
func (*Server) Delete ¶
func (s *Server) Delete( ctx context.Context, req *docpb.DeleteDocumentRequest, ) (res *docpb.DocumentResponse, err error)
Delete satisfies proto.DocumentStoreServer
func (*Server) Get ¶
func (s *Server) Get( ctx context.Context, req *docpb.GetDocumentRequest, ) (res *docpb.GetDocumentResponse, err error)
Get satisfies proto.DocumentStoreServer
func (*Server) List ¶
func (s *Server) List( req *docpb.ListDocumentRequest, list docpb.DocumentStore_ListServer, ) error
List satisfies proto.DocumentStoreServer
func (*Server) Set ¶
func (s *Server) Set( ctx context.Context, req *docpb.SetDocumentRequest, ) (res *docpb.DocumentResponse, err error)
Set satisfies proto.DocumentStoreServer
func (*Server) Update ¶
func (s *Server) Update( ctx context.Context, req *docpb.UpdateDocumentRequest, ) (*docpb.UpdateDocumentResponse, error)
Update satisfies proto.DocumentStoreServer