From 975ea616dd78a42059a43b6acdfeb415f1395e3d Mon Sep 17 00:00:00 2001 From: Finn Bear Date: Wed, 3 May 2023 14:48:05 -0700 Subject: [PATCH] Bugfix - export new array::slice to JS and fuzzer. (#1915) --- lib/fuzz/fuzz_targets/fuzz_executor.dict | 1 + lib/fuzz/fuzz_targets/fuzz_sql_parser.dict | 1 + lib/src/fnc/script/modules/surrealdb/functions/array.rs | 3 +++ 3 files changed, 5 insertions(+) diff --git a/lib/fuzz/fuzz_targets/fuzz_executor.dict b/lib/fuzz/fuzz_targets/fuzz_executor.dict index a128c581..dade6a18 100644 --- a/lib/fuzz/fuzz_targets/fuzz_executor.dict +++ b/lib/fuzz/fuzz_targets/fuzz_executor.dict @@ -168,6 +168,7 @@ "array::push(" "array::remove(" "array::reverse(" +"array::slice(" "array::sort(" "array::sort::asc(" "array::sort::desc(" diff --git a/lib/fuzz/fuzz_targets/fuzz_sql_parser.dict b/lib/fuzz/fuzz_targets/fuzz_sql_parser.dict index 183e5344..daa4892b 100644 --- a/lib/fuzz/fuzz_targets/fuzz_sql_parser.dict +++ b/lib/fuzz/fuzz_targets/fuzz_sql_parser.dict @@ -168,6 +168,7 @@ "array::push(" "array::remove(" "array::reverse(" +"array::slice(" "array::sort(" "array::sort::asc(" "array::sort::desc(" diff --git a/lib/src/fnc/script/modules/surrealdb/functions/array.rs b/lib/src/fnc/script/modules/surrealdb/functions/array.rs index 441110a1..01f88f1d 100644 --- a/lib/src/fnc/script/modules/surrealdb/functions/array.rs +++ b/lib/src/fnc/script/modules/surrealdb/functions/array.rs @@ -28,6 +28,7 @@ impl ModuleDef for Package { module.add("insert")?; module.add("intersect")?; module.add("len")?; + module.add("slice")?; module.add("sort")?; module.add("union")?; Ok(()) @@ -45,6 +46,7 @@ impl ModuleDef for Package { module.set("insert", Func::from(|v: Any| run("array::insert", v.0)))?; module.set("intersect", Func::from(|v: Any| run("array::intersect", v.0)))?; module.set("len", Func::from(|v: Any| run("array::len", v.0)))?; + module.set("slice", Func::from(|v: Any| run("array::slice", v.0)))?; module.set("sort", Func::from(|v: Any| run("array::sort", v.0)))?; module.set("union", Func::from(|v: Any| run("array::union", v.0)))?; // Set default exports @@ -59,6 +61,7 @@ impl ModuleDef for Package { default.set("insert", Func::from(|v: Any| run("array::insert", v.0)))?; default.set("intersect", Func::from(|v: Any| run("array::intersect", v.0)))?; default.set("len", Func::from(|v: Any| run("array::len", v.0)))?; + default.set("slice", Func::from(|v: Any| run("array::slice", v.0)))?; default.set("sort", Func::from(|v: Any| run("array::sort", v.0)))?; default.set("union", Func::from(|v: Any| run("array::union", v.0)))?; module.set("default", default)?;