Expand description
Support for mapping arbitrary AnyRow results to structs.
Defines traits and structures (AnyImpl, AnyInfo) that support the FromAnyRow
derive macro, enabling flexible result mapping.
§Any Structure Support
This module defines traits and structures to support mapping arbitrary database rows
(specifically AnyRow) to Rust structs. It provides metadata about columns
to facilitate dynamic query construction and result mapping.
§Features
- Dynamic Mapping: Supports mapping
AnyRowto struct fields - Metadata Reflection: Provides column names and types at runtime
- Extensible: Can be implemented for custom types
§Example
ⓘ
use bottle_orm::{AnyImpl, AnyInfo};
struct MyStruct {
id: i32,
name: String,
}
impl AnyImpl for MyStruct {
fn columns() -> Vec<AnyInfo> {
vec![
AnyInfo { column: "id", sql_type: "INTEGER" },
AnyInfo { column: "name", sql_type: "TEXT" },
]
}
}Structs§
- AnyInfo
- Contains metadata about a database column.
Traits§
- AnyImpl
- A trait for types that can be mapped from an
AnyRowand provide column metadata.