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

Function encode_with_nulls

nodedb-strict/src/encode.rs:387–404  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

385
386 #[test]
387 fn encode_with_nulls() {
388 let schema = crm_schema();
389 let encoder = TupleEncoder::new(&schema);
390
391 let values = vec![
392 Value::Integer(1),
393 Value::String("Bob".into()),
394 Value::Null, // email is nullable
395 Value::Decimal(rust_decimal::Decimal::ZERO),
396 Value::Null, // active is nullable
397 ];
398
399 let tuple = encoder.encode(&values).unwrap();
400
401 // Null bitmap at byte 9: bit 2 (email) and bit 4 (active) set.
402 // Bit 2 = 0b00000100 = 4, bit 4 = 0b00010000 = 16. Combined = 20.
403 assert_eq!(tuple[9], 0b00010100);
404 }
405
406 #[test]
407 fn encode_null_violation() {

Callers

nothing calls this directly

Calls 2

crm_schemaFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected