From 4fffc0af19862455c30078c8f0193ce78098b5c5 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Mon, 4 Apr 2022 15:07:26 +0530 Subject: [PATCH] chore(ext/webstorage): custom arity (#14201) --- ext/webstorage/01_webstorage.js | 5 +---- ext/webstorage/lib.rs | 13 +++---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 831f63f591..6640c04e56 100644 --- a/ext/webstorage/01_webstorage.js +++ b/ext/webstorage/01_webstorage.js @@ -55,10 +55,7 @@ context: "Argument 2", }); - core.opSync("op_webstorage_set", { - keyName: key, - keyValue: value, - }, this[_persistent]); + core.opSync("op_webstorage_set", key, value, this[_persistent]); } getItem(key) { diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index 7cda0176a5..47d720ffb1 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -10,7 +10,6 @@ use deno_core::OpState; use rusqlite::params; use rusqlite::Connection; use rusqlite::OptionalExtension; -use serde::Deserialize; use std::fmt; use std::path::PathBuf; @@ -135,17 +134,11 @@ pub fn op_webstorage_key( Ok(key) } -#[derive(Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SetArgs { - key_name: String, - key_value: String, -} - #[op] pub fn op_webstorage_set( state: &mut OpState, - args: SetArgs, + key: String, + value: String, persistent: bool, ) -> Result<(), AnyError> { let conn = get_webstorage(state, persistent)?; @@ -165,7 +158,7 @@ pub fn op_webstorage_set( let mut stmt = conn .prepare_cached("INSERT OR REPLACE INTO data (key, value) VALUES (?, ?)")?; - stmt.execute(params![args.key_name, args.key_value])?; + stmt.execute(params![key, value])?; Ok(()) }