pub struct SurrealClient { /* private fields */ }
Implementations§
Source§impl SurrealClient
impl SurrealClient
pub async fn new(url: &str) -> RpcResult<Self>
pub async fn signin<T: AsRef<str>>(&mut self, user: T, pass: T) -> RpcResult<()>
pub async fn use_namespace<T: AsRef<str>>( &mut self, namespace: T, database: T, ) -> RpcResult<()>
pub async fn send_message( &mut self, method: &'static str, params: Value, ) -> RpcResult<SurrealResponse>
Sourcepub async fn send_query(
&mut self,
query: String,
params: Value,
) -> RpcResult<SurrealResponse>
pub async fn send_query( &mut self, query: String, params: Value, ) -> RpcResult<SurrealResponse>
Send a query using the current socket connection then return the raw [SurrealResponse]
Sourcepub async fn find_one<T: DeserializeOwned>(
&mut self,
query: String,
params: Value,
) -> RpcResult<Option<T>>
pub async fn find_one<T: DeserializeOwned>( &mut self, query: String, params: Value, ) -> RpcResult<Option<T>>
Send a query using the current socket connection then return the first [T] from the received [SurrealResponse].
Sourcepub async fn find_one_key<T: DeserializeOwned>(
&mut self,
key: &str,
query: String,
params: Value,
) -> RpcResult<Option<T>>
pub async fn find_one_key<T: DeserializeOwned>( &mut self, key: &str, query: String, params: Value, ) -> RpcResult<Option<T>>
Fetch the value for the given key
out of the first row that is returned by
the supplied query
. If the key is missing then None is returned.
Sourcepub async fn find_many<T: DeserializeOwned>(
&mut self,
query: String,
params: Value,
) -> RpcResult<Vec<T>>
pub async fn find_many<T: DeserializeOwned>( &mut self, query: String, params: Value, ) -> RpcResult<Vec<T>>
Send a query using the current socket connection then return the many [<T>
]
from the received [SurrealResponse].
Sourcepub async fn find_many_key<T: DeserializeOwned>(
&mut self,
key: &str,
query: String,
params: Value,
) -> RpcResult<Vec<T>>
pub async fn find_many_key<T: DeserializeOwned>( &mut self, key: &str, query: String, params: Value, ) -> RpcResult<Vec<T>>
Get the value for every row that were returned by the supplied query
and
where key
exists. If the key
is missing from a row then the row will
be filtered out of the returned Vec.
Auto Trait Implementations§
impl Freeze for SurrealClient
impl !RefUnwindSafe for SurrealClient
impl Send for SurrealClient
impl Sync for SurrealClient
impl Unpin for SurrealClient
impl !UnwindSafe for SurrealClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more