{"id":18463908,"url":"https://github.com/badchoice/daikiriswift","last_synced_at":"2025-04-28T13:36:52.559Z","repository":{"id":56908175,"uuid":"233858159","full_name":"BadChoice/DaikiriSwift","owner":"BadChoice","description":"Wrapper arround CoreData","archived":false,"fork":false,"pushed_at":"2024-11-17T17:56:02.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T20:01:45.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/BadChoice.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":"2020-01-14T14:21:16.000Z","updated_at":"2024-11-04T08:40:20.000Z","dependencies_parsed_at":"2024-11-18T01:04:30.869Z","dependency_job_id":null,"html_url":"https://github.com/BadChoice/DaikiriSwift","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2FDaikiriSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2FDaikiriSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2FDaikiriSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2FDaikiriSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BadChoice","download_url":"https://codeload.github.com/BadChoice/DaikiriSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251320616,"owners_count":21570605,"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-11-06T09:08:20.495Z","updated_at":"2025-04-28T13:36:52.522Z","avatar_url":"https://github.com/BadChoice.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DaikiriSwift\n\nThe new coredata wrapper to easily work with it, from json to coredata and back!\n\n### Defining a model\n\nYou simply need o inther from `Daikiri` and conform to `DaikiriId` and `Codable` protocols.\n\n```\nclass Hero : Daikiri, DaikiriId, Codable {\n    let id:Int\n\n    public init(id:Int){\n        self.id = id\n    }\n}\n```\n\nOnce you have this you can simply create an instance to the core data with\n\n```\nHero(id:1).create()\n```\n\nAnd you can retrieve it with\n\n```\nlet hero = Hero.find(1)\n```\n\n\n### Queries\nYou can easily fetch elements from the database with the object `query` \n\n```\nlet heroes = Hero.query.whereKey(\"id\", 1).get()\n```\n\nor you can also use another operator\n```\nlet heroes = Hero.query.whereKey(\"id\", \"\u003e\", 4).get()\n```\n\nOther functions you can use\n```\nHero.query.count()\nHero.query.max(\"id\")\nHero.query.min(\"id\")\nHero.query.skip(10)\nHero.query.take(4\")\nHero.query.orderBy(\"id\", ascendig: true)\n```\n\nYou can combine them\n\n```\nlet heroes = Hero.query\n                 .whereKey(\"id\", \"\u003e\", 4)\n                 .orderBy(\"id\", ascending:false)\n                 .skip(10)\n                 .take(2)\n                 .get()\n```\n\n### Relationships\n```\nbelongsTo\nhasMany\nbelongsToMany\nmorphTo\nmorphOne\nmorphMany\nmorphToMany\nmorphedByMany\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadchoice%2Fdaikiriswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadchoice%2Fdaikiriswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadchoice%2Fdaikiriswift/lists"}