{"id":13564199,"url":"https://github.com/YgorCastor/ravix-ecto","last_synced_at":"2025-04-03T21:30:31.249Z","repository":{"id":39885627,"uuid":"475914694","full_name":"YgorCastor/ravix-ecto","owner":"YgorCastor","description":"An Ecto adapter for the Ravix RavenDB Driver","archived":false,"fork":false,"pushed_at":"2024-05-13T12:36:42.000Z","size":129,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T13:05:04.787Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YgorCastor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"ycastor.eth"}},"created_at":"2022-03-30T14:24:49.000Z","updated_at":"2024-06-16T14:02:25.000Z","dependencies_parsed_at":"2024-01-08T11:29:56.360Z","dependency_job_id":"b272fc51-296d-4273-83e0-cfe70c57b28c","html_url":"https://github.com/YgorCastor/ravix-ecto","commit_stats":{"total_commits":43,"total_committers":4,"mean_commits":10.75,"dds":0.3023255813953488,"last_synced_commit":"d8da904e86062e10fd41a41decd57f03c1d5caa1"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YgorCastor%2Fravix-ecto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YgorCastor%2Fravix-ecto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YgorCastor%2Fravix-ecto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YgorCastor%2Fravix-ecto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YgorCastor","download_url":"https://codeload.github.com/YgorCastor/ravix-ecto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082826,"owners_count":20880725,"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-01T13:01:27.878Z","updated_at":"2025-04-03T21:30:30.863Z","avatar_url":"https://github.com/YgorCastor.png","language":"Elixir","funding_links":["ycastor.eth"],"categories":["ORM and Datamapping","Languages"],"sub_categories":["Elixir"],"readme":"# Ravix Ecto\n\n[![Build \u0026 Tests](https://github.com/YgorCastor/ravix-ecto/actions/workflows/elixir.yml/badge.svg)](https://github.com/YgorCastor/ravix-ecto/actions/workflows/elixir.yml)\n\n[RavenDB](https://ravendb.net/) is an amazing multi-model NoSQL database, and albeit it does not support SQL, its `RQL Language` if pretty close, so behold, now you can query it\nlike a simple Ecto-SQL database.\n\nThis adapter leverages the use of [Ravix](https://github.com/YgorCastor/ravix) as a driver between ecto and RavenDB\n\n## Installing\n\nAdd Ravix Ecto to your mix.exs dependencies\n\n```elixir\n{:ravix_ecto, \"~\u003e 0.4.0\"}\n```\n\n## Example\n\n```elixir\n# In your config/config.exs file\nconfig :my_app, Store,\n  urls: [System.get_env(\"RAVENDB_URL\", \"http://localhost:8080\")],\n  database: \"test\",\n  retry_on_failure: true,\n  retry_on_stale: true,\n  retry_backoff: 500,\n  retry_count: 3,\n  force_create_database: true,\n  document_conventions: %{\n    max_number_of_requests_per_session: 30,\n    max_ids_to_catch: 32,\n    timeout: 30,\n    use_optimistic_concurrency: false,\n    max_length_of_query_using_get_url: 1024 + 512,\n    identity_parts_separator: \"/\",\n    disable_topology_update: false\n  }\n\nconfig :my_app, Repo, store: Store\n\n# In your application code\ndefmodule Store do\n  use Ravix.Documents.Store, otp_app: :my_app\nend\n\ndefmodule Repo do\n  use Ecto.Repo,\n    otp_app: :ravix_ecto,\n    adapter: Ravix.Ecto.Adapter\nend\n\ndefmodule TestApplication do\n  use Application\n\n  def start(_opts, _) do\n    children = [\n      {Repo, [%{}]}\n    ]\n\n    Supervisor.init(\n      children,\n      strategy: :one_for_one\n    )\n  end\nend\n\ndefmodule Weather do\n  use Ecto.Model\n\n  @primary_key {:id, :binary_id, autogenerate: true}\n  schema \"weather\" do\n    field :city     # Defaults to type :string\n    field :temp_lo, :integer\n    field :temp_hi, :integer\n    field :prcp,    :float, default: 0.0\n  end\nend\n\ndefmodule Simple do\n  import Ecto.Query\n\n  def sample_query do\n    query = from w in Weather,\n          where: w.prcp \u003e 0 or is_nil(w.prcp),\n         select: w\n    Repo.all(query)\n  end\nend\n```\n\n# Caveats\n\n### RavenDB does not support integer ids\n\nIn RavenDB all the IDs are strings, so the :id type will generate a non-integer type\n\n### Aggregations on RavenDB are different\n\nIn RavenDB the aggregations use a [Map-Reduce index based aggregation](https://ravendb.net/learn/inside-ravendb-book/reader/4.0/11-mapreduce-and-aggregations-in-ravendb), \nwhich gets a bit annoying to deal using Ecto, so for now, you can only do aggregations using Ravix Directly. \n\n### Conflicts management\n\nRavenDB deals a bit different with [conflicts](https://www.google.com/search?q=RavenDB+conflicts\u0026oq=RavenDB+conflicts\u0026aqs=chrome..69i57.2870j0j4\u0026sourceid=chrome\u0026ie=UTF-8), so\nright now if you have a conflict, an exception will be raised. Ecto strategies are not supported yet.\n\n### Associations\n\nRavenDB is a Document-Database first, it does support a kind of [documents association](https://ravendb.net/docs/article-page/4.2/java/client-api/how-to/handle-document-relationships), \nbut i've not implemented it yet (mostly because i think relationships in documents sucks). You can however use embed schemas normally.\n\n### Migrations\n\nRavenDB is schemaless, so migrations are kind of useless. We can however use it to setup indexes and so on, but it's not implemented yet.\n\n# TODOs\n* Aggregations\n* Conflict Management\n* Associations\n# Contributors\n\n[mongodb_ecto](https://github.com/elixir-mongo/mongodb_ecto) - From who i shamelessly forked and adapted this driver, that saved me a lot of work : D\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYgorCastor%2Fravix-ecto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYgorCastor%2Fravix-ecto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYgorCastor%2Fravix-ecto/lists"}