Skip to content

anoskov/uuid5_ecto_type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UUID5 Ecto Type

UUID v5 type for Ecto.

Installation

If available in Hex, the package can be installed as:

  • Add uuid5 to your list of dependencies in mix.exs:
def deps do
  [{:uuid5, "~> 1.2"}]
end

Usage

  • Generate UUID5 string based on DNS
iex(1)> UUID5.generate
"96bcc916-6bbc-5f61-8d88-bd83ed4b0b17"
  • Generate UUID5 string based on DNS without dashes
iex(1)> UUID5.generate(:hex)
"96bcc9166bbc5f618d88bd83ed4b0b17"
  • Set UUID5 type for field in your model
defmodule Project.User do
  use Project.Web, :model

  schema "users" do
    field :uuid_field, UUID5
  end
end

About

UUID v5 type for Ecto

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages