Skip to main content

nominal_api_proto/proto/
nominal.sql.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct SqlServiceQueryRequest {
4    #[prost(string, tag = "1")]
5    pub query: ::prost::alloc::string::String,
6    #[prost(int32, optional, tag = "2")]
7    pub max_rows: ::core::option::Option<i32>,
8    #[prost(string, tag = "3")]
9    pub workspace_rid: ::prost::alloc::string::String,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct SqlServiceQueryResponse {
13    #[prost(bytes = "vec", tag = "1")]
14    pub arrow_payload: ::prost::alloc::vec::Vec<u8>,
15    #[prost(string, tag = "2")]
16    pub query_id: ::prost::alloc::string::String,
17}
18/// Generated client implementations.
19pub mod sql_service_client {
20    #![allow(
21        unused_variables,
22        dead_code,
23        missing_docs,
24        clippy::wildcard_imports,
25        clippy::let_unit_value,
26    )]
27    use tonic::codegen::*;
28    use tonic::codegen::http::Uri;
29    #[derive(Debug, Clone)]
30    pub struct SqlServiceClient<T> {
31        inner: tonic::client::Grpc<T>,
32    }
33    impl SqlServiceClient<tonic::transport::Channel> {
34        /// Attempt to create a new client by connecting to a given endpoint.
35        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
36        where
37            D: TryInto<tonic::transport::Endpoint>,
38            D::Error: Into<StdError>,
39        {
40            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
41            Ok(Self::new(conn))
42        }
43    }
44    impl<T> SqlServiceClient<T>
45    where
46        T: tonic::client::GrpcService<tonic::body::Body>,
47        T::Error: Into<StdError>,
48        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
49        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
50    {
51        pub fn new(inner: T) -> Self {
52            let inner = tonic::client::Grpc::new(inner);
53            Self { inner }
54        }
55        pub fn with_origin(inner: T, origin: Uri) -> Self {
56            let inner = tonic::client::Grpc::with_origin(inner, origin);
57            Self { inner }
58        }
59        pub fn with_interceptor<F>(
60            inner: T,
61            interceptor: F,
62        ) -> SqlServiceClient<InterceptedService<T, F>>
63        where
64            F: tonic::service::Interceptor,
65            T::ResponseBody: Default,
66            T: tonic::codegen::Service<
67                http::Request<tonic::body::Body>,
68                Response = http::Response<
69                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
70                >,
71            >,
72            <T as tonic::codegen::Service<
73                http::Request<tonic::body::Body>,
74            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
75        {
76            SqlServiceClient::new(InterceptedService::new(inner, interceptor))
77        }
78        /// Compress requests with the given encoding.
79        ///
80        /// This requires the server to support it otherwise it might respond with an
81        /// error.
82        #[must_use]
83        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
84            self.inner = self.inner.send_compressed(encoding);
85            self
86        }
87        /// Enable decompressing responses.
88        #[must_use]
89        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
90            self.inner = self.inner.accept_compressed(encoding);
91            self
92        }
93        /// Limits the maximum size of a decoded message.
94        ///
95        /// Default: `4MB`
96        #[must_use]
97        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
98            self.inner = self.inner.max_decoding_message_size(limit);
99            self
100        }
101        /// Limits the maximum size of an encoded message.
102        ///
103        /// Default: `usize::MAX`
104        #[must_use]
105        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
106            self.inner = self.inner.max_encoding_message_size(limit);
107            self
108        }
109        pub async fn query(
110            &mut self,
111            request: impl tonic::IntoRequest<super::SqlServiceQueryRequest>,
112        ) -> std::result::Result<
113            tonic::Response<super::SqlServiceQueryResponse>,
114            tonic::Status,
115        > {
116            self.inner
117                .ready()
118                .await
119                .map_err(|e| {
120                    tonic::Status::unknown(
121                        format!("Service was not ready: {}", e.into()),
122                    )
123                })?;
124            let codec = tonic::codec::ProstCodec::default();
125            let path = http::uri::PathAndQuery::from_static(
126                "/nominal.sql.v1.SqlService/Query",
127            );
128            let mut req = request.into_request();
129            req.extensions_mut()
130                .insert(GrpcMethod::new("nominal.sql.v1.SqlService", "Query"));
131            self.inner.unary(req, path, codec).await
132        }
133    }
134}