Rename limbo_ext crate to turso_ext

This commit is contained in:
Pekka Enberg 2025-06-29 12:12:27 +03:00
parent 51b6e347a8
commit eb0de4066b
49 changed files with 317 additions and 318 deletions

60
Cargo.lock generated
View file

@ -1763,8 +1763,8 @@ dependencies = [
name = "limbo_completion"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
]
[[package]]
@ -1773,10 +1773,10 @@ version = "0.1.0-pre.2"
dependencies = [
"blake3",
"data-encoding",
"limbo_ext",
"md5",
"mimalloc",
"ring",
"turso_ext",
"urlencoding",
]
@ -1785,29 +1785,9 @@ name = "limbo_csv"
version = "0.1.0-pre.2"
dependencies = [
"csv",
"limbo_ext",
"mimalloc",
"tempfile",
]
[[package]]
name = "limbo_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.2",
"turso_macros",
]
[[package]]
name = "limbo_ext_tests"
version = "0.1.0-pre.2"
dependencies = [
"env_logger 0.11.7",
"lazy_static",
"limbo_ext",
"log",
"mimalloc",
"turso_ext",
]
[[package]]
@ -1815,35 +1795,35 @@ name = "limbo_ipaddr"
version = "0.1.0-pre.2"
dependencies = [
"ipnetwork",
"limbo_ext",
"mimalloc",
"turso_ext",
]
[[package]]
name = "limbo_percentile"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
]
[[package]]
name = "limbo_regexp"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"regex",
"turso_ext",
]
[[package]]
name = "limbo_series"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"quickcheck",
"quickcheck_macros",
"turso_ext",
]
[[package]]
@ -1934,19 +1914,19 @@ name = "limbo_time"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"limbo_ext",
"mimalloc",
"strum",
"strum_macros",
"thiserror 2.0.12",
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
"uuid",
]
@ -3763,7 +3743,6 @@ dependencies = [
"limbo_completion",
"limbo_crypto",
"limbo_csv",
"limbo_ext",
"limbo_ipaddr",
"limbo_percentile",
"limbo_regexp",
@ -3796,10 +3775,31 @@ dependencies = [
"test-log",
"thiserror 1.0.69",
"tracing",
"turso_ext",
"turso_macros",
"uncased",
]
[[package]]
name = "turso_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.2",
"turso_macros",
]
[[package]]
name = "turso_ext_tests"
version = "0.1.0-pre.2"
dependencies = [
"env_logger 0.11.7",
"lazy_static",
"log",
"mimalloc",
"turso_ext",
]
[[package]]
name = "turso_macros"
version = "0.1.0-pre.2"

View file

@ -43,8 +43,8 @@ limbo_completion = { path = "extensions/completion", version = "0.1.0-pre.2" }
turso_core = { path = "core", version = "0.1.0-pre.2" }
limbo_crypto = { path = "extensions/crypto", version = "0.1.0-pre.2" }
limbo_csv = { path = "extensions/csv", version = "0.1.0-pre.2" }
limbo_ext = { path = "extensions/core", version = "0.1.0-pre.2" }
limbo_ext_tests = { path = "extensions/tests", version = "0.1.0-pre.2" }
turso_ext = { path = "extensions/core", version = "0.1.0-pre.2" }
turso_ext_tests = { path = "extensions/tests", version = "0.1.0-pre.2" }
limbo_ipaddr = { path = "extensions/ipaddr", version = "0.1.0-pre.2" }
turso_macros = { path = "macros", version = "0.1.0-pre.2" }
limbo_percentile = { path = "extensions/percentile", version = "0.1.0-pre.2" }

View file

@ -16,7 +16,7 @@ path = "lib.rs"
[features]
antithesis = ["dep:antithesis_sdk"]
default = ["fs", "uuid", "time", "json", "static", "series"]
fs = ["limbo_ext/vfs"]
fs = ["turso_ext/vfs"]
json = []
uuid = ["limbo_uuid/static"]
io_uring = ["dep:io-uring", "rustix/io_uring", "dep:libc"]
@ -27,7 +27,7 @@ crypto = ["limbo_crypto/static"]
series = ["limbo_series/static"]
ipaddr = ["limbo_ipaddr/static"]
completion = ["limbo_completion/static"]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
fuzz = []
csv = ["limbo_csv/static"]
omit_autovacuum = []
@ -47,7 +47,7 @@ libloading = "0.8.6"
[dependencies]
antithesis_sdk = { version = "0.2.5", optional = true }
limbo_ext = { workspace = true, features = ["core_only"] }
turso_ext = { workspace = true, features = ["core_only"] }
cfg_block = "0.1.1"
fallible-iterator = "0.3.0"
hex = "0.4.3"

View file

@ -80,8 +80,8 @@ macro_rules! bail_constraint_error {
};
}
impl From<limbo_ext::ResultCode> for LimboError {
fn from(err: limbo_ext::ResultCode) -> Self {
impl From<turso_ext::ResultCode> for LimboError {
fn from(err: turso_ext::ResultCode) -> Self {
LimboError::ExtensionError(err.to_string())
}
}

View file

@ -3,11 +3,11 @@ use crate::{
Connection, LimboError,
};
use libloading::{Library, Symbol};
use limbo_ext::{ExtensionApi, ExtensionApiRef, ExtensionEntryPoint, ResultCode, VfsImpl};
use std::{
ffi::{c_char, CString},
sync::{Arc, Mutex, OnceLock},
};
use turso_ext::{ExtensionApi, ExtensionApiRef, ExtensionEntryPoint, ResultCode, VfsImpl};
type ExtensionStore = Vec<(Arc<Library>, ExtensionApiRef)>;
static EXTENSIONS: OnceLock<Arc<Mutex<ExtensionStore>>> = OnceLock::new();
@ -33,9 +33,9 @@ impl Connection {
self: &Arc<Connection>,
path: P,
) -> crate::Result<()> {
use limbo_ext::ExtensionApiRef;
use turso_ext::ExtensionApiRef;
let api = Box::new(self.build_limbo_ext());
let api = Box::new(self.build_turso_ext());
let lib =
unsafe { Library::new(path).map_err(|e| LimboError::ExtensionError(e.to_string()))? };
let entry: Symbol<ExtensionEntryPoint> = unsafe {
@ -93,7 +93,7 @@ pub(crate) unsafe extern "C" fn register_vfs(
pub fn add_builtin_vfs_extensions(
api: Option<ExtensionApi>,
) -> crate::Result<Vec<(String, Arc<VfsMod>)>> {
use limbo_ext::VfsInterface;
use turso_ext::VfsInterface;
let mut vfslist: Vec<*const VfsImpl> = Vec::new();
let mut api = match api {

View file

@ -6,15 +6,15 @@ use crate::UringIO;
use crate::{function::ExternalFunc, Connection, Database, LimboError, IO};
#[cfg(feature = "fs")]
pub use dynamic::{add_builtin_vfs_extensions, add_vfs_module, list_vfs_modules, VfsMod};
use limbo_ext::{
ExtensionApi, InitAggFunction, ResultCode, ScalarFunction, VTabKind, VTabModuleImpl,
};
pub use limbo_ext::{FinalizeFunction, StepFunction, Value as ExtValue, ValueType as ExtValueType};
use std::{
ffi::{c_char, c_void, CStr, CString},
rc::Rc,
sync::Arc,
};
use turso_ext::{
ExtensionApi, InitAggFunction, ResultCode, ScalarFunction, VTabKind, VTabModuleImpl,
};
pub use turso_ext::{FinalizeFunction, StepFunction, Value as ExtValue, ValueType as ExtValueType};
pub use vtab_xconnect::{close, execute, prepare_stmt};
type ExternAggFunc = (InitAggFunction, StepFunction, FinalizeFunction);
@ -154,14 +154,14 @@ impl Connection {
ResultCode::OK
}
pub fn build_limbo_ext(&self) -> ExtensionApi {
pub fn build_turso_ext(&self) -> ExtensionApi {
ExtensionApi {
ctx: self as *const _ as *mut c_void,
register_scalar_function,
register_aggregate_function,
register_vtab_module,
#[cfg(feature = "fs")]
vfs_interface: limbo_ext::VfsInterface {
vfs_interface: turso_ext::VfsInterface {
register_vfs: dynamic::register_vfs,
builtin_vfs: std::ptr::null_mut(),
builtin_vfs_count: 0,
@ -171,7 +171,7 @@ impl Connection {
pub fn register_builtins(&self) -> Result<(), String> {
#[allow(unused_variables)]
let mut ext_api = self.build_limbo_ext();
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());

View file

@ -1,5 +1,4 @@
use crate::{types::Value, Connection, Statement, StepResult};
use limbo_ext::{Conn as ExtConn, ResultCode, Stmt, Value as ExtValue};
use std::{
boxed::Box,
ffi::{c_char, c_void, CStr, CString},
@ -7,6 +6,7 @@ use std::{
ptr,
sync::Arc,
};
use turso_ext::{Conn as ExtConn, ResultCode, Stmt, Value as ExtValue};
/// Free memory for the internal context of the connection.
/// This function does not close the core connection itself,
@ -21,7 +21,7 @@ pub unsafe extern "C" fn close(ctx: *mut c_void) {
}
/// Wrapper around core Connection::execute with optional arguments to bind
/// to the statment This function takes ownership of the optional limbo_ext::Value array if provided
/// to the statment This function takes ownership of the optional turso_ext::Value array if provided
pub unsafe extern "C" fn execute(
ctx: *mut ExtConn,
sql: *const c_char,

View file

@ -1,7 +1,7 @@
use limbo_ext::{FinalizeFunction, InitAggFunction, ScalarFunction, StepFunction};
use std::fmt;
use std::fmt::{Debug, Display};
use std::rc::Rc;
use turso_ext::{FinalizeFunction, InitAggFunction, ScalarFunction, StepFunction};
use crate::LimboError;

View file

@ -3,10 +3,10 @@ use crate::ext::VfsMod;
use crate::io::clock::{Clock, Instant};
use crate::io::CompletionType;
use crate::{LimboError, Result};
use limbo_ext::{VfsFileImpl, VfsImpl};
use std::cell::RefCell;
use std::ffi::{c_void, CString};
use std::sync::Arc;
use turso_ext::{VfsFileImpl, VfsImpl};
impl Clock for VfsMod {
fn now(&self) -> Instant {
@ -29,7 +29,7 @@ impl IO for VfsMod {
if file.is_null() {
return Err(LimboError::ExtensionError("File not found".to_string()));
}
Ok(Arc::new(limbo_ext::VfsFileImpl::new(file, self.ctx)?))
Ok(Arc::new(turso_ext::VfsFileImpl::new(file, self.ctx)?))
}
fn run_once(&self) -> Result<()> {

View file

@ -1,5 +1,5 @@
use limbo_ext::VTabKind;
use limbo_sqlite3_parser::ast::{self, SortOrder};
use turso_ext::VTabKind;
use std::sync::Arc;

View file

@ -1,6 +1,6 @@
use limbo_ext::{ConstraintInfo, ConstraintOp};
use limbo_sqlite3_parser::ast::{self, SortOrder};
use std::{cell::Cell, cmp::Ordering, rc::Rc, sync::Arc};
use turso_ext::{ConstraintInfo, ConstraintOp};
use crate::{
function::AggFunc,

View file

@ -20,8 +20,8 @@ use crate::LimboError;
use crate::SymbolTable;
use crate::{bail_parse_error, Result};
use limbo_ext::VTabKind;
use limbo_sqlite3_parser::ast::{fmt::ToTokens, CreateVirtualTable};
use turso_ext::VTabKind;
pub fn translate_create_table(
query_mode: QueryMode,
@ -483,7 +483,7 @@ fn create_vtable_body_to_str(vtab: &CreateVirtualTable, module: Rc<VTabImpl>) ->
.as_ref()
.unwrap_or(&vec![])
.iter()
.map(|a| limbo_ext::Value::from_text(a.to_string()))
.map(|a| turso_ext::Value::from_text(a.to_string()))
.collect::<Vec<_>>();
let schema = module
.implementation
@ -738,7 +738,7 @@ pub fn translate_drop_table(
// From what I see, TableValuedFunction is not stored in the schema as a table.
// But this line here below is a safeguard in case this behavior changes in the future
// And mirrors what SQLite does.
if matches!(vtab.kind, limbo_ext::VTabKind::TableValuedFunction) {
if matches!(vtab.kind, turso_ext::VTabKind::TableValuedFunction) {
return Err(crate::LimboError::ParseError(format!(
"table {} may not be dropped",
vtab.name

View file

@ -1,7 +1,7 @@
use limbo_ext::{AggCtx, FinalizeFunction, StepFunction};
use limbo_sqlite3_parser::ast::SortOrder;
#[cfg(feature = "serde")]
use serde::Deserialize;
use turso_ext::{AggCtx, FinalizeFunction, StepFunction};
use crate::error::LimboError;
use crate::ext::{ExtValue, ExtValueType};

View file

@ -207,7 +207,7 @@ fn module_name_from_sql(sql: &str) -> Result<&str> {
// CREATE VIRTUAL TABLE table_name USING module_name(arg1, arg2, ...);
// CREATE VIRTUAL TABLE table_name USING module_name;
fn module_args_from_sql(sql: &str) -> Result<Vec<limbo_ext::Value>> {
fn module_args_from_sql(sql: &str) -> Result<Vec<turso_ext::Value>> {
if !sql.contains('(') {
return Ok(vec![]);
}
@ -233,7 +233,7 @@ fn module_args_from_sql(sql: &str) -> Result<Vec<limbo_ext::Value>> {
chars.next();
} else {
in_quotes = false;
args.push(limbo_ext::Value::from_text(current_arg.trim().to_string()));
args.push(turso_ext::Value::from_text(current_arg.trim().to_string()));
current_arg.clear();
// Skip until comma or end
while let Some(&nc) = chars.peek() {
@ -256,7 +256,7 @@ fn module_args_from_sql(sql: &str) -> Result<Vec<limbo_ext::Value>> {
',' => {
if !in_quotes {
if !current_arg.trim().is_empty() {
args.push(limbo_ext::Value::from_text(current_arg.trim().to_string()));
args.push(turso_ext::Value::from_text(current_arg.trim().to_string()));
current_arg.clear();
}
} else {
@ -270,7 +270,7 @@ fn module_args_from_sql(sql: &str) -> Result<Vec<limbo_ext::Value>> {
}
if !current_arg.trim().is_empty() && !in_quotes {
args.push(limbo_ext::Value::from_text(current_arg.trim().to_string()));
args.push(turso_ext::Value::from_text(current_arg.trim().to_string()));
}
if in_quotes {
@ -1032,29 +1032,29 @@ pub fn parse_signed_number(expr: &Expr) -> Result<Value> {
}
// for TVF's we need these at planning time so we cannot emit translate_expr
pub fn vtable_args(args: &[ast::Expr]) -> Vec<limbo_ext::Value> {
pub fn vtable_args(args: &[ast::Expr]) -> Vec<turso_ext::Value> {
let mut vtable_args = Vec::new();
for arg in args {
match arg {
Expr::Literal(lit) => match lit {
Literal::Numeric(i) => {
if i.contains('.') {
vtable_args.push(limbo_ext::Value::from_float(i.parse().unwrap()));
vtable_args.push(turso_ext::Value::from_float(i.parse().unwrap()));
} else {
vtable_args.push(limbo_ext::Value::from_integer(i.parse().unwrap()));
vtable_args.push(turso_ext::Value::from_integer(i.parse().unwrap()));
}
}
Literal::String(s) => {
vtable_args.push(limbo_ext::Value::from_text(s.clone()));
vtable_args.push(turso_ext::Value::from_text(s.clone()));
}
Literal::Blob(b) => {
vtable_args.push(limbo_ext::Value::from_blob(b.as_bytes().into()));
vtable_args.push(turso_ext::Value::from_blob(b.as_bytes().into()));
}
_ => {
vtable_args.push(limbo_ext::Value::null());
vtable_args.push(turso_ext::Value::null());
}
},
_ => vtable_args.push(limbo_ext::Value::null()),
_ => vtable_args.push(turso_ext::Value::null()),
}
}
vtable_args

View file

@ -3,12 +3,12 @@ use crate::schema::Column;
use crate::util::{columns_from_create_table_body, vtable_args};
use crate::{Connection, LimboError, SymbolTable, Value};
use fallible_iterator::FallibleIterator;
use limbo_ext::{ConstraintInfo, IndexInfo, OrderByInfo, ResultCode, VTabKind, VTabModuleImpl};
use limbo_sqlite3_parser::{ast, lexer::sql::Parser};
use std::cell::RefCell;
use std::ffi::c_void;
use std::rc::Rc;
use std::sync::Arc;
use turso_ext::{ConstraintInfo, IndexInfo, OrderByInfo, ResultCode, VTabKind, VTabModuleImpl};
#[derive(Debug, Clone)]
enum VirtualTableType {
@ -62,7 +62,7 @@ impl VirtualTable {
pub fn table(
tbl_name: Option<&str>,
module_name: &str,
args: Vec<limbo_ext::Value>,
args: Vec<turso_ext::Value>,
syms: &SymbolTable,
) -> crate::Result<Rc<VirtualTable>> {
let module = syms.vtab_modules.get(module_name);
@ -178,7 +178,7 @@ impl VirtualTableCursor {
struct ExtVirtualTable {
implementation: Rc<VTabModuleImpl>,
table_ptr: *const c_void,
connection_ptr: RefCell<Option<*mut limbo_ext::Conn>>,
connection_ptr: RefCell<Option<*mut turso_ext::Conn>>,
}
impl Drop for ExtVirtualTable {
@ -187,7 +187,7 @@ impl Drop for ExtVirtualTable {
if conn.is_null() {
return;
}
// free the memory for the limbo_ext::Conn itself
// free the memory for the turso_ext::Conn itself
let mut conn = unsafe { Box::from_raw(conn) };
// frees the boxed Weak pointer
conn.close();
@ -212,7 +212,7 @@ impl ExtVirtualTable {
fn create(
module_name: &str,
module: Option<&Rc<crate::ext::VTabImpl>>,
args: Vec<limbo_ext::Value>,
args: Vec<turso_ext::Value>,
kind: VTabKind,
) -> crate::Result<(Self, String)> {
let module = module.ok_or(LimboError::ExtensionError(format!(
@ -243,7 +243,7 @@ impl ExtVirtualTable {
fn open(&self, conn: Arc<Connection>) -> crate::Result<ExtVirtualTableCursor> {
// we need a Weak<Connection> to upgrade and call from the extension.
let weak_box: *mut Arc<Connection> = Box::into_raw(Box::new(conn));
let conn = limbo_ext::Conn::new(
let conn = turso_ext::Conn::new(
weak_box.cast(),
crate::ext::prepare_stmt,
crate::ext::execute,

View file

@ -8,7 +8,7 @@ repository.workspace = true
description = "Limbo completion extension"
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
mimalloc = { version = "0.1", default-features = false }
@ -17,4 +17,4 @@ mimalloc = { version = "0.1", default-features = false }
crate-type = ["cdylib", "lib"]
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]

View file

@ -6,7 +6,7 @@ mod keywords;
use std::sync::Arc;
use keywords::KEYWORDS;
use limbo_ext::{
use turso_ext::{
register_extension, Connection, ResultCode, VTabCursor, VTabModule, VTabModuleDerive, VTable,
Value,
};
@ -67,7 +67,7 @@ struct CompletionVTabModule {}
impl VTabModule for CompletionVTabModule {
type Table = CompletionTable;
const NAME: &'static str = "completion";
const VTAB_KIND: limbo_ext::VTabKind = limbo_ext::VTabKind::TableValuedFunction;
const VTAB_KIND: turso_ext::VTabKind = turso_ext::VTabKind::TableValuedFunction;
fn create(_args: &[Value]) -> Result<(String, Self::Table), ResultCode> {
let schema = "CREATE TABLE completion(

View file

@ -1,5 +1,5 @@
[package]
name = "limbo_ext"
name = "turso_ext"
version.workspace = true
authors.workspace = true
edition.workspace = true

View file

@ -1,6 +1,6 @@
# Limbo extension API
# Turso extension API
The `limbo_ext` crate simplifies the creation and registration of libraries meant to extend the functionality of `Limbo`, that can be loaded
The `turso_ext` crate simplifies the creation and registration of libraries meant to extend the functionality of `Turso`, that can be loaded
like traditional `sqlite3` extensions, but are able to be written in much more ergonomic Rust.
---
@ -10,7 +10,7 @@ like traditional `sqlite3` extensions, but are able to be written in much more e
- [ x ] **Scalar Functions**: Create scalar functions using the `scalar` macro.
- [ x ] **Aggregate Functions**: Define aggregate functions with `AggregateDerive` macro and `AggFunc` trait.
- [ x ] **Virtual tables**: Create a module for a virtual table with the `VTabModuleDerive` macro and `VTabCursor` trait.
- [ x ] **VFS Modules**: Extend Limbo's OS interface by implementing `VfsExtension` and `VfsFile` traits.
- [ x ] **VFS Modules**: Extend Turso's OS interface by implementing `VfsExtension` and `VfsFile` traits.
---
## Installation
@ -28,10 +28,10 @@ creating an extension inside `core`, this step should be skipped.
```toml
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
[dependencies]
limbo_ext = { path = "path/to/limbo/extensions/core", features = ["static", "vfs"] } # temporary until crate is published
turso_ext = { path = "path/to/limbo/extensions/core", features = ["static", "vfs"] } # temporary until crate is published
# mimalloc is required if you intend on linking dynamically. It is imported for you by the register_extension
# macro, so no configuration is needed. But it must be added to your Cargo.toml
@ -71,7 +71,7 @@ file as the `register_extension` macro.
### Scalar Example:
```rust
use limbo_ext::{register_extension, Value, scalar};
use turso_ext::{register_extension, Value, scalar};
/// Annotate each with the scalar macro, specifying the name you would like to call it with
/// and optionally, an alias.. e.g. SELECT double(4); or SELECT twice(4);
@ -98,7 +98,7 @@ fn double(&self, args: &[Value]) -> Value {
```rust
use limbo_ext::{register_extension, AggregateDerive, AggFunc, Value};
use turso_ext::{register_extension, AggregateDerive, AggFunc, Value};
/// annotate your struct with the AggregateDerive macro, and it must implement the below AggFunc trait
#[derive(AggregateDerive)]
struct Percentile;
@ -317,7 +317,7 @@ You can use the `Rc<Connection>` to query the same underlying connection that cr
**NOTE**: Requires 'vfs' feature enabled.
```rust
use limbo_ext::{ExtResult as Result, VfsDerive, VfsExtension, VfsFile};
use turso_ext::{ExtResult as Result, VfsDerive, VfsExtension, VfsFile};
/// Your struct must also impl Default
#[derive(VfsDerive, Default)]
@ -421,7 +421,7 @@ Edit the workspace `Cargo.toml` to include your extension as a workspace depende
[workspace.dependencies]
turso_core = { path = "core", version = "0.0.17" }
limbo_crypto = { path = "extensions/crypto", version = "0.0.17" }
limbo_ext = { path = "extensions/core", 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" }
...
@ -448,7 +448,7 @@ Lastly, you have to register your extension statically in the core crate:
```diff
pub fn register_builtins(&self) -> Result<(), String> {
#[allow(unused_variables)]
let ext_api = self.build_limbo_ext();
let ext_api = self.build_turso_ext();
#[cfg(feature = "uuid")]
if unsafe { !limbo_uuid::register_extension_static(&ext_api).is_ok() } {
return Err("Failed to register uuid extension".to_string());

View file

@ -11,12 +11,12 @@ description = "Limbo crypto extension"
crate-type = ["cdylib", "lib"]
[features]
static= [ "limbo_ext/static" ]
static= [ "turso_ext/static" ]
[dependencies]
blake3 = "1.5.5"
data-encoding = "2.7.0"
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
md5 = "0.7.0"
ring = "0.17.8"
urlencoding = "2.1.3"

View file

@ -1,9 +1,9 @@
use crate::Error;
use blake3::Hasher;
use data_encoding::{BASE32, BASE64, HEXLOWER};
use limbo_ext::{Value, ValueType};
use ring::digest::{self, digest};
use std::{borrow::Cow, error::Error as StdError};
use turso_ext::{Value, ValueType};
pub fn sha256(data: &Value) -> Result<Vec<u8>, Error> {
match data.value_type() {

View file

@ -1,5 +1,5 @@
use crypto::{blake3, decode, encode, md5, sha1, sha256, sha384, sha512};
use limbo_ext::{register_extension, scalar, ResultCode, Value};
use turso_ext::{register_extension, scalar, ResultCode, Value};
mod crypto;

View file

@ -11,10 +11,10 @@ description = "Limbo CSV extension"
crate-type = ["cdylib", "lib"]
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
csv = "1.3.1"
[dev-dependencies]

View file

@ -20,13 +20,13 @@
//! accepts `yes`/`no`, `on`/`off`, `true`/`false`, or `1`/`0`
//! - `columns` — number of columns
//! - `schema` — optional custom SQL `CREATE TABLE` schema
use limbo_ext::{
register_extension, Connection, ConstraintInfo, IndexInfo, OrderByInfo, ResultCode, VTabCursor,
VTabKind, VTabModule, VTabModuleDerive, VTable, Value,
};
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use std::sync::Arc;
use turso_ext::{
register_extension, Connection, ConstraintInfo, IndexInfo, OrderByInfo, ResultCode, VTabCursor,
VTabKind, VTabModule, VTabModuleDerive, VTable, Value,
};
register_extension! {
vtabs: { CsvVTabModule }
@ -392,9 +392,9 @@ impl VTabCursor for CsvCursor {
#[cfg(test)]
mod tests {
use super::*;
use limbo_ext::{Value, ValueType};
use std::io::Write;
use tempfile::NamedTempFile;
use turso_ext::{Value, ValueType};
fn write_csv(content: &str) -> NamedTempFile {
let mut tmp = NamedTempFile::new().expect("Failed to create temp file");

View file

@ -11,10 +11,10 @@ description = "Limbo IPAddr extension"
crate-type = ["cdylib", "lib"]
[features]
static= [ "limbo_ext/static" ]
static= [ "turso_ext/static" ]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
ipnetwork = "0.21.1"
[target.'cfg(not(target_family = "wasm"))'.dependencies]

View file

@ -1,7 +1,7 @@
use std::net::IpAddr;
use ipnetwork::IpNetwork;
use limbo_ext::{register_extension, scalar, ResultCode, Value};
use turso_ext::{register_extension, scalar, ResultCode, Value};
register_extension! {
scalars: { ip_contains, ip_family, ip_host, ip_masklen, ip_network },

View file

@ -11,10 +11,10 @@ description = "Limbo percentile extension"
crate-type = ["cdylib", "lib"]
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
mimalloc = { version = "0.1", default-features = false }

View file

@ -1,4 +1,4 @@
use limbo_ext::{register_extension, AggFunc, AggregateDerive, Value};
use turso_ext::{register_extension, AggFunc, AggregateDerive, Value};
register_extension! {
aggregates: { Median, Percentile, PercentileCont, PercentileDisc }

View file

@ -8,7 +8,7 @@ repository.workspace = true
description = "Limbo regexp extension"
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
defaults = []
[lib]
@ -16,7 +16,7 @@ crate-type = ["cdylib", "lib"]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
regex = "1.11.1"
[target.'cfg(not(target_family = "wasm"))'.dependencies]

View file

@ -1,5 +1,5 @@
use limbo_ext::{register_extension, scalar, Value, ValueType};
use regex::Regex;
use turso_ext::{register_extension, scalar, Value, ValueType};
register_extension! {
scalars: { regexp, regexp_like, regexp_substr, regexp_replace }

View file

@ -8,14 +8,14 @@ repository.workspace = true
description = "Limbo series extension"
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
mimalloc = { version = "0.1", default-features = false }

View file

@ -1,6 +1,6 @@
use std::sync::Arc;
use limbo_ext::{
use turso_ext::{
register_extension, Connection, ResultCode, VTabCursor, VTabKind, VTabModule, VTabModuleDerive,
VTable, Value,
};

View file

@ -1,5 +1,5 @@
[package]
name = "limbo_ext_tests"
name = "turso_ext_tests"
version.workspace = true
authors.workspace = true
edition.workspace = true
@ -11,12 +11,12 @@ description = "Limbo extension tests"
crate-type = ["cdylib", "lib"]
[features]
static= [ "limbo_ext/static" ]
static= [ "turso_ext/static" ]
[dependencies]
env_logger = "0.11.6"
lazy_static = "1.5.0"
limbo_ext = { workspace = true, features = ["static", "vfs"] }
turso_ext = { workspace = true, features = ["static", "vfs"] }
log = "0.4.26"
[target.'cfg(not(target_family = "wasm"))'.dependencies]

View file

@ -1,16 +1,16 @@
use lazy_static::lazy_static;
use limbo_ext::{
register_extension, scalar, Connection, ConstraintInfo, ConstraintOp, ConstraintUsage,
ExtResult, IndexInfo, OrderByInfo, ResultCode, StepResult, VTabCursor, VTabKind, VTabModule,
VTabModuleDerive, VTable, Value,
};
#[cfg(not(target_family = "wasm"))]
use limbo_ext::{VfsDerive, VfsExtension, VfsFile};
use std::collections::BTreeMap;
use std::fs::{File, OpenOptions};
use std::io::{Read, Seek, SeekFrom, Write};
use std::num::NonZeroUsize;
use std::sync::{Arc, Mutex};
use turso_ext::{
register_extension, scalar, Connection, ConstraintInfo, ConstraintOp, ConstraintUsage,
ExtResult, IndexInfo, OrderByInfo, ResultCode, StepResult, VTabCursor, VTabKind, VTabModule,
VTabModuleDerive, VTable, Value,
};
#[cfg(not(target_family = "wasm"))]
use turso_ext::{VfsDerive, VfsExtension, VfsFile};
register_extension! {
vtabs: { KVStoreVTabModule, TableStatsVtabModule },
@ -241,8 +241,8 @@ pub struct TestFS;
// Test that we can have additional extension types in the same file
// and still register the vfs at comptime if linking staticly
#[scalar(name = "test_scalar")]
fn test_scalar(_args: limbo_ext::Value) -> limbo_ext::Value {
limbo_ext::Value::from_integer(42)
fn test_scalar(_args: turso_ext::Value) -> turso_ext::Value {
turso_ext::Value::from_integer(42)
}
#[cfg(not(target_family = "wasm"))]

View file

@ -11,14 +11,14 @@ description = "Limbo time extension"
crate-type = ["cdylib", "lib"]
[features]
static = ["limbo_ext/static"]
static = ["turso_ext/static"]
[target.'cfg(not(target_family = "wasm"))'.dependencies]
mimalloc = { version = "0.1", default-features = false }
[dependencies]
chrono = "0.4.39"
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
strum = "0.26.3"
strum_macros = "0.26.3"
thiserror = "2.0.11"

View file

@ -2,10 +2,10 @@ use std::str::FromStr as _;
use chrono::prelude::*;
use core::cmp::Ordering;
use limbo_ext::ValueType;
use thiserror::Error;
use turso_ext::ValueType;
use limbo_ext::{register_extension, scalar, ResultCode, Value};
use turso_ext::{register_extension, scalar, ResultCode, Value};
mod time;

View file

@ -3,7 +3,7 @@ use std::ops::{Deref, Sub};
use chrono::{self, DateTime, Timelike, Utc};
use chrono::{prelude::*, DurationRound};
use limbo_ext::Value;
use turso_ext::Value;
use crate::{Result, TimeError};

View file

@ -11,10 +11,10 @@ description = "Limbo UUID extension"
crate-type = ["cdylib", "lib"]
[features]
static= [ "limbo_ext/static" ]
static= [ "turso_ext/static" ]
[dependencies]
limbo_ext = { workspace = true, features = ["static"] }
turso_ext = { workspace = true, features = ["static"] }
uuid = { version = "1.11.0", features = ["v4", "v7"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]

View file

@ -1,4 +1,4 @@
use limbo_ext::{register_extension, scalar, ResultCode, Value, ValueType};
use turso_ext::{register_extension, scalar, ResultCode, Value, ValueType};
register_extension! {
scalars: {uuid4_str, uuid4_blob, uuid7_str, uuid7, uuid7_ts, uuid_str, uuid_blob },

26
fuzz/Cargo.lock generated
View file

@ -564,21 +564,12 @@ dependencies = [
"turso_core",
]
[[package]]
name = "limbo_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.1",
"turso_macros",
]
[[package]]
name = "limbo_series"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
]
[[package]]
@ -605,19 +596,19 @@ name = "limbo_time"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"limbo_ext",
"mimalloc",
"strum",
"strum_macros",
"thiserror 2.0.12",
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
"uuid",
]
@ -1145,7 +1136,6 @@ dependencies = [
"julian_day_converter",
"libloading",
"libm",
"limbo_ext",
"limbo_series",
"limbo_sqlite3_parser",
"limbo_time",
@ -1164,10 +1154,20 @@ dependencies = [
"strum_macros",
"thiserror 1.0.69",
"tracing",
"turso_ext",
"turso_macros",
"uncased",
]
[[package]]
name = "turso_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.1",
"turso_macros",
]
[[package]]
name = "turso_macros"
version = "0.1.0-pre.2"

View file

@ -15,9 +15,9 @@ pub fn derive_agg_func(input: TokenStream) -> TokenStream {
let expanded = quote! {
impl #struct_name {
#[no_mangle]
pub extern "C" fn #init_fn_name() -> *mut ::limbo_ext::AggCtx {
let state = ::std::boxed::Box::new(<#struct_name as ::limbo_ext::AggFunc>::State::default());
let ctx = ::std::boxed::Box::new(::limbo_ext::AggCtx {
pub extern "C" fn #init_fn_name() -> *mut ::turso_ext::AggCtx {
let state = ::std::boxed::Box::new(<#struct_name as ::turso_ext::AggFunc>::State::default());
let ctx = ::std::boxed::Box::new(::turso_ext::AggCtx {
state: ::std::boxed::Box::into_raw(state) as *mut ::std::os::raw::c_void,
});
::std::boxed::Box::into_raw(ctx)
@ -25,29 +25,29 @@ pub fn derive_agg_func(input: TokenStream) -> TokenStream {
#[no_mangle]
pub extern "C" fn #step_fn_name(
ctx: *mut ::limbo_ext::AggCtx,
ctx: *mut ::turso_ext::AggCtx,
argc: i32,
argv: *const ::limbo_ext::Value,
argv: *const ::turso_ext::Value,
) {
unsafe {
let ctx = &mut *ctx;
let state = &mut *(ctx.state as *mut <#struct_name as ::limbo_ext::AggFunc>::State);
let state = &mut *(ctx.state as *mut <#struct_name as ::turso_ext::AggFunc>::State);
let args = ::std::slice::from_raw_parts(argv, argc as usize);
<#struct_name as ::limbo_ext::AggFunc>::step(state, args);
<#struct_name as ::turso_ext::AggFunc>::step(state, args);
}
}
#[no_mangle]
pub extern "C" fn #finalize_fn_name(
ctx: *mut ::limbo_ext::AggCtx
) -> ::limbo_ext::Value {
ctx: *mut ::turso_ext::AggCtx
) -> ::turso_ext::Value {
unsafe {
let ctx = &mut *ctx;
let state = ::std::boxed::Box::from_raw(ctx.state as *mut <#struct_name as ::limbo_ext::AggFunc>::State);
match <#struct_name as ::limbo_ext::AggFunc>::finalize(*state) {
let state = ::std::boxed::Box::from_raw(ctx.state as *mut <#struct_name as ::turso_ext::AggFunc>::State);
match <#struct_name as ::turso_ext::AggFunc>::finalize(*state) {
Ok(val) => val,
Err(e) => {
::limbo_ext::Value::error_with_message(e.to_string())
::turso_ext::Value::error_with_message(e.to_string())
}
}
}
@ -55,17 +55,17 @@ pub fn derive_agg_func(input: TokenStream) -> TokenStream {
#[no_mangle]
pub unsafe extern "C" fn #register_fn_name(
api: *const ::limbo_ext::ExtensionApi
) -> ::limbo_ext::ResultCode {
api: *const ::turso_ext::ExtensionApi
) -> ::turso_ext::ResultCode {
if api.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let api = &*api;
let name_str = #struct_name::NAME;
let c_name = match ::std::ffi::CString::new(name_str) {
Ok(cname) => cname,
Err(_) => return ::limbo_ext::ResultCode::Error,
Err(_) => return ::turso_ext::ResultCode::Error,
};
(api.register_aggregate_function)(
@ -73,11 +73,11 @@ pub fn derive_agg_func(input: TokenStream) -> TokenStream {
c_name.as_ptr(),
#struct_name::ARGS,
#struct_name::#init_fn_name
as ::limbo_ext::InitAggFunction,
as ::turso_ext::InitAggFunction,
#struct_name::#step_fn_name
as ::limbo_ext::StepFunction,
as ::turso_ext::StepFunction,
#struct_name::#finalize_fn_name
as ::limbo_ext::FinalizeFunction,
as ::turso_ext::FinalizeFunction,
)
}
}

View file

@ -91,7 +91,7 @@ pub fn register_extension(input: TokenStream) -> TokenStream {
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[cfg(feature = "static")]
pub unsafe extern "C" fn register_extension_static(api: &mut ::limbo_ext::ExtensionApi) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn register_extension_static(api: &mut ::turso_ext::ExtensionApi) -> ::turso_ext::ResultCode {
#(#static_scalars)*
#(#static_aggregates)*
@ -101,12 +101,12 @@ pub fn register_extension(input: TokenStream) -> TokenStream {
#[cfg(not(target_family = "wasm"))]
#(#static_vfs)*
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[cfg(not(feature = "static"))]
#[no_mangle]
pub unsafe extern "C" fn register_extension(api: &::limbo_ext::ExtensionApi) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn register_extension(api: &::turso_ext::ExtensionApi) -> ::turso_ext::ResultCode {
#(#scalar_calls)*
#(#aggregate_calls)*
@ -115,7 +115,7 @@ pub fn register_extension(input: TokenStream) -> TokenStream {
#(#vfs_calls)*
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
};

View file

@ -23,7 +23,7 @@ pub fn scalar(attr: TokenStream, input: TokenStream) -> TokenStream {
let alias_check = if let Some(alias) = &scalar_info.alias {
quote! {
let Ok(alias_c_name) = ::std::ffi::CString::new(#alias) else {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
};
(api.register_scalar_function)(
api.ctx,
@ -38,14 +38,14 @@ pub fn scalar(attr: TokenStream, input: TokenStream) -> TokenStream {
let expanded = quote! {
#[no_mangle]
pub unsafe extern "C" fn #register_fn_name(
api: *const ::limbo_ext::ExtensionApi
) -> ::limbo_ext::ResultCode {
api: *const ::turso_ext::ExtensionApi
) -> ::turso_ext::ResultCode {
if api.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let api = unsafe { &*api };
let Ok(c_name) = ::std::ffi::CString::new(#name) else {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
};
(api.register_scalar_function)(
api.ctx,
@ -53,14 +53,14 @@ pub fn scalar(attr: TokenStream, input: TokenStream) -> TokenStream {
#fn_name,
);
#alias_check
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[no_mangle]
pub unsafe extern "C" fn #fn_name(
argc: i32,
argv: *const ::limbo_ext::Value
) -> ::limbo_ext::Value {
argv: *const ::turso_ext::Value
) -> ::turso_ext::Value {
let #args_variable_name = if argv.is_null() || argc <= 0 {
&[]
} else {

View file

@ -21,11 +21,11 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
let expanded = quote! {
#[allow(non_snake_case)]
pub unsafe extern "C" fn #register_static() -> *const ::limbo_ext::VfsImpl {
pub unsafe extern "C" fn #register_static() -> *const ::turso_ext::VfsImpl {
let ctx = #struct_name::default();
let ctx = ::std::boxed::Box::into_raw(::std::boxed::Box::new(ctx)) as *const ::std::ffi::c_void;
let name = ::std::ffi::CString::new(<#struct_name as ::limbo_ext::VfsExtension>::NAME).unwrap().into_raw();
let vfs_mod = ::limbo_ext::VfsImpl {
let name = ::std::ffi::CString::new(<#struct_name as ::turso_ext::VfsExtension>::NAME).unwrap().into_raw();
let vfs_mod = ::turso_ext::VfsImpl {
vfs: ctx,
name,
open: #open_fn_name,
@ -40,15 +40,15 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
gen_random_number: #generate_random_number_fn_name,
current_time: #get_current_time_fn_name,
};
::std::boxed::Box::into_raw(::std::boxed::Box::new(vfs_mod)) as *const ::limbo_ext::VfsImpl
::std::boxed::Box::into_raw(::std::boxed::Box::new(vfs_mod)) as *const ::turso_ext::VfsImpl
}
#[no_mangle]
pub unsafe extern "C" fn #register_fn_name(api: &::limbo_ext::ExtensionApi) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn #register_fn_name(api: &::turso_ext::ExtensionApi) -> ::turso_ext::ResultCode {
let ctx = #struct_name::default();
let ctx = ::std::boxed::Box::into_raw(::std::boxed::Box::new(ctx)) as *const ::std::ffi::c_void;
let name = ::std::ffi::CString::new(<#struct_name as ::limbo_ext::VfsExtension>::NAME).unwrap().into_raw();
let vfs_mod = ::limbo_ext::VfsImpl {
let name = ::std::ffi::CString::new(<#struct_name as ::turso_ext::VfsExtension>::NAME).unwrap().into_raw();
let vfs_mod = ::turso_ext::VfsImpl {
vfs: ctx,
name,
open: #open_fn_name,
@ -63,7 +63,7 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
gen_random_number: #generate_random_number_fn_name,
current_time: #get_current_time_fn_name,
};
let vfsimpl = ::std::boxed::Box::into_raw(::std::boxed::Box::new(vfs_mod)) as *const ::limbo_ext::VfsImpl;
let vfsimpl = ::std::boxed::Box::into_raw(::std::boxed::Box::new(vfs_mod)) as *const ::turso_ext::VfsImpl;
(api.vfs_interface.register_vfs)(name, vfsimpl)
}
@ -74,36 +74,36 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
flags: i32,
direct: bool,
) -> *const ::std::ffi::c_void {
let ctx = &*(ctx as *const ::limbo_ext::VfsImpl);
let ctx = &*(ctx as *const ::turso_ext::VfsImpl);
let Ok(path_str) = ::std::ffi::CStr::from_ptr(path).to_str() else {
return ::std::ptr::null_mut();
};
let vfs = &*(ctx.vfs as *const #struct_name);
let Ok(file_handle) = <#struct_name as ::limbo_ext::VfsExtension>::open_file(vfs, path_str, flags, direct) else {
let Ok(file_handle) = <#struct_name as ::turso_ext::VfsExtension>::open_file(vfs, path_str, flags, direct) else {
return ::std::ptr::null();
};
let boxed = ::std::boxed::Box::into_raw(::std::boxed::Box::new(file_handle)) as *const ::std::ffi::c_void;
let Ok(vfs_file) = ::limbo_ext::VfsFileImpl::new(boxed, ctx) else {
let Ok(vfs_file) = ::turso_ext::VfsFileImpl::new(boxed, ctx) else {
return ::std::ptr::null();
};
::std::boxed::Box::into_raw(::std::boxed::Box::new(vfs_file)) as *const ::std::ffi::c_void
}
#[no_mangle]
pub unsafe extern "C" fn #close_fn_name(file_ptr: *const ::std::ffi::c_void) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn #close_fn_name(file_ptr: *const ::std::ffi::c_void) -> ::turso_ext::ResultCode {
if file_ptr.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let vfs_instance = &*(vfs_file.vfs as *const #struct_name);
// this time we need to own it so we can drop it
let file: ::std::boxed::Box<<#struct_name as ::limbo_ext::VfsExtension>::File> =
::std::boxed::Box::from_raw(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::limbo_ext::VfsExtension>::close(vfs_instance, *file) {
let file: ::std::boxed::Box<<#struct_name as ::turso_ext::VfsExtension>::File> =
::std::boxed::Box::from_raw(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::turso_ext::VfsExtension>::close(vfs_instance, *file) {
return e;
}
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[no_mangle]
@ -111,25 +111,25 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
if file_ptr.is_null() {
return -1;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
match <#struct_name as ::limbo_ext::VfsExtension>::File::read(file, ::std::slice::from_raw_parts_mut(buf, count), count, offset) {
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
match <#struct_name as ::turso_ext::VfsExtension>::File::read(file, ::std::slice::from_raw_parts_mut(buf, count), count, offset) {
Ok(n) => n,
Err(_) => -1,
}
}
#[no_mangle]
pub unsafe extern "C" fn #run_once_fn_name(ctx: *const ::std::ffi::c_void) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn #run_once_fn_name(ctx: *const ::std::ffi::c_void) -> ::turso_ext::ResultCode {
if ctx.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let ctx = &mut *(ctx as *mut #struct_name);
if let Err(e) = <#struct_name as ::limbo_ext::VfsExtension>::run_once(ctx) {
if let Err(e) = <#struct_name as ::turso_ext::VfsExtension>::run_once(ctx) {
return e;
}
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[no_mangle]
@ -137,41 +137,41 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
if file_ptr.is_null() {
return -1;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
match <#struct_name as ::limbo_ext::VfsExtension>::File::write(file, ::std::slice::from_raw_parts(buf, count), count, offset) {
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
match <#struct_name as ::turso_ext::VfsExtension>::File::write(file, ::std::slice::from_raw_parts(buf, count), count, offset) {
Ok(n) => n,
Err(_) => -1,
}
}
#[no_mangle]
pub unsafe extern "C" fn #lock_fn_name(file_ptr: *const ::std::ffi::c_void, exclusive: bool) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn #lock_fn_name(file_ptr: *const ::std::ffi::c_void, exclusive: bool) -> ::turso_ext::ResultCode {
if file_ptr.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::limbo_ext::VfsExtension>::File::lock(file, exclusive) {
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::turso_ext::VfsExtension>::File::lock(file, exclusive) {
return e;
}
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[no_mangle]
pub unsafe extern "C" fn #unlock_fn_name(file_ptr: *const ::std::ffi::c_void) -> ::limbo_ext::ResultCode {
pub unsafe extern "C" fn #unlock_fn_name(file_ptr: *const ::std::ffi::c_void) -> ::turso_ext::ResultCode {
if file_ptr.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::limbo_ext::VfsExtension>::File::unlock(file) {
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
if let Err(e) = <#struct_name as ::turso_ext::VfsExtension>::File::unlock(file) {
return e;
}
::limbo_ext::ResultCode::OK
::turso_ext::ResultCode::OK
}
#[no_mangle]
@ -179,10 +179,10 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
if file_ptr.is_null() {
return -1;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
if <#struct_name as ::limbo_ext::VfsExtension>::File::sync(file).is_err() {
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
if <#struct_name as ::turso_ext::VfsExtension>::File::sync(file).is_err() {
return -1;
}
0
@ -193,22 +193,22 @@ pub fn derive_vfs_module(input: TokenStream) -> TokenStream {
if file_ptr.is_null() {
return -1;
}
let vfs_file: &mut ::limbo_ext::VfsFileImpl = &mut *(file_ptr as *mut ::limbo_ext::VfsFileImpl);
let file: &mut <#struct_name as ::limbo_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::limbo_ext::VfsExtension>::File);
<#struct_name as ::limbo_ext::VfsExtension>::File::size(file)
let vfs_file: &mut ::turso_ext::VfsFileImpl = &mut *(file_ptr as *mut ::turso_ext::VfsFileImpl);
let file: &mut <#struct_name as ::turso_ext::VfsExtension>::File =
&mut *(vfs_file.file as *mut <#struct_name as ::turso_ext::VfsExtension>::File);
<#struct_name as ::turso_ext::VfsExtension>::File::size(file)
}
#[no_mangle]
pub unsafe extern "C" fn #generate_random_number_fn_name() -> i64 {
let obj = #struct_name::default();
<#struct_name as ::limbo_ext::VfsExtension>::generate_random_number(&obj)
<#struct_name as ::turso_ext::VfsExtension>::generate_random_number(&obj)
}
#[no_mangle]
pub unsafe extern "C" fn #get_current_time_fn_name() -> *const ::std::ffi::c_char {
let obj = #struct_name::default();
let time = <#struct_name as ::limbo_ext::VfsExtension>::get_current_time(&obj);
let time = <#struct_name as ::turso_ext::VfsExtension>::get_current_time(&obj);
// release ownership of the string to core
::std::ffi::CString::new(time).unwrap().into_raw() as *const ::std::ffi::c_char
}

View file

@ -23,23 +23,23 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
impl #struct_name {
#[no_mangle]
unsafe extern "C" fn #create_fn_name(
argv: *const ::limbo_ext::Value, argc: i32
) -> ::limbo_ext::VTabCreateResult {
argv: *const ::turso_ext::Value, argc: i32
) -> ::turso_ext::VTabCreateResult {
let args = if argv.is_null() {
&Vec::new()
} else {
::std::slice::from_raw_parts(argv, argc as usize)
};
match <#struct_name as ::limbo_ext::VTabModule>::create(&args) {
match <#struct_name as ::turso_ext::VTabModule>::create(&args) {
Ok((schema, table)) => {
::limbo_ext::VTabCreateResult {
code: ::limbo_ext::ResultCode::OK,
::turso_ext::VTabCreateResult {
code: ::turso_ext::ResultCode::OK,
schema: ::std::ffi::CString::new(schema).unwrap().into_raw(),
table: ::std::boxed::Box::into_raw(::std::boxed::Box::new(table)) as *const ::std::ffi::c_void,
}
},
Err(e) => {
::limbo_ext::VTabCreateResult {
::turso_ext::VTabCreateResult {
code: e,
schema: ::std::ptr::null(),
table: ::std::ptr::null(),
@ -49,14 +49,14 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
}
#[no_mangle]
unsafe extern "C" fn #open_fn_name(table: *const ::std::ffi::c_void, conn: *mut ::limbo_ext::Conn) -> *const ::std::ffi::c_void {
unsafe extern "C" fn #open_fn_name(table: *const ::std::ffi::c_void, conn: *mut ::turso_ext::Conn) -> *const ::std::ffi::c_void {
if table.is_null() {
return ::std::ptr::null();
}
let table = table as *const <#struct_name as ::limbo_ext::VTabModule>::Table;
let table: &<#struct_name as ::limbo_ext::VTabModule>::Table = &*table;
let conn = if conn.is_null() { None } else { Some(::std::sync::Arc::new(::limbo_ext::Connection::new(conn)))};
if let Ok(cursor) = <#struct_name as ::limbo_ext::VTabModule>::Table::open(table, conn) {
let table = table as *const <#struct_name as ::turso_ext::VTabModule>::Table;
let table: &<#struct_name as ::turso_ext::VTabModule>::Table = &*table;
let conn = if conn.is_null() { None } else { Some(::std::sync::Arc::new(::turso_ext::Connection::new(conn)))};
if let Ok(cursor) = <#struct_name as ::turso_ext::VTabModule>::Table::open(table, conn) {
return ::std::boxed::Box::into_raw(::std::boxed::Box::new(cursor)) as *const ::std::ffi::c_void;
} else {
return ::std::ptr::null();
@ -66,60 +66,60 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
#[no_mangle]
unsafe extern "C" fn #close_fn_name(
cursor: *const ::std::ffi::c_void
) -> ::limbo_ext::ResultCode {
) -> ::turso_ext::ResultCode {
if cursor.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let cursor = cursor as *mut <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor;
let cursor = cursor as *mut <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor;
let cursor = ::std::boxed::Box::from_raw(cursor);
<<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::close(&*cursor)
<<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::close(&*cursor)
}
#[no_mangle]
unsafe extern "C" fn #filter_fn_name(
cursor: *const ::std::ffi::c_void,
argc: i32,
argv: *const ::limbo_ext::Value,
argv: *const ::turso_ext::Value,
idx_str: *const ::std::ffi::c_char,
idx_num: i32,
) -> ::limbo_ext::ResultCode {
) -> ::turso_ext::ResultCode {
if cursor.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let cursor = &mut *(cursor as *mut <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor);
let cursor = &mut *(cursor as *mut <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor);
let args = ::std::slice::from_raw_parts(argv, argc as usize);
let idx_str = if idx_str.is_null() {
None
} else {
Some((unsafe { ::std::ffi::CStr::from_ptr(idx_str).to_str().unwrap() }, idx_num))
};
<<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::filter(cursor, args, idx_str)
<<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::filter(cursor, args, idx_str)
}
#[no_mangle]
unsafe extern "C" fn #column_fn_name(
cursor: *const ::std::ffi::c_void,
idx: u32,
) -> ::limbo_ext::Value {
) -> ::turso_ext::Value {
if cursor.is_null() {
return ::limbo_ext::Value::error(::limbo_ext::ResultCode::Error);
return ::turso_ext::Value::error(::turso_ext::ResultCode::Error);
}
let cursor = &*(cursor as *const <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor);
match <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::column(cursor, idx) {
let cursor = &*(cursor as *const <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor);
match <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::column(cursor, idx) {
Ok(val) => val,
Err(e) => ::limbo_ext::Value::error_with_message(e.to_string())
Err(e) => ::turso_ext::Value::error_with_message(e.to_string())
}
}
#[no_mangle]
unsafe extern "C" fn #next_fn_name(
cursor: *const ::std::ffi::c_void,
) -> ::limbo_ext::ResultCode {
) -> ::turso_ext::ResultCode {
if cursor.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let cursor = &mut *(cursor as *mut <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor);
<<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::next(cursor)
let cursor = &mut *(cursor as *mut <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor);
<<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::next(cursor)
}
#[no_mangle]
@ -129,30 +129,30 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
if cursor.is_null() {
return true;
}
let cursor = &*(cursor as *const <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor);
<<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::eof(cursor)
let cursor = &*(cursor as *const <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor);
<<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::eof(cursor)
}
#[no_mangle]
unsafe extern "C" fn #update_fn_name(
table: *const ::std::ffi::c_void,
argc: i32,
argv: *const ::limbo_ext::Value,
argv: *const ::turso_ext::Value,
p_out_rowid: *mut i64,
) -> ::limbo_ext::ResultCode {
) -> ::turso_ext::ResultCode {
if table.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let table = &mut *(table as *mut <#struct_name as ::limbo_ext::VTabModule>::Table);
let table = &mut *(table as *mut <#struct_name as ::turso_ext::VTabModule>::Table);
let args = ::std::slice::from_raw_parts(argv, argc as usize);
let old_rowid = match args.get(0).map(|v| v.value_type()) {
Some(::limbo_ext::ValueType::Integer) => args.get(0).unwrap().to_integer(),
Some(::turso_ext::ValueType::Integer) => args.get(0).unwrap().to_integer(),
_ => None,
};
let new_rowid = match args.get(1).map(|v| v.value_type()) {
Some(::limbo_ext::ValueType::Integer) => args.get(1).unwrap().to_integer(),
Some(::turso_ext::ValueType::Integer) => args.get(1).unwrap().to_integer(),
_ => None,
};
let columns = &args[2..];
@ -160,29 +160,29 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
// DELETE: old_rowid provided, no new_rowid
(Some(old), None) => {
if <#struct_name as VTabModule>::Table::delete(table, old).is_err() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
return ::limbo_ext::ResultCode::OK;
return ::turso_ext::ResultCode::OK;
}
// UPDATE: old_rowid provided and new_rowid may exist
(Some(old), Some(new)) => {
if <#struct_name as VTabModule>::Table::update(table, old, &columns).is_err() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
return ::limbo_ext::ResultCode::OK;
return ::turso_ext::ResultCode::OK;
}
// INSERT: no old_rowid (old_rowid = None)
(None, _) => {
if let Ok(rowid) = <#struct_name as VTabModule>::Table::insert(table, &columns) {
if !p_out_rowid.is_null() {
*p_out_rowid = rowid;
return ::limbo_ext::ResultCode::RowID;
return ::turso_ext::ResultCode::RowID;
}
return ::limbo_ext::ResultCode::OK;
return ::turso_ext::ResultCode::OK;
}
}
}
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
#[no_mangle]
@ -190,51 +190,51 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
if cursor.is_null() {
return -1;
}
let cursor = &*(cursor as *const <<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor);
<<#struct_name as ::limbo_ext::VTabModule>::Table as ::limbo_ext::VTable>::Cursor::rowid(cursor)
let cursor = &*(cursor as *const <<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor);
<<#struct_name as ::turso_ext::VTabModule>::Table as ::turso_ext::VTable>::Cursor::rowid(cursor)
}
#[no_mangle]
unsafe extern "C" fn #destroy_fn_name(
table: *const ::std::ffi::c_void,
) -> ::limbo_ext::ResultCode {
) -> ::turso_ext::ResultCode {
if table.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
// Take ownership of the table so it can be properly dropped.
let mut table: ::std::boxed::Box<<#struct_name as ::limbo_ext::VTabModule>::Table> =
::std::boxed::Box::from_raw(table as *mut <#struct_name as ::limbo_ext::VTabModule>::Table);
let mut table: ::std::boxed::Box<<#struct_name as ::turso_ext::VTabModule>::Table> =
::std::boxed::Box::from_raw(table as *mut <#struct_name as ::turso_ext::VTabModule>::Table);
if <#struct_name as VTabModule>::Table::destroy(&mut *table).is_err() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
return ::limbo_ext::ResultCode::OK;
return ::turso_ext::ResultCode::OK;
}
#[no_mangle]
pub unsafe extern "C" fn #best_idx_fn_name(
constraints: *const ::limbo_ext::ConstraintInfo,
constraints: *const ::turso_ext::ConstraintInfo,
n_constraints: i32,
order_by: *const ::limbo_ext::OrderByInfo,
order_by: *const ::turso_ext::OrderByInfo,
n_order_by: i32,
) -> ::limbo_ext::ExtIndexInfo {
) -> ::turso_ext::ExtIndexInfo {
let constraints = if n_constraints > 0 { std::slice::from_raw_parts(constraints, n_constraints as usize) } else { &[] };
let order_by = if n_order_by > 0 { std::slice::from_raw_parts(order_by, n_order_by as usize) } else { &[] };
<#struct_name as ::limbo_ext::VTabModule>::Table::best_index(constraints, order_by).to_ffi()
<#struct_name as ::turso_ext::VTabModule>::Table::best_index(constraints, order_by).to_ffi()
}
#[no_mangle]
pub unsafe extern "C" fn #register_fn_name(
api: *const ::limbo_ext::ExtensionApi
) -> ::limbo_ext::ResultCode {
api: *const ::turso_ext::ExtensionApi
) -> ::turso_ext::ResultCode {
if api.is_null() {
return ::limbo_ext::ResultCode::Error;
return ::turso_ext::ResultCode::Error;
}
let api = &*api;
let name = <#struct_name as ::limbo_ext::VTabModule>::NAME;
let name = <#struct_name as ::turso_ext::VTabModule>::NAME;
let name_c = ::std::ffi::CString::new(name).unwrap().into_raw() as *const ::std::ffi::c_char;
let module = ::limbo_ext::VTabModuleImpl {
let module = ::turso_ext::VTabModuleImpl {
name: name_c,
create: Self::#create_fn_name,
open: Self::#open_fn_name,
@ -248,7 +248,7 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
destroy: Self::#destroy_fn_name,
best_idx: Self::#best_idx_fn_name,
};
(api.register_vtab_module)(api.ctx, name_c, module, <#struct_name as ::limbo_ext::VTabModule>::VTAB_KIND)
(api.register_vtab_module)(api.ctx, name_c, module, <#struct_name as ::turso_ext::VTabModule>::VTAB_KIND)
}
}
};

View file

@ -137,7 +137,7 @@ fn generate_get_description(
/// Register your extension with 'core' by providing the relevant functions
///```ignore
///use limbo_ext::{register_extension, scalar, Value, AggregateDerive, AggFunc};
///use turso_ext::{register_extension, scalar, Value, AggregateDerive, AggFunc};
///
/// register_extension!{ scalars: { return_one }, aggregates: { SumPlusOne } }
///
@ -175,7 +175,7 @@ pub fn register_extension(input: TokenStream) -> TokenStream {
/// Declare a scalar function for your extension. This requires the name:
/// #[scalar(name = "example")] of what you wish to call your function with.
/// ```ignore
/// use limbo_ext::{scalar, Value};
/// use turso_ext::{scalar, Value};
/// #[scalar(name = "double", alias = "twice")] // you can provide an <optional> alias
/// fn double(args: &[Value]) -> Value {
/// let arg = args.get(0).unwrap();
@ -202,7 +202,7 @@ pub fn scalar(attr: TokenStream, input: TokenStream) -> TokenStream {
/// Define an aggregate function for your extension by deriving
/// AggregateDerive on a struct that implements the AggFunc trait.
/// ```ignore
/// use limbo_ext::{register_extension, Value, AggregateDerive, AggFunc};
/// use turso_ext::{register_extension, Value, AggregateDerive, AggFunc};
///
///#[derive(AggregateDerive)]
///struct SumPlusOne;
@ -353,7 +353,7 @@ pub fn derive_vtab_module(input: TokenStream) -> TokenStream {
}
/// ```ignore
/// use limbo_ext::{ExtResult as Result, VfsDerive, VfsExtension, VfsFile};
/// use turso_ext::{ExtResult as Result, VfsDerive, VfsExtension, VfsFile};
///
/// // Your struct must also impl Default
/// #[derive(VfsDerive, Default)]

View file

@ -652,21 +652,12 @@ dependencies = [
"turso_core",
]
[[package]]
name = "limbo_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.3",
"turso_macros",
]
[[package]]
name = "limbo_series"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
]
[[package]]
@ -693,19 +684,19 @@ name = "limbo_time"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"limbo_ext",
"mimalloc",
"strum",
"strum_macros",
"thiserror 2.0.12",
"turso_ext",
]
[[package]]
name = "limbo_uuid"
version = "0.1.0-pre.2"
dependencies = [
"limbo_ext",
"mimalloc",
"turso_ext",
"uuid",
]
@ -1246,7 +1237,6 @@ dependencies = [
"julian_day_converter",
"libloading",
"libm",
"limbo_ext",
"limbo_series",
"limbo_sqlite3_parser",
"limbo_time",
@ -1265,10 +1255,20 @@ dependencies = [
"strum_macros",
"thiserror 1.0.63",
"tracing",
"turso_ext",
"turso_macros",
"uncased",
]
[[package]]
name = "turso_ext"
version = "0.1.0-pre.2"
dependencies = [
"chrono",
"getrandom 0.3.3",
"turso_macros",
]
[[package]]
name = "turso_macros"
version = "0.1.0-pre.2"

View file

@ -1,8 +1,7 @@
#!/bin/sh
cargo publish -p turso_macros
cargo publish -p limbo_ext
cargo publish -p limbo_ext_tests
cargo publish -p turso_ext
cargo publish -p limbo_completion
cargo publish -p limbo_crypto
cargo publish -p limbo_csv

View file

@ -338,7 +338,7 @@ def _test_series(limbo: TestLimboShell):
def test_kv():
_test_kv(exec_name=None, ext_path="target/debug/liblimbo_ext_tests")
_test_kv(exec_name=None, ext_path="target/debug/libturso_ext_tests")
_test_kv(exec_name="sqlite3", ext_path="target/debug/liblimbo_sqlite_test_ext")
@ -505,7 +505,7 @@ def test_ipaddr():
def test_vfs():
limbo = TestLimboShell()
ext_path = "target/debug/liblimbo_ext_tests"
ext_path = "target/debug/libturso_ext_tests"
limbo.run_test_fn(".vfslist", lambda x: "testvfs" not in x, "testvfs not loaded")
limbo.execute_dot(f".load {ext_path}")
limbo.run_test_fn(".vfslist", lambda res: "testvfs" in res, "testvfs extension loaded")
@ -530,7 +530,7 @@ def test_vfs():
def test_drop_virtual_table():
ext_path = "target/debug/liblimbo_ext_tests"
ext_path = "target/debug/libturso_ext_tests"
limbo = TestLimboShell()
limbo.execute_dot(f".load {ext_path}")
limbo.run_debug(
@ -585,7 +585,7 @@ def test_sqlite_vfs_compat():
def test_create_virtual_table():
ext_path = "target/debug/liblimbo_ext_tests"
ext_path = "target/debug/libturso_ext_tests"
limbo = TestLimboShell()
limbo.execute_dot(f".load {ext_path}")
@ -711,7 +711,7 @@ def cleanup():
def test_tablestats():
ext_path = "target/debug/liblimbo_ext_tests"
ext_path = "target/debug/libturso_ext_tests"
limbo = TestLimboShell(use_testing_db=True)
limbo.execute_dot("CREATE TABLE people(id INTEGER PRIMARY KEY, name TEXT);")
limbo.execute_dot("INSERT INTO people(name) VALUES ('Ada'), ('Grace'), ('Linus');")