pub struct DataManager(pub DataManager<Config>);
Tuple Fields§
§0: DataManager<Config>
Implementations§
Source§impl DataManager
impl DataManager
pub async fn get_upload_by_id(&self, selector: usize) -> Result<MediaUpload>
Sourcepub async fn get_upload_by_id_bucket(
&self,
id: usize,
bucket: &str,
) -> Result<MediaUpload>
pub async fn get_upload_by_id_bucket( &self, id: usize, bucket: &str, ) -> Result<MediaUpload>
Get an upload by its ID and bucket.
Sourcepub async fn get_uploads(
&self,
batch: usize,
page: usize,
) -> Result<Vec<MediaUpload>>
pub async fn get_uploads( &self, batch: usize, page: usize, ) -> Result<Vec<MediaUpload>>
Get all uploads (paginated).
§Arguments
batch
- the limit of items in each pagepage
- the page number
Sourcepub async fn get_uploads_by_owner(
&self,
owner: usize,
batch: usize,
page: usize,
) -> Result<Vec<MediaUpload>>
pub async fn get_uploads_by_owner( &self, owner: usize, batch: usize, page: usize, ) -> Result<Vec<MediaUpload>>
Get all uploads by their owner (paginated).
§Arguments
owner
- the ID of the owner of the uploadbatch
- the limit of items in each pagepage
- the page number
Sourcepub async fn get_uploads_by_owner_all(
&self,
owner: usize,
) -> Result<Vec<MediaUpload>>
pub async fn get_uploads_by_owner_all( &self, owner: usize, ) -> Result<Vec<MediaUpload>>
Sourcepub async fn create_upload(&self, data: MediaUpload) -> Result<MediaUpload>
pub async fn create_upload(&self, data: MediaUpload) -> Result<MediaUpload>
Create a new upload in the database.
Please note that the file must be manually written afterwards. You can use
the returned MediaUpload
to retrieve the correct path to write the file.
§Arguments
data
- a mockMediaUpload
object to insert
Sourcepub async fn delete_upload(&self, id: usize) -> Result<()>
pub async fn delete_upload(&self, id: usize) -> Result<()>
Delete an upload given its id
.
§Warning
It’s recommended that you use [Self::delete_upload_with_id
] instead,
as the table’s primary key is on (id, bucket)
, not id
.
Sourcepub async fn delete_upload_with_bucket(
&self,
id: usize,
bucket: &str,
) -> Result<()>
pub async fn delete_upload_with_bucket( &self, id: usize, bucket: &str, ) -> Result<()>
Delete an upload given its id
and bucket
.
pub async fn update_upload_metadata( &self, id: usize, x: UploadMetadata, ) -> Result<()>
Trait Implementations§
Source§impl Clone for DataManager
impl Clone for DataManager
Source§fn clone(&self) -> DataManager
fn clone(&self) -> DataManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DataManager
impl !RefUnwindSafe for DataManager
impl Send for DataManager
impl Sync for DataManager
impl Unpin for DataManager
impl !UnwindSafe for DataManager
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