Allow sending Table type for LIVE query RPC method

This commit is contained in:
Tobie Morgan Hitchcock 2023-02-14 11:01:31 +00:00
parent 0e8866b4e3
commit 454612487a
2 changed files with 5 additions and 0 deletions
lib/src/sql/value
src/net

View file

@ -666,6 +666,10 @@ impl Value {
matches!(self, Value::Range(_))
}
pub fn is_table(&self) -> bool {
matches!(self, Value::Table(_))
}
pub fn is_strand(&self) -> bool {
matches!(self, Value::Strand(_))
}

View file

@ -263,6 +263,7 @@ impl Rpc {
},
// Setup a live query on a specific table
"live" => match params.needs_one() {
Ok(v) if v.is_table() => rpc.read().await.live(v).await,
Ok(v) if v.is_strand() => rpc.read().await.live(v).await,
_ => return res::failure(id, Failure::INVALID_PARAMS).send(out, chn).await,
},