make_row

Macro make_row 

Source
macro_rules! make_row {
    {} => { ... };
    {$($keys:expr => $vals:expr),+ $(,)?} => { ... };
}
Expand description

Outputs a row, given native Rust key => value pairings.

Since instantiating protobuf-generated types is very verbose, this macro exists to make rows with ease:

use pancake_db_client::make_row;
use std::time::SystemTime;

let my_row = make_row! {
  "string_col" => "some string".to_string(),
  "timestamp_col" => SystemTime::now(),
  "int_col" => Some(77),
  "bool_col" => Option::<bool>::None,
  "bytes_col" => vec![97_u8, 98_u8, 99_u8],
  "bool_list_col" => vec![true, false],
};

Keys can be any type supporting .to_string(). Values can be any Rust type that corresponds to a Pancake type, or Options or nested Vecs thereof.