You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: channel.rs
    path of file: ./repos/lettura/src-tauri/src/feed
    
    the code of the file until where you have to start completion: use std::collections::HashMap;

use chrono::Local;
use diesel::prelude::*;
use diesel::sql_types::*;
use log::info;
use log::warn;
use scraper::{Html, Selector};
use serde::{Deserialize, Serialize};

use crate::cmd::create_article_models;
use crate::db;
use crate::feed;
use crate::models;
use crate::schema;

pub fn get_feed_by_uuid(channel_uuid: &str) -> Option<models::Feed> {
  let mut connection = db::establish_connection();
  let mut channel = schema::feeds::dsl::feeds
    .filter(schema::feeds::uuid.eq(&channel_uuid))
    .load::<models::Feed>(&mut connection)
    .expect("Expect find channel");

  return if channel.len() == 1 {
    channel.pop()
  } else {
    None
  };
}

/// delete channel and associated articles
/// # Example
/// ```
/// let uuid = String::from("123456");
/// let result = delete_feed(uuid);
///
/// assert_eq!(1, result);
/// ```
pub fn delete_feed(uuid: String) -> usize {
  let mut connection = db::establish_connection();
  let channel = schema::feeds::dsl::feeds
    .filter(schema::feeds::uuid.eq(&uuid))
    .load::<models::Feed>(&mut connection)
    .expect("Expect find channel");

  println!("channel {:?}", channel);

  return if channel.len() == 1 {
    diesel::delete(
      schema::articles::dsl::articles.filter(schema::articles::feed_uuid.eq(&uuid)),
    )
    .execute(&mut connection)
    .expect("Expect delete channel");

    diesel::delete(schema::feed_metas::dsl::feed_metas.filter(schema::feed_metas::uuid.eq(&uuid)))
      .execute(&mut connection)
      .expect("Expect delete channel");

    let result = diesel::delete(schema::feeds::dsl::feeds.filter(sc
    
pub fn get_feeds() -> Vec<SubscribeItem> {
  let sql_feed_in_folder = "
    SELECT
      C.title AS title,
      F.uuid AS uuid,
      F.sort,
      C.link,
      C.logo,
      C.feed_url,
      C.description,
      C.create_date,
      F.folder_uuid as folder_uuid
    FROM feeds as C
    LEFT JOIN feed_metas AS F
    ON C.uuid = F.uuid
    WHERE folder_uuid != '' and folder_uuid IS NOT NULL
    ORDER BY F.sort ASC;";

  let mut connection = db::establish_connection();

  let feeds_in_folder = diesel::sql_query(sql_feed_in_folder)
    .load::<FeedJoinRecord>(&mut connection)
    .unwrap_or(vec![]);
  let folders = schema::folders::dsl::folders
    .load::<models::Folder>(&mut connection)
    .unwrap();

  let mut folder_channel_map: HashMap<String, Vec<ChildItem>> = HashMap::new();
  let mut result: Vec<SubscribeItem> = Vec::new();
  let mut filter_uuids: Vec<String> = Vec::new();

  for channel in feeds_in_folder {
    let p_uuid = String::from(&channel.folder_uuid);
    let children = folder_channel_map.entry(p_uuid.clone()).or_insert(vec![]);

    children.push(ChildItem {
      item_type: String::from("channel"),
      uuid: String::from(&channel.uuid),
      title: channel.title,
      sort: channel.sort,
      link: Some(channel.link),
      logo: channel.logo,
      feed_url: channel.feed_url,
      description: channel.description,
      create_date: channel.create_date,
    });

    filter_uuids.push(channel.uuid);
  }

  for folder in folders {
    let c_uuids = folder_channel_map
      .entry(String::from(&folder.uuid))
      .or_insert(vec![]);

    result.push(SubscribeItem {
      item_type: String::from("folder"),
      uuid: folder.uuid,
      title: folder.name,
      sort: folder.sort,
      link: Some(String::from("")),
      logo: String::from(""),
      children: Some(c_uuids.to_vec()),
      feed_url: "".to_string(),
      description: "".to_string(),
      create_date: folder.create_date,
    });
  }

  log::debug!("filter_uuids :{:?}", &filter_uuids);

  let feeds = schema::feeds::dsl::feeds
    .filter(diesel::dsl::not(schema::feeds::uuid.eq_any(&filter_uuids)))
    .load::<models::Feed>(&mut connection)
    .unwrap();

  for feed in feeds {
    result.push(SubscribeItem {
      item_type: String::from("channel"),
      uuid: feed.uuid,
      title: feed.title,
      sort: feed.sort,
      link: Some(feed.link),
      logo: feed.logo,
      feed_url: feed.feed_url,
      description: feed.description,
      create_date: feed.create_date,
      children: Some(Vec::new()),
    });
  }

  result.sort_by(|a, b| a.sort.cmp(&b.sort));

  result
}