Skip to content

Commit

Permalink
Hide surrealdb-core capabilities struct and implement builder. (#4173)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerard Guillemas Martos <gguillemas@users.noreply.github.com>
  • Loading branch information
DelSkayn and gguillemas committed Jun 17, 2024
1 parent 3321c64 commit 26de607
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/src/api/engine/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ pub fn connect(address: impl IntoEndpoint) -> Connect<Any, Surreal<Any>> {
#[cfg(all(test, feature = "kv-mem"))]
mod tests {
use super::*;
use crate::dbs::Capabilities;
use crate::opt::auth::Root;
use crate::opt::capabilities::Capabilities;
use crate::sql;
use crate::sql::Value;

Expand Down
19 changes: 19 additions & 0 deletions lib/src/api/err/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::sql::Value;
use serde::Serialize;
use std::io;
use std::path::PathBuf;
use surrealdb_core::dbs::capabilities::{ParseFuncTargetError, ParseNetTargetError};
use thiserror::Error;

/// An error originating from a remote SurrealDB database
Expand Down Expand Up @@ -206,6 +207,24 @@ pub enum Error {
/// Tried to insert on an edge or edges
#[error("Insert queries on edges not supported: {0}")]
InsertOnEdges(Edges),

#[error("{0}")]
InvalidNetTarget(#[from] ParseNetTargetError),

#[error("{0}")]
InvalidFuncTarget(#[from] ParseFuncTargetError),
}

impl From<ParseNetTargetError> for crate::Error {
fn from(e: ParseNetTargetError) -> Self {
Self::Api(Error::from(e))
}
}

impl From<ParseFuncTargetError> for crate::Error {
fn from(e: ParseFuncTargetError) -> Self {
Self::Api(Error::from(e))
}
}

#[cfg(feature = "protocol-http")]
Expand Down
Loading

0 comments on commit 26de607

Please sign in to comment.