tokio_postgres:Can you set struct(self) to params?

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?;

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.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.