tursodatabase / libsql-client-rs

libSQL Rust client library can be used to communicate with sqld natively over HTTP protocol with native Rust interface.
MIT License
75 stars 27 forks source link

Add from_row support #38

Closed LucioFranco closed 1 year ago

LucioFranco commented 1 year ago

This adds basic serde support for going from a Row into any user struct that has field types that match Value's enum types. Other types like lists can be supported but this is out of scope of this PR.

// With some arbitrary `Row`
struct MyModel {
   bar: String,
} 

let data = libsql_client::de::from_row::<MyModel>(&row)?;

println!("{}", data.bar);

cc @glommer