diff --git a/Cargo.lock b/Cargo.lock index ffb68d5..11459c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,7 +249,7 @@ dependencies = [ [[package]] name = "jsonfilter" -version = "0.2.3" +version = "0.2.4" dependencies = [ "clap", "indicatif", @@ -390,6 +390,26 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "ref-cast" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53313ec9f12686aeeffb43462c3ac77aa25f590a5f630eb2cde0de59417b29c7" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2566c4bf6845f2c2e83b27043c3f5dfcd5ba8f2937d6c00dc009bfb51a079dc4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "ryu" version = "1.0.15" @@ -429,13 +449,14 @@ dependencies = [ [[package]] name = "simd-json" -version = "0.11.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5292d9aeaa0fcfd2732c6254761ef6394a4c1a9f255426c0c95b77069184816f" +checksum = "e5a3720326b20bf5b95b72dbbd133caae7e0dcf71eae8f6e6656e71a7e5c9aaa" dependencies = [ "getrandom", "halfbrown", "lexical-core", + "ref-cast", "serde", "serde_json", "simdutf8", @@ -491,9 +512,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "value-trait" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a5b6c8ceb01263b969cac48d4a6705134d490ded13d889e52c0cfc80c6945e" +checksum = "ea87257cfcbedcb9444eda79c59fdfea71217e6305afee8ee33f500375c2ac97" dependencies = [ "float-cmp", "halfbrown", @@ -701,20 +722,19 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 1b1b77f..84ee7fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" [dependencies] clap = { version = "4.4.4", features = ["derive"] } indicatif = "0.17.7" -simd-json = "0.11.0" -zstd = "0.12.4" +simd-json = "0.13.4" +zstd = "0.13.0" diff --git a/src/main.rs b/src/main.rs index c8c8c66..ee28caf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,10 @@ use clap::Parser; use progress::create_progress_bar; -use simd_json::{to_borrowed_value, BorrowedValue, ValueAccess}; +use simd_json::{ + base::{ValueAsContainer, ValueAsScalar}, + derived::TypedScalarValue, + to_borrowed_value, BorrowedValue, +}; use std::{collections::HashSet, error::Error, io::Write}; mod io; @@ -42,6 +46,14 @@ struct Args { fn is_filtered(row: &BorrowedValue, key: &str, filter: &str) -> Option { let value = row.as_object()?.get(key)?; + if value.is_bool() { + let bool_value = value.as_bool()?; + if bool_value { + return Some(filter == "true"); + } else { + return Some(filter == "false"); + } + } Some(value.as_str()? == filter) }