{"id":13785509,"url":"https://github.com/IBM-Swift-Sunset/Kassandra","last_synced_at":"2025-05-11T21:30:34.516Z","repository":{"id":69022558,"uuid":"107209778","full_name":"IBM-Swift-Sunset/Kassandra","owner":"IBM-Swift-Sunset","description":"🚫 This project is no longer maintained. Apache Cassandra and ScyllaDB driver for Swift 3","archived":false,"fork":false,"pushed_at":"2017-10-17T02:53:32.000Z","size":1060,"stargazers_count":3,"open_issues_count":38,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T22:01:47.210Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM-Swift-Sunset.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-10-17T02:51:42.000Z","updated_at":"2022-08-31T10:24:04.000Z","dependencies_parsed_at":"2023-09-14T19:30:27.347Z","dependency_job_id":null,"html_url":"https://github.com/IBM-Swift-Sunset/Kassandra","commit_stats":null,"previous_names":["ibm-swift/kassandra"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Swift-Sunset%2FKassandra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Swift-Sunset%2FKassandra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Swift-Sunset%2FKassandra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Swift-Sunset%2FKassandra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM-Swift-Sunset","download_url":"https://codeload.github.com/IBM-Swift-Sunset/Kassandra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253638729,"owners_count":21940414,"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":[],"created_at":"2024-08-03T19:01:01.235Z","updated_at":"2025-05-11T21:30:33.564Z","avatar_url":"https://github.com/IBM-Swift-Sunset.png","language":"Swift","funding_links":[],"categories":["Database Connectors"],"sub_categories":["Cassandra"],"readme":"# 🚫 This project is no longer maintained.\n\n# Kassandra\n\nA pure Swift client library for [Apache Cassandra (3.4+)](http://cassandra.apache.org/) and [ScyllaDB](http://www.scylladb.com/) using Cassandra's binary protocol, CQL 3.2.\n\n[![Build Status](https://travis-ci.org/IBM-Swift/Kassandra.svg?branch=master)](https://travis-ci.org/IBM-Swift/Kassandra)\n![](https://img.shields.io/badge/Swift-3.0.2%20RELEASE-orange.svg?style=flat)\n![](https://img.shields.io/badge/platform-Linux,%20macOS-blue.svg?style=flat)\n\n## Installation\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    \tdependencies: [\n\t\t.Package(url: \"https://github.com/IBM-Swift/Kassandra.git\", majorVersion: 1)\n    \t]\n    )\n```\n\n## Basic usage\n\n### Prepare your queries\n\nYou must first connect to the database before you can execute SQL statements. You can specify the keyspace to use in the connect statement.\n\n```swift\nlet kassandra = Kassandra()\ntry kassandra.connect(with: \"mykeyspace\") { error in \n    kassandra.execute(\"SELECT * FROM bread;\")\n\n}\n```\n\n## Create a Model\n\nIn order to persist objects, they must conform to the `Model` protocol.\n\n```swift\nstruct Post {\n    var id: UUID?\n    let user: String\n    let body: String\n    let timestamp: Date\n}\n```\n\nThe model specifies the table name to use, the primary key that is used, and the fieldTypes.\n\n```swift\nextension Post: Model {\n    enum Field: String {\n        case id = \"id\"\n        case user = \"user\"\n        case body  = \"message\"\n        case timestamp = \"timestamp\"\n    }\n    \n    static let tableName = \"Posts\"\n    \n    static var primaryKey: Field {\n        return Field.id\n    }\n    \n    static var fieldTypes: [Field: DataType] {\n        return [\n            .id         : .uuid,\n            .user       : .text,\n            .body       : .text,\n            .timestamp  : .timestamp\n        ]\n    }\n    \n    var key: UUID? {\n        get {\n            return self.id\n        }\n        set {\n            self.id = newValue\n        }\n    }\n    \n    init(row: Row) {\n        self.id         = row[\"id\"] as? UUID\n        self.user       = row[\"user\"] as! String\n        self.body       = row[\"body\"] as! String\n        self.timestamp  = row[\"timestamp\"] as! Date\n    }\n}\n```\n\n### Save an object\n\nPersisting an object with Kassandra is easy, and only requires the save method.\n\n```swift\n\nlet post = Post(id: UUID(), user: user, body: message, timestamp: Date())\n\npost.save()\n\n```\n\n---\n\n## Detailed Installation \n\n1. Install OpenSSL:\n\n    - macOS:\n    ```\n    $ brew install openssl\n    ```\n    - Linux:\n    ```\n    $ sudo apt-get install openssl\n    ```\n\n2. Add `Kassandra` to your `Package.swift`\n\n    ```swift\n    import PackageDescription\n\n    let package = Package(\n    \tdependencies: [\n\t\t.Package(url: \"https://github.com/IBM-Swift/Kassandra.git\", majorVersion: 1)\n    \t]\n    )\n    ```\n\n3. Create XCode project to build library (Optional)\n\n    ```\n    $ swift package generate-xcodeproj \\\n            -Xswiftc -I/usr/local/opt/openssl/include \\\n            -Xlinker -L/usr/local/opt/openssl/lib\n    ```\n\n4. In Sources/main.swift, import the Kassandra module.\n\n    ``` Swift\n    import Kassandra\n    ```\n5. Build Locally\n\n\t- macOS\n\t```\n\t$ swift build -Xcc -I/usr/local/opt/openssl/include -Xlinker -L/usr/local/opt/openssl/lib\n\t```\n\t- Linux\n\t```\n\t$ swift build -Xcc -I/usr/local/opt/openssl/include -Xlinker -L/usr/local/opt/openssl/lib\n\t```\n\n## License \n\nCopyright 2017 IBM\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM-Swift-Sunset%2FKassandra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIBM-Swift-Sunset%2FKassandra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM-Swift-Sunset%2FKassandra/lists"}