Allow datetimes as an id
parameter in the WebSocket RPC message
This commit is contained in:
parent
2e1d39fcf8
commit
3cbb5eed78
2 changed files with 11 additions and 4 deletions
|
@ -589,6 +589,10 @@ impl Value {
|
|||
matches!(self, Value::Number(v) if v.is_positive())
|
||||
}
|
||||
|
||||
pub fn is_datetime(&self) -> bool {
|
||||
matches!(self, Value::Datetime(_))
|
||||
}
|
||||
|
||||
pub fn is_type_record(&self, types: &[Table]) -> bool {
|
||||
match self {
|
||||
Value::Thing(v) => types.iter().any(|tb| tb.0 == v.tb),
|
||||
|
|
|
@ -146,10 +146,13 @@ impl Rpc {
|
|||
};
|
||||
// Fetch the 'id' argument
|
||||
let id = match req.pick(&*ID) {
|
||||
v if v.is_uuid() || v.is_strand() || v.is_number() || v.is_none() || v.is_null() => {
|
||||
Some(v)
|
||||
}
|
||||
_ => return res::failure(None, Failure::INVALID_REQUEST).send(chn).await,
|
||||
v if v.is_none() => None,
|
||||
v if v.is_null() => Some(v),
|
||||
v if v.is_uuid() => Some(v),
|
||||
v if v.is_number() => Some(v),
|
||||
v if v.is_strand() => Some(v),
|
||||
v if v.is_datetime() => Some(v),
|
||||
_ => return res::failure(None, Failure::INVALID_REQUEST).send(out, chn).await,
|
||||
};
|
||||
// Fetch the 'method' argument
|
||||
let method = match req.pick(&*METHOD) {
|
||||
|
|
Loading…
Reference in a new issue