This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! For youtube video: https://www.youtube.com/watch?v=U-5_bumwH9w&list=PL7r-PXl6ZPcCIOFaL7nVHXZvBmHNhrh_Q | |
/// Guard pattern with let-else | |
/// e.g., "my_key: 123" | |
pub fn key_num_guard_1(item: &str) -> Result<(&str, i32), &'static str> { | |
let Some((key, val)) = item.split_once(':') else { | |
return Err("Invalid item"); | |
}; | |
let Ok(val) = val.trim().parse::<i32>() else { | |
return Err("Invalid item"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Donald | |
open System.Data.Common | |
open System.Data.SQLite | |
open System.Threading.Tasks | |
open Giraffe | |
open Giraffe.ViewEngine | |
open FsToolkit.ErrorHandling | |
open Microsoft.AspNetCore.Builder | |
[<RequireQualifiedAccess>] |