Skip to main content

DbSet

Struct DbSet 

Source
pub struct DbSet<T: IEntityType> { /* private fields */ }

Implementations§

Source§

impl<T: IEntityType + IEntitySnapshot> DbSet<T>

Source

pub fn new(table_name: impl Into<String>) -> Self

Source

pub fn with_provider( table_name: impl Into<String>, provider: Arc<dyn IDatabaseProvider>, ) -> Self

Source

pub fn set_query_filter(&mut self, filter: BoolExpr)

Source

pub fn set_filter_map(&mut self, map: Arc<HashMap<String, CompiledFilter>>)

Sets the global filter map (table_name → BoolExpr) used by NavigationLoader to scope secondary queries.

Source

pub fn set_provider(&mut self, provider: Arc<dyn IDatabaseProvider>)

Source

pub fn add(&mut self, entity: T)

Convenience inherent method �?delegates to IDbSet::add.

Source

pub fn remove_all(&mut self)

Convenience inherent method �?delegates to IDbSet::remove_all.

Source

pub fn remove_at(&mut self, index: usize) -> EFResult<()>

Convenience inherent method �?delegates to IDbSet::remove_at.

Source

pub fn clear_entries(&mut self)

Convenience inherent method �?delegates to IDbSet::clear_entries.

Source

pub fn len(&self) -> usize

Convenience inherent method �?delegates to IDbSet::len.

Source

pub fn is_empty(&self) -> bool

Convenience inherent method �?delegates to IDbSet::is_empty.

Source

pub fn query(&self) -> QueryBuilder<T>

Convenience inherent method — delegates to IQueryable::query.

Source

pub fn query_ignore_filters(&self) -> QueryBuilder<T>

Returns a query builder that bypasses the configured query filter. Use for administrative / cross-tenant queries.

Source

pub fn attach(&mut self, entity: T)

Source

pub fn tracked_entries(&self) -> impl Iterator<Item = &T>

Source

pub fn tracked_entries_mut(&mut self) -> impl Iterator<Item = &mut T>

Source

pub fn retain(&mut self, f: impl FnMut(&TrackedEntry<T>) -> bool)

Source

pub fn remove_range(&mut self, entities: &[T])
where T: PartialEq,

Marks multiple entities as deleted.

Source

pub async fn load_all(&mut self) -> EFResult<()>

Loads all rows from the database into the change tracker as Unchanged.

Source

pub fn update(&mut self, entity: T)

Marks an entity as modified.

Source

pub fn upsert(&mut self, entity: T)

Marks an entity for upsert (INSERT … ON CONFLICT DO UPDATE).

The entity is tracked in Added state with is_upsert = true. During save_changes, upsert entries are routed to execute_upserts instead of execute_inserts. The conflict target is the entity’s primary key column(s).

Source

pub fn detect_changes(&mut self)
where T: IEntitySnapshot,

Compares attached entities against their original snapshots and marks changes. Populates modified_properties with the field names that differ from the original snapshot, enabling partial UPDATEs (SET only dirty columns).

Source

pub async fn exists_by_id( &self, key_values: HashMap<String, DbValue>, ) -> EFResult<bool>

Source

pub fn filter<F>(&self, apply: F) -> QueryBuilder<T>
where F: FnOnce(QueryBuilder<T>) -> QueryBuilder<T>,

Starts a query filtered by a compile-time LINQ expression tree (linq!(�?).

Trait Implementations§

Source§

impl<T: IEntityType + IEntitySnapshot> IDbSet<T> for DbSet<T>

Source§

fn add(&mut self, entity: T)

Adds a new entity to the set in Added state.
Source§

fn remove_all(&mut self)

Marks all entities in the set as Deleted.
Source§

fn remove_at(&mut self, index: usize) -> EFResult<()>

Marks the entity at the given index as Deleted.
Source§

fn attach(&mut self, entity: T)

Attaches an existing entity in Unchanged state.
Source§

fn added_entities(&self) -> Vec<&T>

Returns references to entities in Added state.
Source§

fn modified_entities(&self) -> Vec<&T>

Returns references to entities in Modified state.
Source§

fn deleted_entities(&self) -> Vec<&T>

Returns references to entities in Deleted state.
Source§

fn entries_with_state(&self) -> Vec<(&T, EntityState)>

Returns an iterator over entity references and their states.
Source§

fn clear_entries(&mut self)

Clears all tracked entries from the set.
Source§

fn len(&self) -> usize

Returns the number of tracked entries.
Source§

fn is_empty(&self) -> bool

Returns whether the set is empty.
Source§

impl<T: IEntityType> IQueryable<T> for DbSet<T>

Source§

fn query(&self) -> QueryBuilder<T>

Source§

impl<T: IEntityType> LinqSource for DbSet<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for DbSet<T>

§

impl<T> !UnwindSafe for DbSet<T>

§

impl<T> Freeze for DbSet<T>

§

impl<T> Send for DbSet<T>

§

impl<T> Sync for DbSet<T>

§

impl<T> Unpin for DbSet<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for DbSet<T>

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.