1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
use crate::types::*; use neo4rs_macros::BoltStruct; #[derive(Debug, PartialEq, Clone, BoltStruct)] #[signature(0xB1, 0x11)] pub struct Begin { extra: BoltMap, } impl Begin { pub fn new(extra: BoltMap) -> Begin { Begin { extra } } } #[cfg(test)] mod tests { use super::*; use crate::version::Version; use bytes::*; #[test] fn should_serialize_begin() { let begin = Begin::new( vec![("tx_timeout".into(), 2000.into())] .into_iter() .collect(), ); let bytes: Bytes = begin.to_bytes(Version::V4_1).unwrap(); assert_eq!( bytes, Bytes::from_static(&[ 0xB1, 0x11, map::TINY | 1, string::TINY | 10, b't', b'x', b'_', b't', b'i', b'm', b'e', b'o', b'u', b't', integer::INT_16, 0x07, 0xD0 ]) ); } }