From 6158128e6166045405311f787ab4334cee2be32e Mon Sep 17 00:00:00 2001 From: Sloane Perrault <sloane@perrault.email> Date: Sun, 16 Jul 2023 10:26:59 -0400 Subject: [PATCH] expand documention for ecto usage --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 1edf43e..432c812 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,23 @@ defmodule MyApp.Accounts.User do use Ecto.Schema @primary_key {:id, TypeID, autogenerate: true, prefix: "acct", type: :binary_id} + @foreign_key_type TypeID # ... end ``` + +### Underlying types + +`TypeID`s can be stored as either `:string` or `:binary_id`. `:string` will +store the entire TypeID including the prefix. `:binary_id` stores only the +UUID portion and requires a `:uuid` or `:binary` column. + +#### Default type + +The type used can be set globally in the application config. + +```elixir +config :typeid_elixir, + default_type: :binary_id +```