mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -05:00
init
This commit is contained in:
parent
9fe52b1e8d
commit
0ab878cda8
5 changed files with 92 additions and 1 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -9145,3 +9145,7 @@ dependencies = [
|
|||
"cc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[patch.unused]]
|
||||
name = "deno_core"
|
||||
version = "0.325.0"
|
||||
|
|
|
@ -339,3 +339,6 @@ opt-level = 3
|
|||
opt-level = 3
|
||||
[profile.release.package.zstd-sys]
|
||||
opt-level = 3
|
||||
|
||||
[patch.crates-io]
|
||||
deno_core = { path = "../deno_core/core" }
|
||||
|
|
|
@ -431,7 +431,9 @@ deno_core::extension!(deno_node,
|
|||
ops::inspector::op_inspector_enabled,
|
||||
],
|
||||
objects = [
|
||||
ops::perf_hooks::EldHistogram
|
||||
ops::perf_hooks::EldHistogram,
|
||||
ops::sqlite::DatabaseSync,
|
||||
ops::sqlite::StatementSync
|
||||
],
|
||||
esm_entry_point = "ext:deno_node/02_init.js",
|
||||
esm = [
|
||||
|
|
|
@ -13,6 +13,7 @@ pub mod os;
|
|||
pub mod perf_hooks;
|
||||
pub mod process;
|
||||
pub mod require;
|
||||
pub mod sqlite;
|
||||
pub mod tls;
|
||||
pub mod util;
|
||||
pub mod v8;
|
||||
|
|
81
ext/node/ops/sqlite.rs
Normal file
81
ext/node/ops/sqlite.rs
Normal file
|
@ -0,0 +1,81 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op2;
|
||||
use deno_core::v8;
|
||||
use deno_core::GarbageCollected;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct DatabaseSyncOptions {
|
||||
open: bool,
|
||||
enable_foreign_key_constraints: bool,
|
||||
}
|
||||
|
||||
pub struct DatabaseSync {}
|
||||
|
||||
impl GarbageCollected for DatabaseSync {}
|
||||
|
||||
#[op2]
|
||||
impl DatabaseSync {
|
||||
#[constructor]
|
||||
#[cppgc]
|
||||
fn new(
|
||||
#[string] location: &str,
|
||||
#[serde] options: DatabaseSyncOptions,
|
||||
) -> DatabaseSync {
|
||||
DatabaseSync {}
|
||||
}
|
||||
|
||||
#[fast]
|
||||
fn open(&self) {}
|
||||
|
||||
#[fast]
|
||||
fn close(&self) {}
|
||||
|
||||
#[cppgc]
|
||||
fn prepare(&self, #[string] sql: &str) -> StatementSync {
|
||||
StatementSync {}
|
||||
}
|
||||
|
||||
// fn exec() <-- varargs
|
||||
}
|
||||
|
||||
pub struct StatementSync {}
|
||||
|
||||
impl GarbageCollected for StatementSync {}
|
||||
|
||||
#[op2]
|
||||
impl StatementSync {
|
||||
#[constructor]
|
||||
#[cppgc]
|
||||
fn new(_: bool) -> StatementSync {
|
||||
StatementSync {}
|
||||
}
|
||||
|
||||
// fn get() <-- varargs
|
||||
|
||||
#[fast]
|
||||
fn run(&self) {}
|
||||
|
||||
#[fast]
|
||||
fn all(&self) {}
|
||||
|
||||
#[fast]
|
||||
fn set_allowed_bare_named_parameters(&self, enabled: bool) {}
|
||||
|
||||
#[fast]
|
||||
fn set_read_bigints(&self, enabled: bool) {}
|
||||
|
||||
#[fast]
|
||||
fn source_sql(&self) {}
|
||||
|
||||
#[string]
|
||||
fn expanded_sqlite(&self) -> String {
|
||||
todo!()
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue