{"id":20585391,"url":"https://github.com/elielhaouzi/shortcode","last_synced_at":"2025-04-14T21:08:31.960Z","repository":{"id":49902864,"uuid":"295772583","full_name":"elielhaouzi/shortcode","owner":"elielhaouzi","description":"An Ecto type for UUIDs and ID displayed as shortcode with support of prefix 'à la Stripe'.","archived":false,"fork":false,"pushed_at":"2021-06-10T08:57:01.000Z","size":33,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T21:08:04.489Z","etag":null,"topics":["ecto","elixir","shortcode","uuid"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/elielhaouzi.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}},"created_at":"2020-09-15T15:35:48.000Z","updated_at":"2023-06-21T09:07:13.000Z","dependencies_parsed_at":"2022-09-26T18:40:58.999Z","dependency_job_id":null,"html_url":"https://github.com/elielhaouzi/shortcode","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elielhaouzi%2Fshortcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elielhaouzi%2Fshortcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elielhaouzi%2Fshortcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elielhaouzi%2Fshortcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elielhaouzi","download_url":"https://codeload.github.com/elielhaouzi/shortcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961237,"owners_count":21189993,"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":["ecto","elixir","shortcode","uuid"],"created_at":"2024-11-16T07:07:54.742Z","updated_at":"2025-04-14T21:08:31.915Z","avatar_url":"https://github.com/elielhaouzi.png","language":"Elixir","readme":"# Shortcode\n\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/elielhaouzi/shortcode/CI?cacheSeconds=3600\u0026style=flat-square)](https://github.com/elielhaouzi/shortcode/actions) [![GitHub issues](https://img.shields.io/github/issues-raw/elielhaouzi/shortcode?style=flat-square\u0026cacheSeconds=3600)](https://github.com/elielhaouzi/shortcode/issues) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?cacheSeconds=3600?style=flat-square)](http://opensource.org/licenses/MIT) [![Hex.pm](https://img.shields.io/hexpm/v/shortcode?style=flat-square)](https://hex.pm/packages/shortcode) [![Hex.pm](https://img.shields.io/hexpm/dt/shortcode?style=flat-square)](https://hex.pm/packages/shortcode)\n\nAn Ecto type for UUIDs and ID displayed as shortcode with support of prefix 'à la Stripe'.\n\n## Installation\n\nShortcode is published on [Hex](https://hex.pm/packages/shortcode). The package can be installed\nby adding `shortcode` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:shortcode, \"~\u003e 0.7.0\"}\n  ]\nend\n```\n\nThe docs can be found at [https://hexdocs.pm/shortcode](https://hexdocs.pm/shortcode).\n\n## Usage\n\nYou can use Shortcode UUID or Shortcode id for regular or primary key fields.\n\n```elixir\ndefmodule MyApp.UserWithUUID do\n  use Ecto.Schema\n\n  @primary_key {:id, Shortcode.Ecto.UUID, prefix: \"usr\", autogenerate: true}\n  schema \"users\" do\n  end\nend\n\ndefmodule MyApp.UserWithID do\n  use Ecto.Schema\n\n  @primary_key {:id, Shortcode.Ecto.ID, prefix: \"usr\", autogenerate: true}\n  schema \"users\" do\n  end\nend\n```\n\n```elixir\ndefmodule RequestUUID do\n  use Ecto.Schema\n\n  schema \"request\" do\n    field :uuid, Shortcode.Ecto.UUID\n    field :uuid_with_prefix, Shortcode.Ecto.UUID, prefix: \"req\"\n    field :autogenerated_uuid, Shortcode.Ecto.UUID, autogenerate: true\n    field :autogenerated_uuid_with_prefix, Shortcode.Ecto.UUID, autogenerate: true, prefix: \"req\"\n  end\nend\n\ndefmodule RequestID do\n  use Ecto.Schema\n\n  schema \"request\" do\n    field :request_id, Shortcode.Ecto.ID\n    field :request_id_with_prefix, Shortcode.Ecto.ID, prefix: \"req\"\n    field :autogenerated_request_id, Shortcode.Ecto.UUID, autogenerate: true\n    field :autogenerated_request_id_with_prefix, Shortcode.Ecto.UUID, autogenerate: true, prefix: \"req\"\n  end\nend\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felielhaouzi%2Fshortcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felielhaouzi%2Fshortcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felielhaouzi%2Fshortcode/lists"}