{"id":17279561,"url":"https://github.com/bobek-balinek/bluejet","last_synced_at":"2026-03-17T11:34:49.111Z","repository":{"id":144917359,"uuid":"97263055","full_name":"bobek-balinek/BlueJet","owner":"bobek-balinek","description":"BlueJet is a modern Swift wrapper around Lightning Memory-Mapped Database Manager (LMDB)","archived":false,"fork":false,"pushed_at":"2019-03-26T18:58:06.000Z","size":1552,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-02T06:28:05.361Z","etag":null,"topics":["carthage","cocoa","database","lmdb","persistence","swift","swift-library"],"latest_commit_sha":null,"homepage":"","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/bobek-balinek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2017-07-14T18:40:00.000Z","updated_at":"2025-02-24T07:25:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a724c12-4227-4f22-ba61-1807ff54aa4a","html_url":"https://github.com/bobek-balinek/BlueJet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bobek-balinek/BlueJet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobek-balinek%2FBlueJet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobek-balinek%2FBlueJet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobek-balinek%2FBlueJet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobek-balinek%2FBlueJet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobek-balinek","download_url":"https://codeload.github.com/bobek-balinek/BlueJet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobek-balinek%2FBlueJet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30622770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["carthage","cocoa","database","lmdb","persistence","swift","swift-library"],"created_at":"2024-10-15T09:17:59.626Z","updated_at":"2026-03-17T11:34:49.089Z","avatar_url":"https://github.com/bobek-balinek.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlueJet [![Build Status](https://travis-ci.org/bobek-balinek/BlueJet.svg?branch=master)](https://travis-ci.org/bobek-balinek/BlueJet)\n\n\u003e Blue jet is a rare type of a lightning with a very blue colour with near-ultraviolet emission lines from neutral and ionized molecular nitrogen. It typically occurs in the lower levels of ionosphere at ~50km above the surface of the earth.\n\n### WARNING: This tool is under development and is not ready for production use\n\n## Synopsis\n\nBlueJet is a modern Swift/Cocoa wrapper around Lightning Memory-Mapped Database Manager (LMDB). It fully utilises the multi-threaded access, transations and provides a simple enumeration interface for fetching subsets of the database. Key/Value pairs are using Swift's Encoder/Decoder protocol when dealing with the data.\n\n## What is LMDB?\n\nLMDB is an incredibly fast key-value store written by Howard Chu for the OpenLDAP project. Given the nature of LDAP workloads the design of LMDB is read-optimised (but writes are super fast too!). This particular database allows for multiple databases within one environment which makes separating different data sets much easier to handle. It also allows for multiple processes to access a single database without locking it and supports transactions for making series of fail-safe reads/write routines. For more details on the design and implementation of LMDB go to [the website](https://symas.com/lightning-memory-mapped-database/).\n\n### Value Type oriented\n\nWith many data persistence options available for both Cocoa (Touch) and Server-side Swift BlueJet aims to be the simplest and fast Value Type store without the complexity of confusing query language, sub-classing your data models or large set of dependencies. This framework is designed to take any Swift's value type such as String, Int, Float and Data but also provide set of protocols to allow for custom type-to-Data conversion.\n\n### Codable support\n\nYou can serialize your custom value types using Swift's Codable protocol. BlueJet will use `JSONEncoder/Decoder` as the default serialization method. You can provide a different method by passing encoder/decoder to respective methods for retrieving/persisting values.\n\n```swift\nstruct Book: Codable {\n    let title: String\n    let isbn: String\n}\n\n// …\n\nlet book = Book(title: \"Summary: Astrophysics for People In A Hurry\", isbn: \"978-1974241422\")\n\ntransaction.set(value: book, forKey: \"Favourite Book\")\n```\n\n## Installation\n\n### Carthage\n\nAdd BlueJet to your Cartfile:\n\n```\ngithub \"bobek-balinek/BlueJet\"\n```\n\nThen run:\n\n```\ncarthage update --use-submodules\n```\n\n### Swift Package Manager\n\nAdd BlueJet as a dependency in your `Package.swift` file and import it in your project:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YourGreatNewProject\",\n    dependencies: [\n        .Package(url: \"https://github.com/bobek-balinek/BlueJet.git\", majorVersion: 0, minor: 1)\n    ]\n)\n\n```\n\n## Basic Usage\n\nBlueJet is designed for Key/Value persistence. Keys and Values can be any of the Swift types i.e. `Int`, `String`, `Double` etc. Additionally, you can persist custom keys and values using the `Codable` protocol. First, you need to initialize the environment for interacting with a set of databases.\n\n```swift\nlet env = Environment(url: localPath)\nlet db = env.database(name: \"Books\")\n\ndb.write { trx in\n    trx.put(value: \"Astrophysics for People In A Hurry\", forKey: \"Favourite Book\")\n}\n\nprint(db.keys())\n```\n\n### Retrieving data\n\nReading data from the database is very simple:\n\n```swift\nlet val = db.value(String.self, forKey: \"User Name\")\n\nprint(val)\n\n// \"Bobby\"\n```\n\n### Persiting data\n\nPersistence happens within a transaction. Transactions make it safe to perform a series of operations without corrupting any of the data. To write data to a database use the `write` method like so:\n\n```swift\nlet num = 42\ndb.write { (trx: Transaction) in\n    trx.set(value: num, forKey: \"T-rex\")\n}\n```\n\n### Range enumeration\n\nIf you want to iterate over a range of keys you can create a `Range` or `ClosedRange` providing lower and upper bounds to restrict the query. These types conform to Swift's `Collection` type so you can iterate over them usign a `for` loop or the `forEach` method.\n\n```swift\nlet range = db.range(from: \"Bob\", to: \"Sally\")\n\nfor i in range.keys() {\n    print(i)\n}\n```\n\n### Storable protocol\n\nIt is possible to store custom types directly by conforming the type to `Storable` protocol. This protocol requires a function `primaryKey` to return a String representing the key it should be persisted under.\n\n```swift\nstruct Book: Codable {\n    let title: String\n    let isbn: String\n}\n\nextension Book: Storable {\n    func primaryKey(): String {\n        return isbn\n    }\n}\n\n// …\n\nlet book = Book(title: \"Astrophysics for People In A Hurry\", isbn: \"978-1974241422\")\n\ntransaction.set(value: book)\n\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details!\n\nThis project adheres to the [Code of Conduct](https://github.com/bobek-balinek/BlueJet/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n`BlueJet` is available under the MIT license. See the LICENSE files for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobek-balinek%2Fbluejet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobek-balinek%2Fbluejet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobek-balinek%2Fbluejet/lists"}