Struct workspace2::WorkspaceDb
source · pub struct WorkspaceDb(_);
Implementations§
source§impl WorkspaceDb
impl WorkspaceDb
sourcepub fn workspace_for_roots<P: AsRef<Path>>(
&self,
worktree_roots: &[P]
) -> Option<SerializedWorkspace>
pub fn workspace_for_roots<P: AsRef<Path>>( &self, worktree_roots: &[P] ) -> Option<SerializedWorkspace>
Returns a serialized workspace for the given worktree_roots. If the passed array is empty, the most recent workspace is returned instead. If no workspace for the passed roots is stored, returns none.
sourcepub async fn save_workspace(&self, workspace: SerializedWorkspace)
pub async fn save_workspace(&self, workspace: SerializedWorkspace)
Saves a workspace using the worktree roots. Will garbage collect any workspaces that used this workspace previously
pub async fn next_id(&self) -> Result<WorkspaceId>
pub async fn recent_workspaces_on_disk( &self ) -> Result<Vec<(WorkspaceId, WorkspaceLocation)>>
pub async fn last_workspace(&self) -> Result<Option<WorkspaceLocation>>
pub async fn update_timestamp(&self, workspace_id: WorkspaceId) -> Result<()>
pub async fn set_window_bounds( &self, workspace_id: WorkspaceId, bounds: WindowBounds, display: Uuid ) -> Result<()>
Methods from Deref<Target = ThreadSafeConnection<WorkspaceDb>>§
pub fn write<T>( &self, callback: impl Send + FnOnce(&Connection) -> T + 'static ) -> impl Future<Output = T>where T: 'static + Send + Sync,
Methods from Deref<Target = Connection>§
pub fn persistent(&self) -> bool
pub fn can_write(&self) -> bool
pub fn backup_main(&self, destination: &Connection) -> Result<(), Error>
pub fn backup_main_to(&self, destination: impl AsRef<Path>) -> Result<(), Error>
pub fn sql_has_syntax_error(&self, sql: &str) -> Option<(String, usize)>
pub fn migrate(
&self,
domain: &'static str,
migrations: &[&'static str]
) -> Result<(), Error>
pub fn migrate( &self, domain: &'static str, migrations: &[&'static str] ) -> Result<(), Error>
Migrate the database, for the given domain. Note: Unlike everything else in SQLez, migrations are run eagerly, without first preparing the SQL statements. This makes it possible to do multi-statement schema updates in a single string without running into prepare errors.
pub fn with_savepoint<R, F>( &self, name: impl AsRef<str>, f: F ) -> Result<R, Error>where F: FnOnce() -> Result<R, Error>,
pub fn with_savepoint_rollback<R, F>( &self, name: impl AsRef<str>, f: F ) -> Result<Option<R>, Error>where F: FnOnce() -> Result<Option<R>, Error>,
pub fn exec<'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>
pub fn exec<'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>
Prepare a statement which has no bindings and returns nothing.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn exec_bound<B, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
pub fn exec_bound<B, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind,
Prepare a statement which takes a binding, but returns nothing. The bindings for a given invocation should be passed to the returned closure
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select<C, 'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>where
C: Column,
pub fn select<C, 'a>(&'a self, query: &str) -> Result<impl FnMut() + 'a, Error>where C: Column,
Prepare a statement which has no bindings and returns a Vec<C>
.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_bound<B, C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
C: Column,
pub fn select_bound<B, C, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind, C: Column,
Prepare a statement which takes a binding and returns a Vec<C>
.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_row<C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut() + 'a, Error>where
C: Column,
pub fn select_row<C, 'a>( &'a self, query: &str ) -> Result<impl FnMut() + 'a, Error>where C: Column,
Prepare a statement that selects a single row from the database. Will return none if no rows are returned and will error if more than 1 row
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.
pub fn select_row_bound<B, C, 'a>(
&'a self,
query: &str
) -> Result<impl FnMut(B) + 'a, Error>where
B: Bind,
C: Column,
pub fn select_row_bound<B, C, 'a>( &'a self, query: &str ) -> Result<impl FnMut(B) + 'a, Error>where B: Bind, C: Column,
Prepare a statement which takes a binding and selects a single row from the database. WIll return none if no rows are returned and will error if more than 1 row is returned.
Note: If there are multiple statements that depend upon each other (such as those which make schema changes), preparation will fail. Use a true migration instead.