lib.userData: add delete
This commit is contained in:
parent
133e71961f
commit
6e536d850c
1 changed files with 19 additions and 0 deletions
|
@ -39,7 +39,26 @@ function getUserData(id, key, fallback = null) {
|
|||
});
|
||||
}
|
||||
|
||||
function deleteUserData(id, key) {
|
||||
return new Promise((resolve, reject) => {
|
||||
hf.database.run(
|
||||
"DELETE FROM user_data WHERE key = $key",
|
||||
{
|
||||
$key: `${id}[${key}]`,
|
||||
},
|
||||
(err) => {
|
||||
if (err == null) {
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setUserData,
|
||||
getUserData,
|
||||
deleteUserData,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue