Move UUID extension to core

We want to bundle the UUID extension by default so move the code to core.
This commit is contained in:
Pekka Enberg 2025-06-29 14:47:11 +03:00
parent 0e9ee4b856
commit 12131babae
11 changed files with 22 additions and 62 deletions

11
Cargo.lock generated
View file

@ -1890,15 +1890,6 @@ dependencies = [
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"mimalloc",
"turso_ext",
"uuid",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@ -3727,7 +3718,6 @@ dependencies = [
"limbo_regexp",
"limbo_series",
"limbo_time",
"limbo_uuid",
"lru",
"miette",
"mimalloc",
@ -3757,6 +3747,7 @@ dependencies = [
"turso_macros",
"turso_sqlite3_parser",
"uncased",
"uuid",
]
[[package]]

View file

@ -20,7 +20,6 @@ members = [
"extensions/series",
"extensions/tests",
"extensions/time",
"extensions/uuid",
"macros",
"simulator",
"sqlite3",

View file

@ -18,7 +18,7 @@ antithesis = ["dep:antithesis_sdk"]
default = ["fs", "uuid", "time", "json", "static", "series"]
fs = ["turso_ext/vfs"]
json = []
uuid = ["limbo_uuid/static"]
uuid = ["dep:uuid"]
io_uring = ["dep:io-uring", "rustix/io_uring", "dep:libc"]
percentile = ["limbo_percentile/static"]
regexp = ["limbo_regexp/static"]
@ -63,7 +63,6 @@ julian_day_converter = "0.4.5"
rand = "0.8.5"
libm = "0.2"
turso_macros = { workspace = true }
limbo_uuid = { workspace = true, optional = true, features = ["static"] }
limbo_regexp = { workspace = true, optional = true, features = ["static"] }
limbo_percentile = { workspace = true, optional = true, features = ["static"] }
limbo_time = { workspace = true, optional = true, features = ["static"] }
@ -82,6 +81,7 @@ strum_macros = { workspace = true }
bitflags = "2.9.0"
serde = { workspace = true , optional = true, features = ["derive"] }
paste = "1.0.15"
uuid = { version = "1.11.0", features = ["v4", "v7"], optional = true }
[build-dependencies]
chrono = { version = "0.4.38", default-features = false }

View file

@ -173,9 +173,7 @@ impl Connection {
#[allow(unused_variables)]
let mut ext_api = self.build_turso_ext();
#[cfg(feature = "uuid")]
if unsafe { !limbo_uuid::register_extension_static(&mut ext_api).is_ok() } {
return Err("Failed to register uuid extension".to_string());
}
crate::uuid::register_extension(&mut ext_api);
#[cfg(feature = "percentile")]
if unsafe { !limbo_percentile::register_extension_static(&mut ext_api).is_ok() } {
return Err("Failed to register percentile extension".to_string());

View file

@ -21,6 +21,8 @@ mod translate;
pub mod types;
#[allow(dead_code)]
mod util;
#[cfg(feature = "uuid")]
mod uuid;
mod vdbe;
mod vector;
mod vtab;

View file

@ -1,7 +1,18 @@
use turso_ext::{register_extension, scalar, ResultCode, Value, ValueType};
use crate::ext::register_scalar_function;
use turso_ext::{scalar, ExtensionApi, ResultCode, Value, ValueType};
register_extension! {
scalars: {uuid4_str, uuid4_blob, uuid7_str, uuid7, uuid7_ts, uuid_str, uuid_blob },
pub fn register_extension(ext_api: &mut ExtensionApi) {
// FIXME: Add macro magic to register functions automatically.
unsafe {
register_scalar_function(ext_api.ctx, c"uuid4_str".as_ptr(), uuid4_str);
register_scalar_function(ext_api.ctx, c"gen_random_uuid".as_ptr(), uuid4_str);
register_scalar_function(ext_api.ctx, c"uuid4".as_ptr(), uuid4_blob);
register_scalar_function(ext_api.ctx, c"uuid7_str".as_ptr(), uuid7_str);
register_scalar_function(ext_api.ctx, c"uuid7".as_ptr(), uuid7);
register_scalar_function(ext_api.ctx, c"uuid7_timestamp_ms".as_ptr(), uuid7_ts);
register_scalar_function(ext_api.ctx, c"uuid_str".as_ptr(), uuid_str);
register_scalar_function(ext_api.ctx, c"uuid_blob".as_ptr(), uuid_blob);
}
}
#[scalar(name = "uuid4_str", alias = "gen_random_uuid")]

View file

@ -423,7 +423,6 @@ turso_core = { path = "core", version = "0.0.17" }
limbo_crypto = { path = "extensions/crypto", version = "0.0.17" }
turso_ext = { path = "extensions/core", version = "0.0.17" }
limbo_macros = { path = "macros", version = "0.0.17" }
limbo_uuid = { path = "extensions/uuid", version = "0.0.17" }
...
+limbo_csv = { path = "extensions/csv", version = "0.0.17" }

View file

@ -1,21 +0,0 @@
[package]
name = "limbo_uuid"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Limbo UUID extension"
[lib]
crate-type = ["cdylib", "lib"]
[features]
static= [ "turso_ext/static" ]
[dependencies]
turso_ext = { workspace = true, features = ["static"] }
uuid = { version = "1.11.0", features = ["v4", "v7"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
mimalloc = { version = "0.1", default-features = false }

11
fuzz/Cargo.lock generated
View file

@ -584,15 +584,6 @@ dependencies = [
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"mimalloc",
"turso_ext",
"uuid",
]
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
@ -1119,7 +1110,6 @@ dependencies = [
"libm",
"limbo_series",
"limbo_time",
"limbo_uuid",
"miette",
"mimalloc",
"parking_lot",
@ -1138,6 +1128,7 @@ dependencies = [
"turso_macros",
"turso_sqlite3_parser",
"uncased",
"uuid",
]
[[package]]

View file

@ -672,15 +672,6 @@ dependencies = [
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"mimalloc",
"turso_ext",
"uuid",
]
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
@ -1220,7 +1211,6 @@ dependencies = [
"libm",
"limbo_series",
"limbo_time",
"limbo_uuid",
"miette",
"mimalloc",
"parking_lot",
@ -1239,6 +1229,7 @@ dependencies = [
"turso_macros",
"turso_sqlite3_parser",
"uncased",
"uuid",
]
[[package]]

View file

@ -8,7 +8,6 @@ cargo publish -p limbo_percentile
cargo publish -p limbo_regexp
cargo publish -p limbo_series
cargo publish -p limbo_time
cargo publish -p limbo_uuid
cargo publish -p limbo_ipaddr
cargo publish -p turso_sqlite3_parser
cargo publish -p turso_core