To use Welds, define your data models as Rust structs and decorate them with the #[derive(WeldsModel)] macro. You can use the #[welds(...)] attribute to specify the schema, table name, primary keys, column renames, and relationships like BelongsTo.
Key attributes:
#[welds(schema = "...")]: Specifies the database schema.#[welds(table = "...")]: Specifies the database table name.#[welds(primary_key)]: Marks a field as the primary key.#[welds(rename = "...")]: Maps a struct field to a different database column name.#[welds(BelongsTo(relation_name, target_type, foreign_key))]: Defines a relationship to another model.
#[derive(Debug, WeldsModel)]
#[welds(schema= "inventory", table = "products")]
#[welds(BelongsTo(seller, super::people::People, "seller_id"))]
pub struct Product {
#[welds(rename = "product_id")]
#[welds(primary_key)]
pub id: i32,
pub name: String,
pub seller_id: Option<i32>,
pub description: Option<String>,
pub price: Option<f32>,
}