{"id":18060815,"url":"https://github.com/0xleif/flite","last_synced_at":"2025-04-11T12:24:23.753Z","repository":{"id":187739982,"uuid":"677486162","full_name":"0xLeif/FLite","owner":"0xLeif","description":"FLite is a streamlined Swift ORM for using FluentSQLiteDriver","archived":false,"fork":false,"pushed_at":"2024-09-27T18:14:56.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T08:42:47.289Z","etag":null,"topics":["async-await","database","fluent","ios","macos","sqlite","swift","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://0xleif.github.io/FLite/","language":"Swift","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/0xLeif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["0xLeif"],"patreon":null,"open_collective":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-08-11T17:36:19.000Z","updated_at":"2024-09-27T18:15:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"592ff357-11ab-4724-8eba-a1692e8ad6ae","html_url":"https://github.com/0xLeif/FLite","commit_stats":null,"previous_names":["0xleif/flite"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FFLite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FFLite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FFLite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FFLite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xLeif","download_url":"https://codeload.github.com/0xLeif/FLite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401480,"owners_count":21097328,"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","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":["async-await","database","fluent","ios","macos","sqlite","swift","tvos","watchos"],"created_at":"2024-10-31T04:10:36.711Z","updated_at":"2025-04-11T12:24:23.730Z","avatar_url":"https://github.com/0xLeif.png","language":"Swift","funding_links":["https://github.com/sponsors/0xLeif"],"categories":[],"sub_categories":[],"readme":"# FLite\n\n*FLite is a streamlined Swift ORM for using [FluentSQLiteDriver](https://github.com/vapor/fluent-sqlite-driver) on iOS, macOS, watchOS, and tvOS applications.*\n\n## What is FLite?\n\nFLite is a Swift library that simplifies usage of FluentSQLiteDriver across various Apple platforms. It takes full advantage of Swift's strong type system and modern concurrency features to provide an easy-to-use interface for database management.\n\n## Features\n- Powered by FluentSQLiteDriver.\n- Simplified access to in-memory and SQLite database functionality.\n- Clean and intuitive APIs for database operations.\n- Non-blocking asynchronous methods that align with Swift's concurrency model for optimal performance.\n- Comprehensive support for database schema migrations.\n- Type-safe approach for building and executing database queries.\n\n## Installation\n\n### Swift Package Manager (SPM)\n\nAdd the following line to your Package.swift file in the dependencies array:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/0xLeif/FLite.git\", from: \"1.0.0\")\n]\n```\n\n## Usage\n\nFirstly, be sure to import FLite in your file:\n\n```swift\nimport FLite\n```\n\n### Basic Usage\n\n```swift\n// Use FLite's shared memory singleton as our FLite database\nlet flite = FLite.memory\n\n// Prepare a migration for a Todo model\ntry await flite.prepare(migration: Todo.self)\n\n// Save a model instance to the database\ntry await flite.save(model: Todo(title: \"Hello World\", strings: [\"hello\", \"world\"]))\n\n// Fetch all instances of our model\nlet todos = try await flite.all(model: Todo.self)\nprint(todos)\n```\n\n### File Storage\n\n```swift\nlet documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path ?? \"\"\nlet fileURL = documentDirectory + \"/default.sqlite\"\n\nlet flite = FLite(configuration: .file(fileURL), loggerLabel: \"Custom.FLite\")\n```\n\n### Batch Operations\n\n```swift\nlet batchSize: UInt = 3\n\nlet todos = (0..\u003c100).map { Todo(title: \"Todo #\\($0)\", strings: []) }\ntry await flite.save(models: todos, batchSize: batchSize)\n\nlet allTodos = try await flite.all(model: Todo.self)\nprint(\"Saved \\(allTodos.count) todos\")\n\ntry await flite.deleteAll(model: Todo.self, batchSize: batchSize)\n```\n\n## Contributing\n\nFLite encourages community involvement and welcomes pull requests from experienced and first-time contributors. For bugs and feature requests, please create an issue.\n\n## License\n\nFLite is released under the MIT License. See `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xleif%2Fflite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xleif%2Fflite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xleif%2Fflite/lists"}