Change notification type from sql::Uuid to uuid::Uuid (#2079)
This commit is contained in:
parent
721d3c5444
commit
8c6c5a5e37
3 changed files with 22 additions and 20 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4301,6 +4301,7 @@ dependencies = [
|
|||
"tracing-opentelemetry",
|
||||
"tracing-subscriber",
|
||||
"urlencoding",
|
||||
"uuid",
|
||||
"warp",
|
||||
]
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ surrealdb = { path = "lib", features = ["protocol-http", "protocol-ws", "rustls"
|
|||
thiserror = "1.0.40"
|
||||
tokio = { version = "1.28.1", features = ["macros", "signal"] }
|
||||
tokio-util = { version = "0.7.8", features = ["io"] }
|
||||
uuid = { version = "1.3.1", features = ["serde", "js", "v4", "v7"] }
|
||||
tracing = "0.1"
|
||||
tracing-futures = "0.2.5"
|
||||
tracing-opentelemetry = "0.18.0"
|
||||
|
|
|
@ -20,14 +20,14 @@ use std::collections::HashMap;
|
|||
use std::sync::Arc;
|
||||
use surrealdb::channel;
|
||||
use surrealdb::channel::Sender;
|
||||
use surrealdb::dbs::Session;
|
||||
use surrealdb::dbs::{Response, Session};
|
||||
use surrealdb::sql::Array;
|
||||
use surrealdb::sql::Object;
|
||||
use surrealdb::sql::Strand;
|
||||
use surrealdb::sql::Uuid;
|
||||
use surrealdb::sql::Value;
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::instrument;
|
||||
use uuid::Uuid;
|
||||
use warp::ws::{Message, WebSocket, Ws};
|
||||
use warp::Filter;
|
||||
|
||||
|
@ -368,7 +368,7 @@ impl Rpc {
|
|||
Ok(Value::None)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc use", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc use", fields(websocket=self.uuid.to_string()))]
|
||||
async fn yuse(&mut self, ns: Value, db: Value) -> Result<Value, Error> {
|
||||
if let Value::Strand(ns) = ns {
|
||||
self.session.ns = Some(ns.0);
|
||||
|
@ -379,7 +379,7 @@ impl Rpc {
|
|||
Ok(Value::None)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc signup", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc signup", fields(websocket=self.uuid.to_string()))]
|
||||
async fn signup(&mut self, vars: Object) -> Result<Value, Error> {
|
||||
crate::iam::signup::signup(&mut self.session, vars)
|
||||
.await
|
||||
|
@ -387,20 +387,20 @@ impl Rpc {
|
|||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc signin", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc signin", fields(websocket=self.uuid.to_string()))]
|
||||
async fn signin(&mut self, vars: Object) -> Result<Value, Error> {
|
||||
crate::iam::signin::signin(&mut self.session, vars)
|
||||
.await
|
||||
.map(Into::into)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
#[instrument(skip_all, name = "rpc invalidate", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc invalidate", fields(websocket=self.uuid.to_string()))]
|
||||
async fn invalidate(&mut self) -> Result<Value, Error> {
|
||||
crate::iam::clear::clear(&mut self.session).await?;
|
||||
Ok(Value::None)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc auth", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc auth", fields(websocket=self.uuid.to_string()))]
|
||||
async fn authenticate(&mut self, token: Strand) -> Result<Value, Error> {
|
||||
crate::iam::verify::token(&mut self.session, token.0).await?;
|
||||
Ok(Value::None)
|
||||
|
@ -410,7 +410,7 @@ impl Rpc {
|
|||
// Methods for identification
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc info", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc info", fields(websocket=self.uuid.to_string()))]
|
||||
async fn info(&self) -> Result<Value, Error> {
|
||||
// Get a database reference
|
||||
let kvs = DB.get().unwrap();
|
||||
|
@ -430,7 +430,7 @@ impl Rpc {
|
|||
// Methods for setting variables
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc set", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc set", fields(websocket=self.uuid.to_string()))]
|
||||
async fn set(&mut self, key: Strand, val: Value) -> Result<Value, Error> {
|
||||
match val {
|
||||
// Remove the variable if undefined
|
||||
|
@ -441,7 +441,7 @@ impl Rpc {
|
|||
Ok(Value::Null)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc unset", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc unset", fields(websocket=self.uuid.to_string()))]
|
||||
async fn unset(&mut self, key: Strand) -> Result<Value, Error> {
|
||||
self.vars.remove(&key.0);
|
||||
Ok(Value::Null)
|
||||
|
@ -451,7 +451,7 @@ impl Rpc {
|
|||
// Methods for live queries
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc kill", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc kill", fields(websocket=self.uuid.to_string()))]
|
||||
async fn kill(&self, id: Value) -> Result<Value, Error> {
|
||||
// Get a database reference
|
||||
let kvs = DB.get().unwrap();
|
||||
|
@ -472,7 +472,7 @@ impl Rpc {
|
|||
Ok(res)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc live", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc live", fields(websocket=self.uuid.to_string()))]
|
||||
async fn live(&self, tb: Value) -> Result<Value, Error> {
|
||||
// Get a database reference
|
||||
let kvs = DB.get().unwrap();
|
||||
|
@ -497,7 +497,7 @@ impl Rpc {
|
|||
// Methods for selecting
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc select", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc select", fields(websocket=self.uuid.to_string()))]
|
||||
async fn select(&self, what: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -527,7 +527,7 @@ impl Rpc {
|
|||
// Methods for creating
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc create", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc create", fields(websocket=self.uuid.to_string()))]
|
||||
async fn create(&self, what: Value, data: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -558,7 +558,7 @@ impl Rpc {
|
|||
// Methods for updating
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc update", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc update", fields(websocket=self.uuid.to_string()))]
|
||||
async fn update(&self, what: Value, data: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -589,7 +589,7 @@ impl Rpc {
|
|||
// Methods for changing
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc change", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc change", fields(websocket=self.uuid.to_string()))]
|
||||
async fn change(&self, what: Value, data: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -620,7 +620,7 @@ impl Rpc {
|
|||
// Methods for modifying
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc modify", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc modify", fields(websocket=self.uuid.to_string()))]
|
||||
async fn modify(&self, what: Value, data: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -651,7 +651,7 @@ impl Rpc {
|
|||
// Methods for deleting
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc delete", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc delete", fields(websocket=self.uuid.to_string()))]
|
||||
async fn delete(&self, what: Value) -> Result<Value, Error> {
|
||||
// Return a single result?
|
||||
let one = what.is_thing();
|
||||
|
@ -681,7 +681,7 @@ impl Rpc {
|
|||
// Methods for querying
|
||||
// ------------------------------
|
||||
|
||||
#[instrument(skip_all, name = "rpc query", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc query", fields(websocket=self.uuid.to_string()))]
|
||||
async fn query(&self, sql: Strand) -> Result<impl Serialize, Error> {
|
||||
// Get a database reference
|
||||
let kvs = DB.get().unwrap();
|
||||
|
@ -695,7 +695,7 @@ impl Rpc {
|
|||
Ok(res)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, name = "rpc query_with", fields(websocket=self.uuid.to_raw()))]
|
||||
#[instrument(skip_all, name = "rpc query_with", fields(websocket=self.uuid.to_string()))]
|
||||
async fn query_with(&self, sql: Strand, mut vars: Object) -> Result<impl Serialize, Error> {
|
||||
// Get a database reference
|
||||
let kvs = DB.get().unwrap();
|
||||
|
|
Loading…
Reference in a new issue