usage/
usage.rs

1use protos::sp_steps_detective::DetectiveType;
2use streamdal_wasm_detective::detective;
3use streamdal_wasm_detective::detective::Request;
4
5fn main() {
6    let det = detective::Detective::new();
7
8    let sample_json = r#"{
9        "field1": {
10            "field2": "2"
11        }
12    }"#;
13
14    let request = Request {
15        match_type: DetectiveType::DETECTIVE_TYPE_HAS_FIELD,
16        data: &sample_json.as_bytes().to_vec(),
17        path: "field1".to_string(),
18        args: vec!["1".to_string()],
19        negate: false,
20    };
21
22    match det.matches(&request) {
23        Ok(value) => println!("Result: {:#?}", value),
24        Err(err) => println!("Error: {:#?}", err),
25    }
26}