Debian Codegraph @

go/svc/query/v1/queryv1connect/service.connect.go

raw symbols SCIP
1 // Code generated by protoc-gen-connect-go. DO NOT EDIT.
2 //
3 // Source: svc/query/v1/service.proto
4
5 package queryv1connect
6
7 import (
8 connect "connectrpc.com/connect"
9 context "context"
10 errors "errors"
11 v1 "github.com/humanlogio/api/go/svc/query/v1"
12 http "net/http"
13 strings "strings"
14 )
15
16 // This is a compile-time assertion to ensure that this generated file and the connect package are
17 // compatible. If you get a compiler error that this constant is not defined, this code was
18 // generated with a version of connect newer than the one compiled into your binary. You can fix the
19 // problem by either regenerating this code with an older version of connect or updating the connect
20 // version compiled into your binary.
21 const _ = connect.IsAtLeastVersion1_13_0
22
23 const (
24 // QueryServiceName is the fully-qualified name of the QueryService service.
25 QueryServiceName = "svc.query.v1.QueryService"
26 )
27
28 // These constants are the fully-qualified names of the RPCs defined in this package. They're
29 // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
30 //
31 // Note that these are different from the fully-qualified method names used by
32 // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
33 // reflection-formatted method names, remove the leading slash and convert the remaining slash to a
34 // period.
35 const (
36 // QueryServiceSummarizeEventsProcedure is the fully-qualified name of the QueryService's
37 // SummarizeEvents RPC.
38 QueryServiceSummarizeEventsProcedure = "/svc.query.v1.QueryService/SummarizeEvents"
39 // QueryServiceWatchQueryProcedure is the fully-qualified name of the QueryService's WatchQuery RPC.
40 QueryServiceWatchQueryProcedure = "/svc.query.v1.QueryService/WatchQuery"
41 // QueryServiceParseProcedure is the fully-qualified name of the QueryService's Parse RPC.
42 QueryServiceParseProcedure = "/svc.query.v1.QueryService/Parse"
43 // QueryServiceQueryProcedure is the fully-qualified name of the QueryService's Query RPC.
44 QueryServiceQueryProcedure = "/svc.query.v1.QueryService/Query"
45 // QueryServiceListSymbolsProcedure is the fully-qualified name of the QueryService's ListSymbols
46 // RPC.
47 QueryServiceListSymbolsProcedure = "/svc.query.v1.QueryService/ListSymbols"
48 )
49
50 // QueryServiceClient is a client for the svc.query.v1.QueryService service.
51 type QueryServiceClient interface {
52 SummarizeEvents(context.Context, *connect.Request[v1.SummarizeEventsRequest]) (*connect.Response[v1.SummarizeEventsResponse], error)
53 WatchQuery(context.Context, *connect.Request[v1.WatchQueryRequest]) (*connect.ServerStreamForClient[v1.WatchQueryResponse], error)
54 Parse(context.Context, *connect.Request[v1.ParseRequest]) (*connect.Response[v1.ParseResponse], error)
55 Query(context.Context, *connect.Request[v1.QueryRequest]) (*connect.Response[v1.QueryResponse], error)
56 ListSymbols(context.Context, *connect.Request[v1.ListSymbolsRequest]) (*connect.Response[v1.ListSymbolsResponse], error)
57 }
58
59 // NewQueryServiceClient constructs a client for the svc.query.v1.QueryService service. By default,
60 // it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and
61 // sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC()
62 // or connect.WithGRPCWeb() options.
63 //
64 // The URL supplied here should be the base URL for the Connect or gRPC server (for example,
65 // http://api.acme.com or https://acme.com/grpc).
66 func NewQueryServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) QueryServiceClient {
67 baseURL = strings.TrimRight(baseURL, "/")
68 queryServiceMethods := v1.File_svc_query_v1_service_proto.Services().ByName("QueryService").Methods()
69 return &queryServiceClient{
70 summarizeEvents: connect.NewClient[v1.SummarizeEventsRequest, v1.SummarizeEventsResponse](
71 httpClient,
72 baseURL+QueryServiceSummarizeEventsProcedure,
73 connect.WithSchema(queryServiceMethods.ByName("SummarizeEvents")),
74 connect.WithClientOptions(opts...),
75 ),
76 watchQuery: connect.NewClient[v1.WatchQueryRequest, v1.WatchQueryResponse](
77 httpClient,
78 baseURL+QueryServiceWatchQueryProcedure,
79 connect.WithSchema(queryServiceMethods.ByName("WatchQuery")),
80 connect.WithClientOptions(opts...),
81 ),
82 parse: connect.NewClient[v1.ParseRequest, v1.ParseResponse](
83 httpClient,
84 baseURL+QueryServiceParseProcedure,
85 connect.WithSchema(queryServiceMethods.ByName("Parse")),
86 connect.WithClientOptions(opts...),
87 ),
88 query: connect.NewClient[v1.QueryRequest, v1.QueryResponse](
89 httpClient,
90 baseURL+QueryServiceQueryProcedure,
91 connect.WithSchema(queryServiceMethods.ByName("Query")),
92 connect.WithClientOptions(opts...),
93 ),
94 listSymbols: connect.NewClient[v1.ListSymbolsRequest, v1.ListSymbolsResponse](
95 httpClient,
96 baseURL+QueryServiceListSymbolsProcedure,
97 connect.WithSchema(queryServiceMethods.ByName("ListSymbols")),
98 connect.WithClientOptions(opts...),
99 ),
100 }
101 }
102
103 // queryServiceClient implements QueryServiceClient.
104 type queryServiceClient struct {
105 summarizeEvents *connect.Client[v1.SummarizeEventsRequest, v1.SummarizeEventsResponse]
106 watchQuery *connect.Client[v1.WatchQueryRequest, v1.WatchQueryResponse]
107 parse *connect.Client[v1.ParseRequest, v1.ParseResponse]
108 query *connect.Client[v1.QueryRequest, v1.QueryResponse]
109 listSymbols *connect.Client[v1.ListSymbolsRequest, v1.ListSymbolsResponse]
110 }
111
112 // SummarizeEvents calls svc.query.v1.QueryService.SummarizeEvents.
113 func (c *queryServiceClient) SummarizeEvents(ctx context.Context, req *connect.Request[v1.SummarizeEventsRequest]) (*connect.Response[v1.SummarizeEventsResponse], error) {
114 return c.summarizeEvents.CallUnary(ctx, req)
115 }
116
117 // WatchQuery calls svc.query.v1.QueryService.WatchQuery.
118 func (c *queryServiceClient) WatchQuery(ctx context.Context, req *connect.Request[v1.WatchQueryRequest]) (*connect.ServerStreamForClient[v1.WatchQueryResponse], error) {
119 return c.watchQuery.CallServerStream(ctx, req)
120 }
121
122 // Parse calls svc.query.v1.QueryService.Parse.
123 func (c *queryServiceClient) Parse(ctx context.Context, req *connect.Request[v1.ParseRequest]) (*connect.Response[v1.ParseResponse], error) {
124 return c.parse.CallUnary(ctx, req)
125 }
126
127 // Query calls svc.query.v1.QueryService.Query.
128 func (c *queryServiceClient) Query(ctx context.Context, req *connect.Request[v1.QueryRequest]) (*connect.Response[v1.QueryResponse], error) {
129 return c.query.CallUnary(ctx, req)
130 }
131
132 // ListSymbols calls svc.query.v1.QueryService.ListSymbols.
133 func (c *queryServiceClient) ListSymbols(ctx context.Context, req *connect.Request[v1.ListSymbolsRequest]) (*connect.Response[v1.ListSymbolsResponse], error) {
134 return c.listSymbols.CallUnary(ctx, req)
135 }
136
137 // QueryServiceHandler is an implementation of the svc.query.v1.QueryService service.
138 type QueryServiceHandler interface {
139 SummarizeEvents(context.Context, *connect.Request[v1.SummarizeEventsRequest]) (*connect.Response[v1.SummarizeEventsResponse], error)
140 WatchQuery(context.Context, *connect.Request[v1.WatchQueryRequest], *connect.ServerStream[v1.WatchQueryResponse]) error
141 Parse(context.Context, *connect.Request[v1.ParseRequest]) (*connect.Response[v1.ParseResponse], error)
142 Query(context.Context, *connect.Request[v1.QueryRequest]) (*connect.Response[v1.QueryResponse], error)
143 ListSymbols(context.Context, *connect.Request[v1.ListSymbolsRequest]) (*connect.Response[v1.ListSymbolsResponse], error)
144 }
145
146 // NewQueryServiceHandler builds an HTTP handler from the service implementation. It returns the
147 // path on which to mount the handler and the handler itself.
148 //
149 // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
150 // and JSON codecs. They also support gzip compression.
151 func NewQueryServiceHandler(svc QueryServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
152 queryServiceMethods := v1.File_svc_query_v1_service_proto.Services().ByName("QueryService").Methods()
153 queryServiceSummarizeEventsHandler := connect.NewUnaryHandler(
154 QueryServiceSummarizeEventsProcedure,
155 svc.SummarizeEvents,
156 connect.WithSchema(queryServiceMethods.ByName("SummarizeEvents")),
157 connect.WithHandlerOptions(opts...),
158 )
159 queryServiceWatchQueryHandler := connect.NewServerStreamHandler(
160 QueryServiceWatchQueryProcedure,
161 svc.WatchQuery,
162 connect.WithSchema(queryServiceMethods.ByName("WatchQuery")),
163 connect.WithHandlerOptions(opts...),
164 )
165 queryServiceParseHandler := connect.NewUnaryHandler(
166 QueryServiceParseProcedure,
167 svc.Parse,
168 connect.WithSchema(queryServiceMethods.ByName("Parse")),
169 connect.WithHandlerOptions(opts...),
170 )
171 queryServiceQueryHandler := connect.NewUnaryHandler(
172 QueryServiceQueryProcedure,
173 svc.Query,
174 connect.WithSchema(queryServiceMethods.ByName("Query")),
175 connect.WithHandlerOptions(opts...),
176 )
177 queryServiceListSymbolsHandler := connect.NewUnaryHandler(
178 QueryServiceListSymbolsProcedure,
179 svc.ListSymbols,
180 connect.WithSchema(queryServiceMethods.ByName("ListSymbols")),
181 connect.WithHandlerOptions(opts...),
182 )
183 return "/svc.query.v1.QueryService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
184 switch r.URL.Path {
185 case QueryServiceSummarizeEventsProcedure:
186 queryServiceSummarizeEventsHandler.ServeHTTP(w, r)
187 case QueryServiceWatchQueryProcedure:
188 queryServiceWatchQueryHandler.ServeHTTP(w, r)
189 case QueryServiceParseProcedure:
190 queryServiceParseHandler.ServeHTTP(w, r)
191 case QueryServiceQueryProcedure:
192 queryServiceQueryHandler.ServeHTTP(w, r)
193 case QueryServiceListSymbolsProcedure:
194 queryServiceListSymbolsHandler.ServeHTTP(w, r)
195 default:
196 http.NotFound(w, r)
197 }
198 })
199 }
200
201 // UnimplementedQueryServiceHandler returns CodeUnimplemented from all methods.
202 type UnimplementedQueryServiceHandler struct{}
203
204 func (UnimplementedQueryServiceHandler) SummarizeEvents(context.Context, *connect.Request[v1.SummarizeEventsRequest]) (*connect.Response[v1.SummarizeEventsResponse], error) {
205 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.query.v1.QueryService.SummarizeEvents is not implemented"))
206 }
207
208 func (UnimplementedQueryServiceHandler) WatchQuery(context.Context, *connect.Request[v1.WatchQueryRequest], *connect.ServerStream[v1.WatchQueryResponse]) error {
209 return connect.NewError(connect.CodeUnimplemented, errors.New("svc.query.v1.QueryService.WatchQuery is not implemented"))
210 }
211
212 func (UnimplementedQueryServiceHandler) Parse(context.Context, *connect.Request[v1.ParseRequest]) (*connect.Response[v1.ParseResponse], error) {
213 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.query.v1.QueryService.Parse is not implemented"))
214 }
215
216 func (UnimplementedQueryServiceHandler) Query(context.Context, *connect.Request[v1.QueryRequest]) (*connect.Response[v1.QueryResponse], error) {
217 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.query.v1.QueryService.Query is not implemented"))
218 }
219
220 func (UnimplementedQueryServiceHandler) ListSymbols(context.Context, *connect.Request[v1.ListSymbolsRequest]) (*connect.Response[v1.ListSymbolsResponse], error) {
221 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.query.v1.QueryService.ListSymbols is not implemented"))
222 }