{"id":29925500,"url":"https://github.com/expressapp/ecto_crdt_types","last_synced_at":"2025-08-02T11:39:13.812Z","repository":{"id":56597936,"uuid":"149609679","full_name":"ExpressApp/ecto_crdt_types","owner":"ExpressApp","description":"Basic support for crdt types in ecto","archived":false,"fork":false,"pushed_at":"2020-10-29T15:05:02.000Z","size":72,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-05T14:18:31.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/ExpressApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-20T12:59:12.000Z","updated_at":"2022-09-12T14:27:34.000Z","dependencies_parsed_at":"2022-08-15T21:40:30.848Z","dependency_job_id":null,"html_url":"https://github.com/ExpressApp/ecto_crdt_types","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ExpressApp/ecto_crdt_types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressApp%2Fecto_crdt_types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressApp%2Fecto_crdt_types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressApp%2Fecto_crdt_types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressApp%2Fecto_crdt_types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExpressApp","download_url":"https://codeload.github.com/ExpressApp/ecto_crdt_types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpressApp%2Fecto_crdt_types/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268380166,"owners_count":24241205,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-02T11:37:16.069Z","updated_at":"2025-08-02T11:39:13.790Z","avatar_url":"https://github.com/ExpressApp.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EctoCrdtTypes [![Build Status](https://travis-ci.org/ExpressApp/ecto_crdt_types.svg?branch=master)](https://travis-ci.org/ExpressApp/ecto_crdt_types) [![Hex.pm](https://img.shields.io/hexpm/v/ecto_crdt_types.svg)](https://hex.pm/packages/ecto_crdt_types)\n\n---\n\nLibary provides support for saving CRDT data and values to db using Ecto.\n\nIt provides:\n- changeset function `cast_crdt`,\n- Ecto.Schema macro `crdt_field`\n- custom Ecto types, with generic support of [lasp-lang/types](https://github.com/lasp-lang/types) library underneath.\n\nCurrently we actively use the following types from `lasp-lang`:\n- :state_awset\n- :state_lwwregistry\n\nOther types have very basic support. So feel free to contribute!\n\n---\n\n\n## Installation\n\n1. Add `ecto_crdt_types` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:ecto_crdt_types, \"~\u003e 0.4.0\"}]\nend\n```\n\n2. Ensure `ecto_crdt_types` is started before your application:\n\n```elixir\ndef application do\n  [applications: [:ecto_crdt_types]]\nend\n```\n\n## Usage\n\nDefine Ecto schema and changeset:\n\n```elixir\ndefmodule User do\n  use Ecto.Schema\n  import EctoCrdtTypes.Fields\n\n  alias EctoCrdtTypes.Types.State.AWSet\n\n  schema \"users\" do\n    field :name, :string\n    crdt_field :devices, AWSet\n  end\n\n  def changeset(model, params) do\n    params\n    |\u003e cast(params, [:name])\n    |\u003e cast_crdt([:devices])\n  end\nend\n```\n\nInitialize new `User` changeset:\n\n```elixir\niex\u003e alias EctoCrdtTypes.Types.State.AWSet\n\niex\u003e user =\n%User{}\n|\u003e User.changeset(%{\"name\" =\u003e \"My Name\", \"devices_crdt\" =\u003e AWSet.new([]))\n|\u003e Repo.insert(user)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpressapp%2Fecto_crdt_types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpressapp%2Fecto_crdt_types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpressapp%2Fecto_crdt_types/lists"}