pub struct SQLRets {
pub column: Vec<String>,
pub rets: Vec<HashMap<String, SQLDataTypes>>,
}
Fields§
§column: Vec<String>
Column name vec sort by default.
rets: Vec<HashMap<String, SQLDataTypes>>
Returns.
Implementations§
source§impl SQLRets
impl SQLRets
pub fn new() -> SQLRets
pub fn push_rets(&mut self, row: HashMap<String, SQLDataTypes>)
pub fn push_column_name(&mut self, column_name: &str)
sourcepub fn get_first_one(&self, column_name: &str) -> Option<SQLDataTypes>
pub fn get_first_one(&self, column_name: &str) -> Option<SQLDataTypes>
Get first data by column name.
use rssql::MySQL;
async fn test_mysql_one() {
let url = "mysql://user:password@docker:13306/test";
let mut mysql = MySQL::connect(url).await.unwrap();
let check = mysql.check_connection().await;
println!("{}", check);
let rets = mysql.execute("SELECT * FROM info").await.unwrap();
for c in &rets.column {
println!("{}", rets.get_first_one(&c).unwrap());
}
for r in rets.get_all("id").unwrap() {
println!("{}", r);
}
mysql.close().await;
}
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SQLRets
impl Send for SQLRets
impl Sync for SQLRets
impl Unpin for SQLRets
impl UnwindSafe for SQLRets
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more