pub fn add_files(&self, new_files: Vec<OwnedNewFile>, folder_uuid: Uuid) -> Result<Vec<File>, DataError> {
        // use schema::files::dsl::*;
        let db = &self.pool;
        let conn = db.get()?;

        for new_file in new_files.iter() {
            let new_file_ref = NewFile {
                file_id: &new_file.file_id,
                folder_id: &new_file.folder_id,
                file_name: &new_file.file_name,
                file_size: new_file.file_size.as_ref(),
            };
            let rows = diesel::insert_into(schema::files::table)
                .values(new_file_ref)
                .execute(&conn)?;
            validate_rows(rows, 1)?;
        }
        let result = schema::files::table
            .filter(schema::files::columns::folder_id
                .eq(folder_uuid.to_string()))
            .load::<File>(&conn)?;
        Ok(result)
    }
// On SQLite, one query will be performed per row.
On SQLite, one query will be performed per row.
On SQLite one query will be performed per row .
pub fn add_files(&self, new_files: Vec<OwnedNewFile>, folder_uuid: Uuid) -> Result<Vec<File>, DataError> {
        // use schema::files::dsl::*;
        let db = &self.pool;
        let conn = db.get()?;
        for new_file in new_files.iter() {
            let new_file_ref = NewFile {
                file_id: &new_file.file_id,
                folder_id: &new_file.folder_id,
                file_name: &new_file.file_name,
                file_size: new_file.file_size.as_ref(),
            };
            let rows = diesel::insert_into(schema::files::table)
                .values(new_file_ref)
                .execute(&conn)?;
            validate_rows(rows, 1)?;
        }
        let result = schema::files::table
            .filter(schema::files::columns::folder_id
                .eq(folder_uuid.to_string()))
            .load::<File>(&conn)?;
        Ok(result)
    }
pub fn add_files ( & self , new_files : Vec < OwnedNewFile > , folder_uuid : Uuid ) -> Result < Vec < File > , DataError > { // use schema::files::dsl::*; let db = & self . pool ; let conn = db . get ( ) ? ; for new_file in new_files . iter ( ) { let new_file_ref = NewFile { file_id : & new_file . file_id , folder_id : & new_file . folder_id , file_name : & new_file . file_name , file_size : new_file . file_size . as_ref ( ) , } ; let rows = diesel :: insert_into ( schema :: files :: table ) . values ( new_file_ref ) . execute ( & conn ) ? ; validate_rows ( rows , 1 ) ? ; } let result = schema :: files :: table . filter ( schema :: files :: columns :: folder_id . eq ( folder_uuid . to_string ( ) ) ) . load :: < File > ( & conn ) ? ; Ok ( result ) }
On SQLite, one query will be performed per row.
On SQLite one query will be performed per row .
&self
new_files
Vec<OwnedNewFile>
folder_uuid
Uuid
&self
new_files
Vec<OwnedNewFile>
folder_uuid
Uuid