Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"unmapped" property in the #[derive(Table)] struct #11

Open
RoDmitry opened this issue May 20, 2021 · 1 comment
Open

"unmapped" property in the #[derive(Table)] struct #11

RoDmitry opened this issue May 20, 2021 · 1 comment

Comments

@RoDmitry
Copy link

RoDmitry commented May 20, 2021

I have an "unmapped" (to DB, meaning table does not contain a corresponding column) property User.phones in my struct:

use serde::{Deserialize, Serialize};
use ormx::Table;

#[derive(Serialize, Deserialize, Default, Debug, Clone, Table)]
#[ormx(table = "users", id = id, insertable)]
pub struct User {
    #[ormx(default)]
    pub id: i32,
    pub username: String,
    pub password: String,
    #[ormx(default)]
    pub phones: Vec<Phone>,
}

On compile it says: error returned from database: 1054 (42S22): Unknown column 'phones' in 'field list'

As we discussed in the Discord, it needs something like #[ormx(skip)].

@RoDmitry
Copy link
Author

More variants to name it: #[ormx(unmapped)], #[ormx(mapped = false)], #[ormx(column = "false")], #[ormx(column = false)], #[ormx(column = none)], #[ormx(nocolumn)].

@RoDmitry RoDmitry changed the title "unmapped" property in the #[derive(Table)] struct. #[ormx(skip)]? "unmapped" property in the #[derive(Table)] struct May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant