{"id":13879500,"url":"https://github.com/ioquatix/relaxo-model","last_synced_at":"2025-04-12T14:03:36.741Z","repository":{"id":3896372,"uuid":"4984181","full_name":"ioquatix/relaxo-model","owner":"ioquatix","description":"A simple business logic model for Relaxo (git-backed database) written in Ruby.","archived":false,"fork":false,"pushed_at":"2024-05-08T02:11:25.000Z","size":127,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T08:37:28.717Z","etag":null,"topics":["database","document-database","orm","relaxo","ruby","transactional"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ioquatix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2012-07-11T03:58:16.000Z","updated_at":"2024-10-22T22:49:39.000Z","dependencies_parsed_at":"2024-10-23T07:18:27.362Z","dependency_job_id":"c61b5a64-9fb7-4348-ae53-6a645ab7aacd","html_url":"https://github.com/ioquatix/relaxo-model","commit_stats":{"total_commits":121,"total_committers":2,"mean_commits":60.5,"dds":"0.016528925619834656","last_synced_commit":"f463a4d750993b9c14307b0a62d2d5f9129e9ff6"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Frelaxo-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ioquatix","download_url":"https://codeload.github.com/ioquatix/relaxo-model/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578799,"owners_count":21127713,"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":["database","document-database","orm","relaxo","ruby","transactional"],"created_at":"2024-08-06T08:02:23.016Z","updated_at":"2025-04-12T14:03:36.707Z","avatar_url":"https://github.com/ioquatix.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Relaxo Model\n\nRelaxo Model provides a framework for business logic on top of [Relaxo](https://github.com/ioquatix/relaxo), a document data store built on top of git. While it supports some traditional relational style patterns, it is primary focus is to model business processes and logic at the document level.\n\n[![Development Status](https://github.com/ioquatix/relaxo-model/workflows/Development/badge.svg)](https://github.com/ioquatix/relaxo-model/actions?workflow=Development)\n\n## Basic Usage\n\nHere is a simple example of a traditional ORM style model:\n\n``` ruby\nrequire 'relaxo/model'\n\ndatabase = Relaxo.connect(\"test\")\n\ntrees = [\n\t{:name =\u003e 'Hinoki', :planted =\u003e Date.parse(\"2013/11/17\")},\n\t{:name =\u003e 'Keyaki', :planted =\u003e Date.parse(\"2016/9/24\")}\n]\n\nclass Tree\n\tinclude Relaxo::Model\n\t\n\tproperty :id, UUID\n\tproperty :name\n\tproperty :planted, Attribute[Date]\n\t\n\tview :all, [:type], index: [:id]\nend\n\ndatabase.commit(message: \"Create trees\") do |changeset|\n\ttrees.each do |tree|\n\t\tTree.insert(changeset, tree)\n\tend\nend\n\ndatabase.current do |dataset|\n\tTree.all(dataset).each do |tree|\n\t\tputs \"A #{tree.name} was planted on #{tree.planted.to_s}.\"\n\n\t\t# Expected output:\n\t\t# A Hinoki was planted on 2013-11-17.\n\t\t# A Keyaki was planted on 2016-09-24.\n\tend\nend\n```\n\n### Non-UUID Primary Key\n\n``` ruby\n#!/usr/bin/env ruby\n\ngem 'relaxo'\n\nrequire 'relaxo/model'\n\ndatabase = Relaxo.connect(\"test\")\n\ntrees = [\n\t{:name =\u003e 'Hinoki', :planted =\u003e Date.parse(\"2013/11/17\")},\n\t{:name =\u003e 'Keyaki', :planted =\u003e Date.parse(\"2016/9/24\")}\n]\n\nclass Tree\n\tinclude Relaxo::Model\n\n\tproperty :name\n\tproperty :planted, Attribute[Date]\n\n\tview :all, [:type], index: [:name]\nend\n\ndatabase.commit(message: \"Create trees\") do |changeset|\n\ttrees.each do |tree|\n\t\tTree.insert(changeset, tree)\n\tend\nend\n\ndatabase.current do |dataset|\n\ttrees.each do |tree|\n\t\tobject = Tree.fetch_all(dataset, name: tree[:name])\n\t\tputs object\n\tend\nend\n```\n\n## Contributing\n\n1.  Fork it\n2.  Create your feature branch (`git checkout -b my-new-feature`)\n3.  Commit your changes (`git commit -am 'Add some feature'`)\n4.  Push to the branch (`git push origin my-new-feature`)\n5.  Create new Pull Request\n\n## License\n\nReleased under the MIT license.\n\nCopyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Frelaxo-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fioquatix%2Frelaxo-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Frelaxo-model/lists"}