MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / raw_variable_extraction

Function raw_variable_extraction

nodedb-strict/src/decode.rs:736–759  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

734
735 #[test]
736 fn raw_variable_extraction() {
737 let schema = StrictSchema::new(vec![
738 ColumnDef::required("id", ColumnType::Int64),
739 ColumnDef::required("name", ColumnType::String),
740 ColumnDef::nullable("bio", ColumnType::String),
741 ])
742 .unwrap();
743 let encoder = TupleEncoder::new(&schema);
744 let decoder = TupleDecoder::new(&schema);
745
746 let tuple = encoder
747 .encode(&[
748 Value::Integer(1),
749 Value::String("hello".into()),
750 Value::String("world".into()),
751 ])
752 .unwrap();
753
754 let name_raw = decoder.extract_variable_raw(&tuple, 1).unwrap().unwrap();
755 assert_eq!(std::str::from_utf8(name_raw).unwrap(), "hello");
756
757 let bio_raw = decoder.extract_variable_raw(&tuple, 2).unwrap().unwrap();
758 assert_eq!(std::str::from_utf8(bio_raw).unwrap(), "world");
759 }
760
761 #[test]
762 fn all_types_roundtrip() {

Callers

nothing calls this directly

Calls 2

extract_variable_rawMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected