Skip to main content

UserContext

Struct UserContext 

Source
pub struct UserContext { /* private fields */ }

Implementations§

Source§

impl UserContext

Source

pub fn new() -> Self

Source

pub fn with_module(self, module: RuntimeModule) -> Self

Source

pub fn entity_root(&self) -> EntityRoot

Source

pub fn initial_graphs(&self) -> &[GraphNode]

Source

pub fn set_initial_graphs(&mut self, graphs: Vec<GraphNode>)

Source

pub fn with_metadata(self, metadata: impl MetadataStore + 'static) -> Self

Source

pub fn set_metadata(&mut self, metadata: impl MetadataStore + 'static)

Source

pub fn with_repository_registry( self, registry: impl RepositoryRegistry + 'static, ) -> Self

Source

pub fn set_repository_registry( &mut self, registry: impl RepositoryRegistry + 'static, )

Source

pub fn with_repository_behavior_registry( self, registry: impl RepositoryBehaviorRegistry + 'static, ) -> Self

Source

pub fn set_repository_behavior_registry( &mut self, registry: impl RepositoryBehaviorRegistry + 'static, )

Source

pub fn with_request_policy(self, policy: impl RequestPolicy + 'static) -> Self

Source

pub fn set_request_policy(&mut self, policy: impl RequestPolicy + 'static)

Source

pub fn clear_request_policy(&mut self)

Source

pub fn with_checker_registry( self, registry: impl CheckerRegistry + 'static, ) -> Self

Source

pub fn set_checker_registry(&mut self, registry: impl CheckerRegistry + 'static)

Source

pub fn with_event_sink(self, sink: impl EntityEventSink + 'static) -> Self

Source

pub fn set_event_sink(&mut self, sink: impl EntityEventSink + 'static)

Source

pub fn with_internal_id_generator( self, generator: impl InternalIdGenerator + 'static, ) -> Self

Source

pub fn set_internal_id_generator( &mut self, generator: impl InternalIdGenerator + 'static, )

Source

pub fn with_schema_provider( self, provider: impl SchemaProvider + 'static, ) -> Self

Source

pub fn set_schema_provider(&mut self, provider: impl SchemaProvider + 'static)

Source

pub async fn ensure_schema(&self) -> Result<(), RuntimeError>

Source

pub fn with_language(self, language: Language) -> Self

Source

pub fn set_language(&mut self, language: Language)

Source

pub fn with_sql_log_options(self, options: SqlLogOptions) -> Self

Source

pub fn set_sql_log_options(&mut self, options: SqlLogOptions)

Source

pub fn enable_select_sql_log(&mut self)

Source

pub fn enable_mutation_sql_log(&mut self)

Source

pub fn enable_all_sql_log(&mut self)

Source

pub fn disable_sql_log(&mut self)

Source

pub fn sql_log_options(&self) -> SqlLogOptions

Source

pub fn sql_logs(&self) -> Vec<SqlLogEntry>

Source

pub fn clear_sql_logs(&self)

Source

pub fn language(&self) -> Language

Source

pub fn set_language_code(&mut self, code: &str) -> Result<(), RuntimeError>

Source

pub fn generate_id(&self, entity: &str) -> Result<Option<u64>, RuntimeError>

Source

pub fn next_id(&self, entity: &str) -> Result<u64, RuntimeError>

Source

pub fn entity(&self, name: &str) -> Option<&EntityDescriptor>

Source

pub fn all_entities(&self) -> Vec<&EntityDescriptor>

Source

pub fn require_entity( &self, name: &str, ) -> Result<&EntityDescriptor, RuntimeError>

Source

pub fn insert_resource<T>(&mut self, resource: T)
where T: Send + Sync + 'static,

Source

pub fn get_resource<T>(&self) -> Option<&T>
where T: Send + Sync + 'static,

Source

pub fn require_resource<T>(&self) -> Result<&T, ContextError>
where T: Send + Sync + 'static,

Source

pub fn insert_named_resource<T>(&mut self, name: impl Into<String>, resource: T)
where T: Send + Sync + 'static,

Source

pub fn get_named_resource<T>(&self, name: &str) -> Option<&T>
where T: Send + Sync + 'static,

Source

pub fn require_named_resource<T>(&self, name: &str) -> Result<&T, ContextError>
where T: Send + Sync + 'static,

Source

pub fn put_local(&mut self, key: impl Into<String>, value: impl Into<Value>)

Source

pub fn local(&self, key: &str) -> Option<&Value>

Source

pub fn remove_local(&mut self, key: &str) -> Option<Value>

Source

pub fn has_repository(&self, entity: &str) -> bool

Source

pub fn repository_behavior( &self, entity: &str, ) -> Option<Arc<dyn RepositoryBehavior>>

Source

pub fn has_checker(&self, entity: &str) -> bool

Source

pub fn check_and_fix_record( &self, entity: &str, record: &mut Record, ) -> Result<(), RuntimeError>

Source

pub fn check_and_fix_record_at( &self, entity: &str, record: &mut Record, location: &ObjectLocation, ) -> Result<(), RuntimeError>

Source

pub fn translate_check_results(&self, results: &mut CheckResults)

Source

pub fn send_event(&self, event: EntityEvent) -> Result<(), RuntimeError>

Source

pub fn commit_changes<D, E>(&self) -> Result<(), RepositoryError<E::Error>>
where D: SqlDialect + Send + Sync + 'static, E: QueryExecutor + Send + Sync + 'static,

Source§

impl UserContext

Source

pub fn repository<D, E>( &self, ) -> Result<ContextRepository<'_, D, E>, ContextError>
where D: SqlDialect + Send + Sync + 'static, E: QueryExecutor + Send + Sync + 'static,

Source

pub fn resolve_repository<D, E>( &self, entity: impl Into<String>, ) -> Result<ResolvedRepository<'_, D, E>, ContextError>
where D: SqlDialect + Send + Sync + 'static, E: QueryExecutor + Send + Sync + 'static,

Source

pub fn plan_for_save_graph<D, E>( &self, node: GraphNode, ) -> Result<GraphMutationPlan, RepositoryError<E::Error>>
where D: SqlDialect + Send + Sync + 'static, E: QueryExecutor + Send + Sync + 'static,

Trait Implementations§

Source§

impl Default for UserContext

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.