Skip to content

Commit 80b4d42

Browse files
committed
Impl Deref for MetadataDatabaseConnection
1 parent 42f50be commit 80b4d42

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ pub async fn reconcile_hive(
385385
.spec
386386
.cluster_config
387387
.metadata_database
388-
.as_jdbc_database_connection()
389388
.jdbc_connection_details("METADATA")
390389
.context(InvalidMetadataDatabaseConnectionSnafu)?;
391390

rust/operator-binary/src/crd/databases.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::Deref;
2+
13
use serde::{Deserialize, Serialize};
24
use stackable_operator::{
35
database_connections::{
@@ -29,15 +31,19 @@ pub enum MetadataDatabaseConnection {
2931
// Generic(GenericJdbcDatabaseConnection),
3032
}
3133

32-
impl MetadataDatabaseConnection {
33-
pub fn as_jdbc_database_connection(&self) -> &dyn JdbcDatabaseConnection {
34+
impl Deref for MetadataDatabaseConnection {
35+
type Target = dyn JdbcDatabaseConnection;
36+
37+
fn deref(&self) -> &Self::Target {
3438
match self {
3539
Self::Postgresql(p) => p,
3640
Self::Mysql(m) => m,
3741
Self::Derby(d) => d,
3842
}
3943
}
44+
}
4045

46+
impl MetadataDatabaseConnection {
4147
/// Name of the database as it should be passed using the `--db-type` CLI argument to Hive
4248
pub fn as_hive_db_type(&self) -> &str {
4349
match self {

0 commit comments

Comments
 (0)