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

Function o1_extraction_single_field

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

Source from the content-addressed store, hash-verified

552
553 #[test]
554 fn o1_extraction_single_field() {
555 let schema = crm_schema();
556 let decoder = TupleDecoder::new(&schema);
557
558 let tuple = encode_crm_row(&[
559 Value::Integer(99),
560 Value::String("Charlie".into()),
561 Value::String("charlie@co.com".into()),
562 Value::Decimal(rust_decimal::Decimal::new(12345, 0)),
563 Value::Bool(false),
564 ]);
565
566 // Extract just the balance (column 3) without touching other columns.
567 let balance = decoder.extract_value(&tuple, 3).unwrap();
568 assert_eq!(
569 balance,
570 Value::Decimal(rust_decimal::Decimal::new(12345, 0))
571 );
572
573 // Extract just the name (column 1) — variable-length.
574 let name = decoder.extract_value(&tuple, 1).unwrap();
575 assert_eq!(name, Value::String("Charlie".into()));
576 }
577
578 #[test]
579 fn extract_by_name() {

Callers

nothing calls this directly

Calls 3

encode_crm_rowFunction · 0.85
extract_valueMethod · 0.80
crm_schemaFunction · 0.70

Tested by

no test coverage detected