20 lines
530 B
Rust
20 lines
530 B
Rust
use mysql::PooledConn;
|
|
|
|
use crate::repository::merchant_repo;
|
|
|
|
pub fn get_merchant(search: &str, conn: &mut PooledConn) {
|
|
let merchants = merchant_repo::find_by_name_or_id(search, conn);
|
|
|
|
match merchants {
|
|
Ok(merchants) => {
|
|
if merchants.is_empty() {
|
|
println!("Merchant not found!");
|
|
}
|
|
merchants.into_iter().for_each(|merchant| {
|
|
println!("Merchant: {}", merchant.m_name);
|
|
})
|
|
}
|
|
Err(err) => panic!("{}", err),
|
|
};
|
|
}
|