MCPcopy Create free account
hub / github.com/actix/examples / create_teller

Function create_teller

databases/mysql/src/persistence.rs:94–120  ·  view source on GitHub ↗
(
    pool: &mysql::Pool,
    teller_name: String,
    branch_name: String,
)

Source from the content-addressed store, hash-verified

92}
93
94pub fn create_teller(
95 pool: &mysql::Pool,
96 teller_name: String,
97 branch_name: String,
98) -> Result<(), PersistenceError> {
99 if teller_name.replace(' ', "").trim().is_empty() {
100 return Err(PersistenceError::EmptyTellerName);
101 }
102
103 if branch_name.replace(' ', "").trim().is_empty() {
104 return Err(PersistenceError::EmptyBranch);
105 }
106
107 let mut conn = pool.get_conn()?;
108
109 let last_insert_id = insert_teller_data(
110 &mut conn,
111 teller_name.to_lowercase(),
112 branch_name.to_lowercase(),
113 )?;
114
115 if last_insert_id > 0 {
116 Ok(())
117 } else {
118 Err(PersistenceError::Unknown)
119 }
120}
121
122pub fn create_customer(
123 pool: &mysql::Pool,

Callers 1

add_tellerFunction · 0.85

Calls 1

insert_teller_dataFunction · 0.85

Tested by

no test coverage detected