Skip to main content

Scope

Trait Scope 

Source
pub trait Scope: Send + Sync {
    // Required methods
    fn table(&self, collection: &str) -> String;
    fn join_table(&self, table: &str) -> String;
    fn bind(
        &self,
        collection: &str,
        table: &str,
        alias: &str,
    ) -> Result<ScopeBinding>;

    // Provided method
    fn error(&self, message: String) -> Error { ... }
}
Expand description

How a builder’s from() reads a collection: the table it is stored under, and the hooks that map its attributes to columns and keep its statements to a tenant.

PHP: Utopia\Database\Builder\Scope.

Required Methods§

Source

fn table(&self, collection: &str) -> String

The name the collection’s table is stored under (table()).

Source

fn join_table(&self, table: &str) -> String

The name a builder that read a collection through this scope joins table under (joinTable()).

Source

fn bind( &self, collection: &str, table: &str, alias: &str, ) -> Result<ScopeBinding>

The hooks for statements over the collection, stored as table and named alias in them when one is given, and what the builder runs before each statement it builds, which reset() does not clear (bind()).

Provided Methods§

Source

fn error(&self, message: String) -> Error

The error a scoped builder refuses a call with (PHP throws Utopia\Database\Exception\Query); a plain query error by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§