pub struct QuerySync<B: DatabaseBackend> { /* private fields */ }Expand description
QuerySync manages synchronization between ECS world and SQL database
Implementations§
Source§impl<B: DatabaseBackend> QuerySync<B>
impl<B: DatabaseBackend> QuerySync<B>
Sourcepub fn new(backend: B, schema_generator: SchemaGenerator) -> Self
pub fn new(backend: B, schema_generator: SchemaGenerator) -> Self
Create a new QuerySync instance
Sourcepub fn with_config(
backend: B,
schema_generator: SchemaGenerator,
config: SyncConfig,
) -> Self
pub fn with_config( backend: B, schema_generator: SchemaGenerator, config: SyncConfig, ) -> Self
Create a new QuerySync instance with custom config
Sourcepub async fn initialize_schema(&self) -> Result<()>
pub async fn initialize_schema(&self) -> Result<()>
Initialize database schema
Sourcepub async fn track_entity_created(&self, entity_id: u64) -> Result<()>
pub async fn track_entity_created(&self, entity_id: u64) -> Result<()>
Track entity creation
Sourcepub async fn track_component_change(
&self,
entity_id: u64,
component_type: TypeId,
component_name: String,
data: HashMap<String, Value>,
) -> Result<()>
pub async fn track_component_change( &self, entity_id: u64, component_type: TypeId, component_name: String, data: HashMap<String, Value>, ) -> Result<()>
Track component change
Sourcepub async fn track_entity_deleted(&self, entity_id: u64) -> Result<()>
pub async fn track_entity_deleted(&self, entity_id: u64) -> Result<()>
Track entity deletion
Sourcepub async fn query(&self, sql: &str) -> Result<QueryResult>
pub async fn query(&self, sql: &str) -> Result<QueryResult>
Query the database
Sourcepub fn config(&self) -> &SyncConfig
pub fn config(&self) -> &SyncConfig
Get the current sync configuration
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if backend is connected
Sourcepub async fn synced_entity_count(&self) -> usize
pub async fn synced_entity_count(&self) -> usize
Get the number of synced entities
Sourcepub async fn pending_change_count(&self) -> usize
pub async fn pending_change_count(&self) -> usize
Get the number of pending changes
Auto Trait Implementations§
impl<B> Freeze for QuerySync<B>
impl<B> !RefUnwindSafe for QuerySync<B>
impl<B> Send for QuerySync<B>
impl<B> Sync for QuerySync<B>
impl<B> Unpin for QuerySync<B>
impl<B> !UnwindSafe for QuerySync<B>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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