Skip to content

Instantly share code, notes, and snippets.



Last active Dec 23, 2018
What would you like to do?
module DB
open System.Data.Common
open Dapper
open Rows
open Domain
let allProducts(connection: DbConnection) =
let getProductType productType =
match productType with
| "Parcel" -> ProductType.Parcel
| "WhiteGood" -> ProductType.WhiteGood
| "XL" -> ProductType.XL
| _ -> ProductType.XL
connection.Query<ProductRow>("select * from products")
|> i-> new Product(i.ProductId, i.Name, i.Height, i.Weight, i.Length, i.Width, getProductType i.ProductType))
|> fun i-> Ok(i)
| ex -> Error ex
//Other methods removed for brevity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment