ormx does not directly support relations like a real ORM would. Your structs must directly mirror the database table.
If, for example, you got Author and Book, and you want to get all books written by one author, you'd do something like
#[derive(ormx::Table)]
#[ormx(table = "books", id = book_id)]
struct Book {
book_id: i32,
#[ormx(get_many = by_author(i32)]
author_id: i32
}
let author = ...;
let books = Book::by_author(author.author_id).await?;
ormx does not directly support relations like a real ORM would. Your structs must directly mirror the database table.
If, for example, you got
Author
andBook
, and you want to get all books written by one author, you'd do something like