Add Datetime type
Пример использования
lib.rs
:
#[derive(serde::Serialize, serde::Deserialize)]
struct Entry {
pub dt: tarantool::datetime::Datetime,
}
#[tarantool::proc]
fn get_entry(id: u64) -> Result<Entry, Box<dyn std::error::Error>> {
let sp = tarantool::space::Space::find("my_space").unwrap();
let entry: Entry = sp.get(&(id,))?.unwrap().decode()?;
Ok(entry)
}
lua:
box.schema.space.create('my_space', { if_not_exists = true, format = { { name = "dt", type = "datetime" } } })
box.schema.func.create('rust_lib.get_entry', { language = "C", if_not_exists = true })
box.space.my_space:insert({ 1, datetime.now() })
box.func['rust_lib.get_entry']:call({ 1 }).dt