pub trait NotebookDb:
Send
+ Sync
+ 'static {
// Required methods
fn list_by_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Notebook>, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_seeded<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_by_id_and_owner<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
patch: NotebookUpdatePatch,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
CRUD operations for the notebooks table.
Required Methods§
Sourcefn list_by_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_by_owner<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return all notebooks owned by owner_id, ordered by created_at asc.
Sourcefn create<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new notebook row and return it.
The implementation generates a fresh uuid4 id for the new row.
Sourcefn create_seeded<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_seeded<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
name: String,
cells: Value,
deletable: bool,
) -> Pin<Box<dyn Future<Output = Result<Notebook, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a notebook with a caller-supplied id (used by the tutorial seeder to guarantee deterministic UUID5 ids across SDK restarts).
Sourcefn get_by_id_and_owner<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_by_id_and_owner<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch a notebook by id, scoped to the owner.
Sourcefn update<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
patch: NotebookUpdatePatch,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
owner_id: Uuid,
patch: NotebookUpdatePatch,
) -> Pin<Box<dyn Future<Output = Result<Option<Notebook>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Apply a partial update. Returns the updated row or None when not
found (ownership check included).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".