Getting Error while decoding value when using Select #256
vjkolaventy
started this conversation in
General
Replies: 2 comments · 1 reply
-
maybe pub kyc: bool, should be pub kyc: i32, |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you. I changed it string and it worked. I was confused earlier because the documentation showed that bool can be used. rbatis::decode decode json vec to an object support decode types: Value,BigDecimal, i8..i64,u8..u64,i64,bool,String or object used rbs::Value macro object |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I am new to Rust and I am trying to use impl_select to get a row by username with Sqlite database. Please help with my code below.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AureumUsers {
pub user_id: u64,
pub username: String,
pub password: String,
pub first_name: String,
pub last_name: String,
pub address1: String,
pub address2: String,
pub city: String,
pub state: String,
pub postal_code: String,
pub mobile: String,
pub phone: String,
pub email: String,
pub birth_date: String,
pub kyc: bool,
pub create_date: String,
}
impl_select!(AureumUsers{select_by_username(table_name: String, username: &str) => "
WHERE username = #{username}
"});pub async fn get_aureum_user (username: &str) {
let rb = open_db().await.unwrap();
let data = AureumUsers::select_by_username(&mut rb, "aureum_users".to_string(), username).await;
match data {
Ok(data) => println!("{:?}", data),
Err(err) => println!("Error: {}", err.to_string())
}
}
I am getting the following error when run the program.
Error: error while decoding value: invalid type: integer
0
, expected a booleanBeta Was this translation helpful? Give feedback.
All reactions