pub struct ClickHouseResource {
pub database: String,
/* private fields */
}Expand description
ClickHouse resource manager
Fields§
§database: StringName of the isolated database
Implementations§
Source§impl ClickHouseResource
impl ClickHouseResource
Sourcepub async fn connect_existing(url: &str, database: &str) -> Result<Self>
pub async fn connect_existing(url: &str, database: &str) -> Result<Self>
Connect to an existing ClickHouse database (for inspection, does not drop on cleanup)
Sourcepub async fn new(url: &str, database: &str) -> Result<Self>
pub async fn new(url: &str, database: &str) -> Result<Self>
Create a new ClickHouse resource with an isolated database
Sourcepub async fn count(&self, query: &str) -> Result<u64>
pub async fn count(&self, query: &str) -> Result<u64>
Execute a count query and return the result
Sourcepub async fn query<T>(&self, query: &str) -> Result<Vec<T>>where
T: Row + for<'a> Deserialize<'a>,
pub async fn query<T>(&self, query: &str) -> Result<Vec<T>>where
T: Row + for<'a> Deserialize<'a>,
Execute a query and fetch all rows
Sourcepub async fn query_one<T>(&self, query: &str) -> Result<T>where
T: Row + for<'a> Deserialize<'a>,
pub async fn query_one<T>(&self, query: &str) -> Result<T>where
T: Row + for<'a> Deserialize<'a>,
Execute a query and fetch one row
Sourcepub async fn get_column_types(
&self,
table: &str,
) -> Result<Vec<(String, String)>>
pub async fn get_column_types( &self, table: &str, ) -> Result<Vec<(String, String)>>
Get the column types for a table
Sourcepub fn connection_url(&self) -> String
pub fn connection_url(&self) -> String
Get the connection URL for this database
Sourcepub async fn list_tables(&self) -> Result<Vec<String>>
pub async fn list_tables(&self) -> Result<Vec<String>>
List all tables in the database
Trait Implementations§
Source§impl Drop for ClickHouseResource
impl Drop for ClickHouseResource
Auto Trait Implementations§
impl !RefUnwindSafe for ClickHouseResource
impl !UnwindSafe for ClickHouseResource
impl Freeze for ClickHouseResource
impl Send for ClickHouseResource
impl Sync for ClickHouseResource
impl Unpin for ClickHouseResource
impl UnsafeUnpin for ClickHouseResource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.