// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v4.25.1
// source: couchbase/view/v1/view.proto

package view_v1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// ViewServiceClient is the client API for ViewService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ViewServiceClient interface {
	ViewQuery(ctx context.Context, in *ViewQueryRequest, opts ...grpc.CallOption) (ViewService_ViewQueryClient, error)
}

type viewServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewViewServiceClient(cc grpc.ClientConnInterface) ViewServiceClient {
	return &viewServiceClient{cc}
}

func (c *viewServiceClient) ViewQuery(ctx context.Context, in *ViewQueryRequest, opts ...grpc.CallOption) (ViewService_ViewQueryClient, error) {
	stream, err := c.cc.NewStream(ctx, &ViewService_ServiceDesc.Streams[0], "/couchbase.view.v1.ViewService/ViewQuery", opts...)
	if err != nil {
		return nil, err
	}
	x := &viewServiceViewQueryClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type ViewService_ViewQueryClient interface {
	Recv() (*ViewQueryResponse, error)
	grpc.ClientStream
}

type viewServiceViewQueryClient struct {
	grpc.ClientStream
}

func (x *viewServiceViewQueryClient) Recv() (*ViewQueryResponse, error) {
	m := new(ViewQueryResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// ViewServiceServer is the server API for ViewService service.
// All implementations must embed UnimplementedViewServiceServer
// for forward compatibility
type ViewServiceServer interface {
	ViewQuery(*ViewQueryRequest, ViewService_ViewQueryServer) error
	mustEmbedUnimplementedViewServiceServer()
}

// UnimplementedViewServiceServer must be embedded to have forward compatible implementations.
type UnimplementedViewServiceServer struct {
}

func (UnimplementedViewServiceServer) ViewQuery(*ViewQueryRequest, ViewService_ViewQueryServer) error {
	return status.Errorf(codes.Unimplemented, "method ViewQuery not implemented")
}
func (UnimplementedViewServiceServer) mustEmbedUnimplementedViewServiceServer() {}

// UnsafeViewServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ViewServiceServer will
// result in compilation errors.
type UnsafeViewServiceServer interface {
	mustEmbedUnimplementedViewServiceServer()
}

func RegisterViewServiceServer(s grpc.ServiceRegistrar, srv ViewServiceServer) {
	s.RegisterService(&ViewService_ServiceDesc, srv)
}

func _ViewService_ViewQuery_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ViewQueryRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ViewServiceServer).ViewQuery(m, &viewServiceViewQueryServer{stream})
}

type ViewService_ViewQueryServer interface {
	Send(*ViewQueryResponse) error
	grpc.ServerStream
}

type viewServiceViewQueryServer struct {
	grpc.ServerStream
}

func (x *viewServiceViewQueryServer) Send(m *ViewQueryResponse) error {
	return x.ServerStream.SendMsg(m)
}

// ViewService_ServiceDesc is the grpc.ServiceDesc for ViewService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ViewService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "couchbase.view.v1.ViewService",
	HandlerType: (*ViewServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ViewQuery",
			Handler:       _ViewService_ViewQuery_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "couchbase/view/v1/view.proto",
}
