Struct Options

Source
pub struct Options { /* private fields */ }
Expand description

An Options is passed around when processing a set of query statements.

An Options contains specific information for how to process each particular statement, including the record version to retrieve, whether futures should be processed, and whether field/event/table queries should be processed (useful when importing data, where these queries might fail).

Implementations§

Source§

impl Options

Source

pub fn new() -> Options

Create a new Options object

Source

pub fn set_ns(&mut self, ns: Option<Arc<str>>)

Specify which Namespace should be used for code which uses this Options object.

Source

pub fn set_db(&mut self, db: Option<Arc<str>>)

Specify which Database should be used for code which uses this Options object.

Source

pub fn with_max_computation_depth(self, depth: u32) -> Self

Set the maximum depth a computation can reach.

Source

pub fn with_id(self, id: Uuid) -> Self

Set the Node ID for subsequent code which uses this Options, with support for chaining.

Source

pub fn with_ns(self, ns: Option<Arc<str>>) -> Self

Specify which Namespace should be used for code which uses this Options, with support for chaining.

Source

pub fn with_db(self, db: Option<Arc<str>>) -> Self

Specify which Database should be used for code which uses this Options, with support for chaining.

Source

pub fn with_auth(self, auth: Arc<Auth>) -> Self

Specify the authentication options for subsequent code which uses this Options, with chaining.

Source

pub fn with_live(self, live: bool) -> Self

Specify whether live queries are supported for code which uses this Options, with chaining.

Source

pub fn with_perms(self, perms: bool) -> Self

Specify whether permissions should be run for code which uses this Options, with chaining.

Source

pub fn with_force(self, force: Force) -> Self

Specify wether tables/events should re-run

Source

pub fn with_strict(self, strict: bool) -> Self

Sepecify if we should error when a table does not exist

Source

pub fn with_import(self, import: bool) -> Self

Specify if we are currently importing data

Source

pub fn set_import(&mut self, import: bool)

Specify if we are currently importing data

Source

pub fn with_futures(self, futures: bool) -> Self

Specify if we should process futures

Source

pub fn set_futures(&mut self, futures: bool)

Source

pub fn with_futures_never(self) -> Self

Specify if we should never process futures

Source

pub fn set_futures_never(&mut self)

Specify if we should never process futures

Source

pub fn with_auth_enabled(self, auth_enabled: bool) -> Self

Create a new Options object with auth enabled

Source

pub fn with_version(self, version: Option<u64>) -> Self

Source

pub fn new_with_perms(&self, perms: bool) -> Self

Create a new Options object for a subquery

Source

pub fn new_with_force(&self, force: Force) -> Self

Create a new Options object for a subquery

Source

pub fn new_with_strict(&self, strict: bool) -> Self

Create a new Options object for a subquery

Source

pub fn new_with_import(&self, import: bool) -> Self

Create a new Options object for a subquery

Source

pub fn new_with_futures(&self, futures: bool) -> Self

Create a new Options object for a subquery

Source

pub fn new_with_sender(&self, sender: Sender<Notification>) -> Self

Create a new Options object for a subquery

Source

pub fn selected_base(&self) -> Result<Base, Error>

Source

pub fn dive(&self, cost: u8) -> Result<Self, Error>

Create a new Options object for a function/subquery/future/etc.

The parameter is the approximate cost of the operation (more concretely, the size of the stack frame it uses relative to a simple function call). When in doubt, use a value of 1.

Source

pub fn id(&self) -> Result<Uuid, Error>

Get current Node ID

Source

pub fn ns(&self) -> Result<&str, Error>

Get currently selected NS

Source

pub fn db(&self) -> Result<&str, Error>

Get currently selected DB

Source

pub fn realtime(&self) -> Result<(), Error>

Check whether this request supports realtime queries

Source

pub fn valid_for_ns(&self) -> Result<(), Error>

Source

pub fn valid_for_db(&self) -> Result<(), Error>

Source

pub fn is_allowed( &self, action: Action, res: ResourceKind, base: &Base, ) -> Result<(), Error>

Check if the current auth is allowed to perform an action on a given resource

Source

pub fn check_perms(&self, action: Action) -> Result<bool, Error>

Checks the current server configuration, and user authentication information to determine whether we need to process table permissions on each document.

This method is repeatedly called during the document processing operations, and so the performance of this function is important. We decided to bypass the system cedar auth system as a temporary solution until the new authorization system is optimised.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> ParallelSend for T
where T: Send,