pub struct WasmDB { /* private fields */ }Implementations§
Source§impl WasmDB
impl WasmDB
Sourcepub fn new() -> Result<WasmDB, JsValue>
pub fn new() -> Result<WasmDB, JsValue>
Create a new in-memory ReifyDB engine
§Example
import init, { WasmDB } from './pkg/reifydb_engine_wasm.js';
await init();
const db = new WasmDB();Sourcepub fn query(&self, rql: &str) -> Result<JsValue, JsValue>
pub fn query(&self, rql: &str) -> Result<JsValue, JsValue>
Execute a query and return results as JavaScript objects
§Example
const results = await db.query(`
FROM [{ name: "Alice", age: 30 }]
FILTER age > 25
`);
console.log(results); // [{ name: "Alice", age: 30 }]Sourcepub fn admin(&self, rql: &str) -> Result<JsValue, JsValue>
pub fn admin(&self, rql: &str) -> Result<JsValue, JsValue>
Execute an admin operation (DDL + DML + Query) and return results
Admin operations include CREATE, ALTER, INSERT, UPDATE, DELETE, etc.
§Example
await db.admin("CREATE NAMESPACE demo");
await db.admin(`
CREATE TABLE demo.users {
id: int4,
name: utf8
}
`);Sourcepub fn command(&self, rql: &str) -> Result<JsValue, JsValue>
pub fn command(&self, rql: &str) -> Result<JsValue, JsValue>
Execute a command (DML) and return results
Commands include INSERT, UPDATE, DELETE, etc.
For DDL operations (CREATE, ALTER), use admin() instead.
Sourcepub fn query_with_params(
&self,
rql: &str,
params_js: JsValue,
) -> Result<JsValue, JsValue>
pub fn query_with_params( &self, rql: &str, params_js: JsValue, ) -> Result<JsValue, JsValue>
Execute query with JSON parameters
§Example
const results = await db.queryWithParams(
"FROM users FILTER age > $min_age",
{ min_age: 25 }
);Sourcepub fn admin_with_params(
&self,
rql: &str,
params_js: JsValue,
) -> Result<JsValue, JsValue>
pub fn admin_with_params( &self, rql: &str, params_js: JsValue, ) -> Result<JsValue, JsValue>
Execute admin with JSON parameters
Sourcepub fn command_with_params(
&self,
rql: &str,
params_js: JsValue,
) -> Result<JsValue, JsValue>
pub fn command_with_params( &self, rql: &str, params_js: JsValue, ) -> Result<JsValue, JsValue>
Execute command with JSON parameters
Sourcepub fn command_text(&self, rql: &str) -> Result<String, JsValue>
pub fn command_text(&self, rql: &str) -> Result<String, JsValue>
Execute a command and return Display-formatted text output
Sourcepub fn admin_text(&self, rql: &str) -> Result<String, JsValue>
pub fn admin_text(&self, rql: &str) -> Result<String, JsValue>
Execute an admin operation and return Display-formatted text output
Sourcepub fn query_text(&self, rql: &str) -> Result<String, JsValue>
pub fn query_text(&self, rql: &str) -> Result<String, JsValue>
Execute a query and return Display-formatted text output
Sourcepub fn login_with_password(
&self,
identifier: &str,
password: &str,
) -> Result<LoginResult, JsValue>
pub fn login_with_password( &self, identifier: &str, password: &str, ) -> Result<LoginResult, JsValue>
Authenticate with a password and return a session token.
Sourcepub fn login_with_token(&self, token: &str) -> Result<LoginResult, JsValue>
pub fn login_with_token(&self, token: &str) -> Result<LoginResult, JsValue>
Authenticate with a token credential and return a session token.
Trait Implementations§
Source§impl FromWasmAbi for WasmDB
impl FromWasmAbi for WasmDB
Source§impl IntoWasmAbi for WasmDB
impl IntoWasmAbi for WasmDB
Source§impl LongRefFromWasmAbi for WasmDB
impl LongRefFromWasmAbi for WasmDB
Source§impl OptionFromWasmAbi for WasmDB
impl OptionFromWasmAbi for WasmDB
Source§impl OptionIntoWasmAbi for WasmDB
impl OptionIntoWasmAbi for WasmDB
Source§impl RefFromWasmAbi for WasmDB
impl RefFromWasmAbi for WasmDB
Source§impl RefMutFromWasmAbi for WasmDB
impl RefMutFromWasmAbi for WasmDB
Source§impl TryFromJsValue for WasmDB
impl TryFromJsValue for WasmDB
Source§impl VectorFromWasmAbi for WasmDB
impl VectorFromWasmAbi for WasmDB
Source§impl VectorIntoWasmAbi for WasmDB
impl VectorIntoWasmAbi for WasmDB
impl SupportsConstructor for WasmDB
impl SupportsInstanceProperty for WasmDB
impl SupportsStaticProperty for WasmDB
Auto Trait Implementations§
impl !Freeze for WasmDB
impl !RefUnwindSafe for WasmDB
impl Send for WasmDB
impl !Sync for WasmDB
impl Unpin for WasmDB
impl UnsafeUnpin for WasmDB
impl !UnwindSafe for WasmDB
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.