Update getrandom dependency in ext api crate

This commit is contained in:
PThorpe92
2025-03-07 07:38:20 -05:00
parent f8455a6a3b
commit 216a8e7848
4 changed files with 11 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -1711,7 +1711,7 @@ name = "limbo_ext"
version = "0.0.16"
dependencies = [
"chrono",
"getrandom 0.2.15",
"getrandom 0.3.1",
"limbo_macros",
]

View File

@@ -12,6 +12,8 @@ core_only = []
static = []
[dependencies]
chrono = "0.4.40"
getrandom = { version = "0.2.15", features = ["js"] }
limbo_macros = { workspace = true }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
getrandom = "0.3.1"
chrono = "0.4.40"

View File

@@ -59,9 +59,14 @@ register_extension!{
scalars: { double }, // name of your function, if different from attribute name
aggregates: { Percentile },
vtabs: { CsvVTable },
vfs: { ExampleFS },
}
```
**NOTE**: Currently, any Derive macro used from this crate is required to be in the same
file as the `register_extension` macro.
### Scalar Example:
```rust
use limbo_ext::{register_extension, Value, scalar};

View File

@@ -14,7 +14,7 @@ pub trait VfsExtension: Default + Send + Sync {
}
fn generate_random_number(&self) -> i64 {
let mut buf = [0u8; 8];
getrandom::getrandom(&mut buf).unwrap();
getrandom::fill(&mut buf).unwrap();
i64::from_ne_bytes(buf)
}
fn get_current_time(&self) -> String {