Allow any Value
in arguments to RPC use
method
This commit is contained in:
parent
06d2d88594
commit
a8df2b6a6f
1 changed files with 8 additions and 4 deletions
|
@ -235,7 +235,7 @@ impl Rpc {
|
|||
},
|
||||
// Switch to a specific namespace and database
|
||||
"use" => match params.needs_two() {
|
||||
Ok((Value::Strand(ns), Value::Strand(db))) => rpc.write().await.yuse(ns, db).await,
|
||||
Ok((ns, db)) => rpc.write().await.yuse(ns, db).await,
|
||||
_ => return res::failure(id, Failure::INVALID_PARAMS).send(out, chn).await,
|
||||
},
|
||||
// Signup to a specific authentication scope
|
||||
|
@ -367,9 +367,13 @@ impl Rpc {
|
|||
Ok(Value::None)
|
||||
}
|
||||
|
||||
async fn yuse(&mut self, ns: Strand, db: Strand) -> Result<Value, Error> {
|
||||
async fn yuse(&mut self, ns: Value, db: Value) -> Result<Value, Error> {
|
||||
if let Value::Strand(ns) = ns {
|
||||
self.session.ns = Some(ns.0);
|
||||
}
|
||||
if let Value::Strand(db) = db {
|
||||
self.session.db = Some(db.0);
|
||||
}
|
||||
Ok(Value::None)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue