proton_client/
getters.rs

1use crate::ProtonClient;
2use clickhouse::Client;
3
4impl ProtonClient {
5    /// Returns a reference to the internal clickhouse client.
6    ///
7    /// This can be used for making lower-level requests.
8    ///
9    /// For details on how to use the client, see the [clickhouse client crate](https://github.com/loyd/clickhouse.rs).
10    ///
11    /// # Example
12    /// ```no_run
13    /// use proton_client::prelude::{ProtonClient, Result};
14    ///
15    /// async fn example() -> Result<()> {
16    ///
17    /// let client = ProtonClient::new("http://localhost:8123");
18    ///
19    /// let url = client.client().await;
20    ///
21    /// Ok(())
22    /// }
23    /// ```
24    ///
25    pub async fn client(&self) -> &Client {
26        &self.client
27    }
28
29    /// Returns the base URL of the Proton API endpoint.
30    ///
31    /// This is the root URL passed to the client during construction.
32    ///
33    /// # Example
34    ///
35    /// ```no_run
36    /// use proton_client::prelude::{ProtonClient, Result};
37    ///
38    /// async fn example() -> Result<()> {
39    ///
40    /// let client = ProtonClient::new("http://localhost:8123");
41    ///
42    /// let url = client.url().await;
43    ///
44    /// assert_eq!(url, "http://localhost:8123");
45    ///
46    /// Ok(())
47    /// }
48    /// ```
49    ///
50    pub async fn url(&self) -> &str {
51        &self.url
52    }
53}