diff --git a/lib/src/fnc/script/classes/duration.rs b/lib/src/fnc/script/classes/duration.rs index 29818871..bb383a3a 100644 --- a/lib/src/fnc/script/classes/duration.rs +++ b/lib/src/fnc/script/classes/duration.rs @@ -1,9 +1,13 @@ #[js::bind(object, public)] #[quickjs(bare)] #[allow(non_snake_case)] +#[allow(unused_variables)] #[allow(clippy::module_inception)] pub mod duration { + use crate::sql::value::Value; + use js::Rest; + #[derive(Clone)] #[quickjs(class)] pub struct Duration { @@ -26,5 +30,9 @@ pub mod duration { pub fn toString(&self) -> String { self.value.to_owned() } + /// Convert the object to JSON + pub fn toJSON(&self, args: Rest) -> String { + self.value.to_owned() + } } } diff --git a/lib/src/fnc/script/classes/record.rs b/lib/src/fnc/script/classes/record.rs index 7967d43e..76756011 100644 --- a/lib/src/fnc/script/classes/record.rs +++ b/lib/src/fnc/script/classes/record.rs @@ -1,9 +1,13 @@ #[js::bind(object, public)] #[quickjs(bare)] #[allow(non_snake_case)] +#[allow(unused_variables)] #[allow(clippy::module_inception)] pub mod record { + use crate::sql::value::Value; + use js::Rest; + #[derive(Clone)] #[quickjs(class)] pub struct Record { @@ -33,5 +37,9 @@ pub mod record { pub fn toString(&self) -> String { format!("{}:{}", self.tb, self.id) } + /// Convert the object to JSON + pub fn toJSON(&self, args: Rest) -> String { + format!("{}:{}", self.tb, self.id) + } } } diff --git a/lib/src/fnc/script/classes/uuid.rs b/lib/src/fnc/script/classes/uuid.rs index 0969f5c3..06c75c37 100644 --- a/lib/src/fnc/script/classes/uuid.rs +++ b/lib/src/fnc/script/classes/uuid.rs @@ -1,9 +1,13 @@ #[js::bind(object, public)] #[quickjs(bare)] #[allow(non_snake_case)] +#[allow(unused_variables)] #[allow(clippy::module_inception)] pub mod uuid { + use crate::sql::value::Value; + use js::Rest; + #[derive(Clone)] #[quickjs(class)] pub struct Uuid { @@ -26,5 +30,9 @@ pub mod uuid { pub fn toString(&self) -> String { self.value.to_owned() } + /// Convert the object to JSON + pub fn toJSON(&self, args: Rest) -> String { + self.value.to_owned() + } } }