use serde::{Deserialize, Serialize};
use postgres_types::{ToSql, FromSql};
#[derive(Debug, FromSql, ToSql, Deserialize, Serialize)]
#[postgres(name = "users")]
pub struct SignUpUserInfo {
#[postgres(name = "user_name")]
pub user_name: String,
#[postgres(name = "mailaddress")]
pub mailaddress: String,
#[postgres(name = "password")]
pub password: String,
}
use crate::mycrate;
use tokio_pg_mapper::FromTokioPostgresRow;
impl input::SignUpUserInfo {
pub async fn sign_up(&self) -> Result<u64>{
//other code
let exe = conn.execute(stmt, &[&self]).await?;
Ok(exe)
}
}
error
thread 'actix-rt|system:0|arbiter:0' panicked at 'expected 3 parameters but got 1',
In addition, if all values are set like self.password, it will work as expected.