Skip to content

Commit 6b3f03e

Browse files
authored
Merge pull request #35 from b41sh/bump-jsonb-0.3.0
Bump to version 0.3.0
2 parents 2b8ddc5 + 97350fa commit 6b3f03e

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## [v0.3.0] - 2023-10-13
2+
3+
### Added
4+
5+
Docs: Add more jsonb encoding format descriptions. (#34)
6+
Feat: Support `object_each` api. (#33)
7+
Feat: Support `path_exists` api. (#32)
8+
Feat: Support `type_of` api. (#31)
9+
Feat: Support `strip_nulls` api. (#30)
10+
Perf: Add benches for parser and `get_path`. (#29)
11+
Chore: Add check fmt and clippy. (#27)
12+
Feat: Support `to_pretty_string` api. (#26)
13+
Feat: Support `traverse_check_string` function. (#25)
14+
Feat: Improve json path selector using less memory. (#24)
15+
116
## [v0.2.3] - 2023-07-10
217

318
### Fixed

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ keywords = ["json", "jsonb", "jsonpath"]
2222
license = "Apache-2.0"
2323
name = "jsonb"
2424
repository = "https://github.com/datafuselabs/jsonb"
25-
version = "0.2.3"
25+
version = "0.3.0"
2626
rust-version = "1.68"
2727

2828
[dependencies]
29-
byteorder = "1.4.3"
29+
byteorder = "1.5.0"
3030
fast-float = "0.2.0"
3131
nom = "7.1.3"
32-
ordered-float = { version = "3.6.0", default-features = false }
32+
ordered-float = { version = "4.1.1", default-features = false }
3333
rand = { version = "0.8.5", features = ["small_rng"] }
34-
serde_json = { version = "1.0.95", default-features = false, features = [
34+
serde_json = { version = "1.0.107", default-features = false, features = [
3535
"preserve_order",
3636
] }
3737

3838
[dev-dependencies]
3939
goldenfile = "1.5.2"
40-
serde_json = "1.0.105"
40+
serde_json = "1.0.107"
4141
json-deserializer = "0.4.4"
42-
simd-json = {version = "0.10.6", features = ["allow-non-simd"]}
42+
simd-json = {version = "0.11.1", features = ["allow-non-simd"]}
4343
mockalloc = "0.1.2"
4444
criterion = "0.5.1"
4545

src/functions.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,12 @@ pub fn is_object(value: &[u8]) -> bool {
10541054
/// Convert `JSONB` value to String
10551055
pub fn to_string(value: &[u8]) -> String {
10561056
if !is_jsonb(value) {
1057-
return String::from_utf8_lossy(value).to_string();
1057+
// empty value as default null
1058+
if value.is_empty() {
1059+
return "null".to_string();
1060+
} else {
1061+
return String::from_utf8_lossy(value).to_string();
1062+
}
10581063
}
10591064

10601065
let mut json = String::new();
@@ -1065,7 +1070,12 @@ pub fn to_string(value: &[u8]) -> String {
10651070
/// Convert `JSONB` value to pretty String
10661071
pub fn to_pretty_string(value: &[u8]) -> String {
10671072
if !is_jsonb(value) {
1068-
return String::from_utf8_lossy(value).to_string();
1073+
// empty value as default null
1074+
if value.is_empty() {
1075+
return "null".to_string();
1076+
} else {
1077+
return String::from_utf8_lossy(value).to_string();
1078+
}
10691079
}
10701080

10711081
let mut json = String::new();

0 commit comments

Comments
 (0)