<commit_before>use std::error::Error;

pub trait DbChannel {
    fn query(&self, &str) -> Result<(), String>;
}
<commit_msg>refactor(channel) implement DbChannel for MySQl and Postgres<commit_after>use std::error::Error;
use mysql::Pool;
use postgres::Connection;

pub trait DbChannel {
    fn query(&self, &str) -> Result<(), String>;
}

impl DbChannel for Pool {
    fn query(&self, query: &str) -> Result<(), String> {
        match self.prep_exec(query, ()) {
            Ok(_) => Ok(()),
            Err(err) => Err(err.description().to_string())
        }
    }
}

impl DbChannel for Connection {
    fn query(&self, query: &str) -> Result<(), String> {
        match self.execute(query, &[]) {
            Ok(_) => Ok(()),
            Err(err) => Err(err.description().to_string())
        }
    }
}
{'fraction_non_alphanumeric': 0.18238213399503722, 'fraction_numerical': 0.0, 'mean_word_length': 2.9174757281553396, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6566692', 'n_tokens_mistral': 264, 'n_tokens_neox': 256, 'n_words': 62}