pub struct Table<T: SurrealRecord> { /* private fields */ }Expand description
Entry point to the query builder for a record type T — the value returned by
the derived T::table(). Each method starts a statement builder.
Implementations§
Source§impl<T: SurrealRecord> Table<T>
impl<T: SurrealRecord> Table<T>
Sourcepub fn select(self, _cols: ColumnSet<T>) -> Select<T>
pub fn select(self, _cols: ColumnSet<T>) -> Select<T>
Begin a SELECT * FROM <table> (pass the derived T::all()).
Sourcepub fn project(self, fields: Vec<Projection>) -> Select<T>
pub fn project(self, fields: Vec<Projection>) -> Select<T>
Select an explicit projection list (SELECT <fields…> FROM table).
Sourcepub fn project_path(self, path: Path, alias: &'static str) -> Select<T>
pub fn project_path(self, path: Path, alias: &'static str) -> Select<T>
SELECT <path> AS <alias> FROM table — project a graph traversal.
A convenience for project(vec![Projection::aliased(path, alias)]).
Sourcepub fn upsert(self) -> Update<T>
pub fn upsert(self) -> Update<T>
UPSERT — update the matching record, or create it if it doesn’t exist.
Same builder surface as update (record/set/merge/
content/filter/returning/then_select).
Sourcepub fn search(
self,
field: impl Into<String>,
query: impl Into<String>,
) -> Search<T>
pub fn search( self, field: impl Into<String>, query: impl Into<String>, ) -> Search<T>
Begin a full-text Search over field for query
(SELECT … FROM <table> WHERE field @@ 'query'). Pair with a SEARCH
index on the field (see DefineIndex::search).
Sourcepub fn nearest(
self,
field: impl Into<String>,
vector: Vec<f32>,
) -> VectorSearch<T>
pub fn nearest( self, field: impl Into<String>, vector: Vec<f32>, ) -> VectorSearch<T>
Begin a vector K-nearest-neighbour VectorSearch over field for the
query vector (SELECT … FROM <table> WHERE field <|k|> [vector]). Pair
with an HNSW/MTREE index on the field (see DefineIndex::hnsw).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Table<T>
impl<T> RefUnwindSafe for Table<T>where
T: RefUnwindSafe,
impl<T> Send for Table<T>
impl<T> Sync for Table<T>
impl<T> Unpin for Table<T>where
T: Unpin,
impl<T> UnsafeUnpin for Table<T>
impl<T> UnwindSafe for Table<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more