{"id":33191300,"url":"https://github.com/tforkmann/Fumble","last_synced_at":"2025-11-21T00:02:03.172Z","repository":{"id":43808536,"uuid":"270936534","full_name":"tforkmann/Fumble","owner":"tforkmann","description":"Thin F# API for Sqlite for easy data access to sqlite database with functional seasoning on top","archived":false,"fork":false,"pushed_at":"2025-04-21T11:22:42.000Z","size":5901,"stargazers_count":112,"open_issues_count":2,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-30T01:52:21.741Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://tforkmann.github.io/Fumble/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tforkmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-09T07:45:08.000Z","updated_at":"2025-09-02T00:08:18.000Z","dependencies_parsed_at":"2024-01-16T02:45:17.691Z","dependency_job_id":"eccd5045-0764-4b7f-a576-a7bea051a071","html_url":"https://github.com/tforkmann/Fumble","commit_stats":{"total_commits":90,"total_committers":5,"mean_commits":18.0,"dds":0.3111111111111111,"last_synced_commit":"c96751682c713a0c35c04cc0111b1708852053a4"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/tforkmann/Fumble","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tforkmann%2FFumble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tforkmann%2FFumble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tforkmann%2FFumble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tforkmann%2FFumble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tforkmann","download_url":"https://codeload.github.com/tforkmann/Fumble/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tforkmann%2FFumble/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285532343,"owners_count":27187706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T06:00:41.329Z","updated_at":"2025-11-21T00:02:03.167Z","avatar_url":"https://github.com/tforkmann.png","language":"CSS","funding_links":[],"categories":["General Purpose Libraries"],"sub_categories":["Performance Analysis"],"readme":"# Fumble\n\nFunctional wrapper around plain old `Sqlite` to simplify data access when talking to SQLite databases.\n\n## Available Packages:\n\n| Library  | Version |\n| ------------- | ------------- |\n| Fumble  | [![nuget - Fumble](https://img.shields.io/nuget/v/Fumble.svg?colorB=green)](hhttps://www.nuget.org/packages/Fumble/) |\n\n\n## Install\n```bash\n# nuget client\ndotnet add package Fumble\n\n# or using paket\n.paket/paket.exe add Fumble --project path/to/project.fsproj\n```\n\n## Query a table\n```fs\nopen Fumble\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\ntype User = { Id: int; Username: string }\n\nlet getUsers() : Result\u003cUser list, exn\u003e =\n    connectionString()\n    |\u003e Sql.connect\n    |\u003e Sql.query \"SELECT * FROM dbo.[Users]\"\n    |\u003e Sql.execute (fun read -\u003e\n        {\n            Id = read.int \"user_id\"\n            Username = read.string \"username\"\n        })\n```\n\n## Handle null values from table columns:\n```fs\nopen Fumble\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\ntype User = { Id: int; Username: string; LastModified : Option\u003cDateTime\u003e }\n\nlet getUsers() : Result\u003cUser list, exn\u003e =\n    connectionString()\n    |\u003e Sql.connect\n    |\u003e Sql.query \"SELECT * FROM dbo.[users]\"\n    |\u003e Sql.execute(fun read -\u003e\n        {\n            Id = read.int \"user_id\"\n            Username = read.string \"username\"\n            // Notice here using `orNone` reader variants\n            LastModified = read.dateTimeOrNone \"last_modified\"\n        })\n```\n## Providing default values for null columns:\n```fs\nopen Fumble\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\ntype User = { Id: int; Username: string; Biography : string }\n\nlet getUsers() : Result\u003cUser list, exn\u003e =\n    connectionString()\n    |\u003e Sql.connect\n    |\u003e Sql.query \"select * from dbo.[users]\"\n    |\u003e Sql.execute (fun read -\u003e\n        {\n            Id = read.int \"user_id\";\n            Username = read.string \"username\"\n            Biography = defaultArg (read.stringOrNone \"bio\") \"\"\n        })\n```\n## Execute a parameterized query\n```fs\nopen Fumble\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\n// get product names by category\nlet productsByCategory (category: string) : Result\u003cstring list, exn\u003e =\n    connectionString()\n    |\u003e Sql.connect\n    |\u003e Sql.query \"SELECT name FROM dbo.[Products] where category = @category\"\n    |\u003e Sql.parameters [ \"@category\", Sql.string category ]\n    |\u003e Sql.execute (fun read -\u003e read.string \"name\")\n```\n### Executing a stored procedure with parameters\n```fs\nopen Fumble\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\n// check whether a user exists or not\nlet userExists (username: string) : Async\u003cResult\u003cbool, exn\u003e\u003e =\n    async {\n        return!\n            connectionString()\n            |\u003e Sql.connect\n            |\u003e Sql.storedProcedure \"user_exists\"\n            |\u003e Sql.parameters [ \"@username\", Sql.string username ]\n            |\u003e Sql.execute (fun read -\u003e read.bool 0)\n            |\u003e function\n                | Ok [ result ] -\u003e Ok result\n                | Error error -\u003e Error error\n                | unexpected -\u003e failwithf \"Expected result %A\"  unexpected\n    }\n```\n### Executing a stored procedure with table-valued parameters\n```fs\nopen Fumble\nopen System.Data\n\n// get the connection from the environment\nlet connectionString() = Env.getVar \"app_db\"\n\nlet executeMyStoredProcedure () : Async\u003cint\u003e =\n    // create a table-valued parameter\n    let customSqlTypeName = \"MyCustomSqlTypeName\"\n    let dataTable = new DataTable()\n    dataTable.Columns.Add \"FirstName\" |\u003e ignore\n    dataTable.Columns.Add \"LastName\"  |\u003e ignore\n    // add rows to the table parameter\n    dataTable.Rows.Add(\"John\", \"Doe\") |\u003e ignore\n    dataTable.Rows.Add(\"Jane\", \"Doe\") |\u003e ignore\n    dataTable.Rows.Add(\"Fred\", \"Doe\") |\u003e ignore\n\n    connectionString()\n    |\u003e Sql.connect\n    |\u003e Sql.storedProcedure \"my_stored_proc\"\n    |\u003e Sql.parameters\n        [ \"@foo\", Sql.int 1\n          \"@people\", Sql.table (customSqlTypeName, dataTable) ]\n    |\u003e Sql.executeNonQueryAsync\n```\n\n## Running Tests locally\n\nYou only need a working local Sqlite. The tests will create databases when required and dispose of them at the end of the each test\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftforkmann%2FFumble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftforkmann%2FFumble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftforkmann%2FFumble/lists"}