Add sqlite stub library
This commit is contained in:
parent
3de17cb77e
commit
fc4d27abf1
66
Cargo.lock
generated
66
Cargo.lock
generated
@ -579,6 +579,18 @@ dependencies = [
|
|||||||
"windows-sys 0.60.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fallible-iterator"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fallible-streaming-iterator"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.3.0"
|
version = "2.3.0"
|
||||||
@ -601,6 +613,12 @@ version = "1.0.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foldhash"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "form_urlencoded"
|
name = "form_urlencoded"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@ -740,6 +758,18 @@ name = "hashbrown"
|
|||||||
version = "0.15.4"
|
version = "0.15.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
|
dependencies = [
|
||||||
|
"foldhash",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashlink"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
|
||||||
|
dependencies = [
|
||||||
|
"hashbrown 0.15.4",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hdrhistogram"
|
name = "hdrhistogram"
|
||||||
@ -1062,6 +1092,15 @@ dependencies = [
|
|||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lb_sqlite"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"lb",
|
||||||
|
"luaffi",
|
||||||
|
"rusqlite",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.174"
|
version = "0.2.174"
|
||||||
@ -1100,6 +1139,18 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libsqlite3-sys"
|
||||||
|
version = "0.34.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91632f3b4fb6bd1d72aa3d78f41ffecfcf2b1a6648d8c241dbe7dbfaf4875e15"
|
||||||
|
dependencies = [
|
||||||
|
"bindgen",
|
||||||
|
"cc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.22"
|
version = "1.1.22"
|
||||||
@ -1187,6 +1238,7 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"console-subscriber",
|
"console-subscriber",
|
||||||
"lb",
|
"lb",
|
||||||
|
"lb_sqlite",
|
||||||
"luajit",
|
"luajit",
|
||||||
"mimalloc",
|
"mimalloc",
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
@ -1554,6 +1606,20 @@ version = "0.8.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rusqlite"
|
||||||
|
version = "0.36.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3de23c3319433716cf134eed225fe9986bc24f63bed9be9f20c329029e672dc7"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"fallible-iterator",
|
||||||
|
"fallible-streaming-iterator",
|
||||||
|
"hashlink",
|
||||||
|
"libsqlite3-sys",
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.25"
|
version = "0.1.25"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = [
|
members = [
|
||||||
"crates/lb",
|
"crates/lb",
|
||||||
|
"crates/lb_sqlite",
|
||||||
"crates/luaffi",
|
"crates/luaffi",
|
||||||
"crates/luaffi_impl",
|
"crates/luaffi_impl",
|
||||||
"crates/luaify",
|
"crates/luaify",
|
||||||
@ -35,17 +36,19 @@ name = "main"
|
|||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["task", "time", "fs", "net"]
|
default = ["task", "time", "fs", "net", "sqlite"]
|
||||||
task = ["lb/task"]
|
task = ["lb/task"]
|
||||||
time = ["lb/time"]
|
time = ["lb/time"]
|
||||||
fs = ["lb/fs"]
|
fs = ["lb/fs"]
|
||||||
net = ["lb/net"]
|
net = ["lb/net"]
|
||||||
|
sqlite = ["dep:lb_sqlite"]
|
||||||
tokio-console = ["dep:console-subscriber"]
|
tokio-console = ["dep:console-subscriber"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.40", features = ["derive", "env"] }
|
clap = { version = "4.5.40", features = ["derive", "env"] }
|
||||||
console-subscriber = { version = "0.4.1", optional = true }
|
console-subscriber = { version = "0.4.1", optional = true }
|
||||||
lb = { path = "crates/lb", features = ["runtime"] }
|
lb = { path = "crates/lb", features = ["runtime"] }
|
||||||
|
lb_sqlite = { path = "crates/lb_sqlite", optional = true }
|
||||||
luajit = { path = "crates/luajit", features = ["runtime"] }
|
luajit = { path = "crates/luajit", features = ["runtime"] }
|
||||||
mimalloc = "0.1.47"
|
mimalloc = "0.1.47"
|
||||||
owo-colors = "4.2.1"
|
owo-colors = "4.2.1"
|
||||||
|
13
crates/lb_sqlite/Cargo.toml
Normal file
13
crates/lb_sqlite/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "lb_sqlite"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lb = { path = "../lb", features = ["time"] }
|
||||||
|
luaffi = { version = "0.0.1", path = "../luaffi" }
|
||||||
|
rusqlite = { version = "0.36.0", features = ["bundled", "load_extension", "backup", "blob", "limits", "window", "series", "session", "collation", "serialize"] }
|
3
crates/lb_sqlite/src/lib.rs
Normal file
3
crates/lb_sqlite/src/lib.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
//! luby SQLite library.
|
||||||
|
#[path = "mod.rs"]
|
||||||
|
pub mod sqlite;
|
27
crates/lb_sqlite/src/mod.rs
Normal file
27
crates/lb_sqlite/src/mod.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//! SQLite library.
|
||||||
|
//!
|
||||||
|
//! The `lb:sqlite` library provides an interface to SQLite databases.
|
||||||
|
//!
|
||||||
|
//! ## Exports
|
||||||
|
//!
|
||||||
|
//! See [`lb_sqlitelib`] for items exported by this library.
|
||||||
|
use luaffi::{cdef, metatype};
|
||||||
|
|
||||||
|
/// Items exported by the `lb:sqlite` library.
|
||||||
|
///
|
||||||
|
/// This library can be acquired by calling
|
||||||
|
/// [`require("lb:sqlite")`](https://www.lua.org/manual/5.1/manual.html#pdf-require).
|
||||||
|
///
|
||||||
|
/// ```lua
|
||||||
|
/// local sqlite = require("lb:sqlite");
|
||||||
|
/// ```
|
||||||
|
#[cdef(module = "lb:time")]
|
||||||
|
pub struct lb_sqlitelib;
|
||||||
|
|
||||||
|
#[metatype]
|
||||||
|
impl lb_sqlitelib {
|
||||||
|
#[new]
|
||||||
|
extern "Lua-C" fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,9 @@ pub use lb::task;
|
|||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
pub use lb::time;
|
pub use lb::time;
|
||||||
|
|
||||||
|
#[cfg(feature = "sqlite")]
|
||||||
|
pub use lb_sqlite::sqlite;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn open(#[allow(unused)] rt: &mut lb::runtime::Builder) {
|
pub fn open(#[allow(unused)] rt: &mut lb::runtime::Builder) {
|
||||||
#[cfg(feature = "task")]
|
#[cfg(feature = "task")]
|
||||||
@ -18,4 +21,7 @@ pub fn open(#[allow(unused)] rt: &mut lb::runtime::Builder) {
|
|||||||
rt.module::<fs::lb_fslib>();
|
rt.module::<fs::lb_fslib>();
|
||||||
#[cfg(feature = "net")]
|
#[cfg(feature = "net")]
|
||||||
rt.module::<net::lb_netlib>();
|
rt.module::<net::lb_netlib>();
|
||||||
|
|
||||||
|
#[cfg(feature = "sqlite")]
|
||||||
|
rt.module::<sqlite::lb_sqlitelib>();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user