mirror of
https://github.com/sloanelybutsurely/typeid-elixir.git
synced 2025-05-21 12:32:54 -04:00
expand documention for ecto usage
This commit is contained in:
parent
9db8183417
commit
6158128e61
1 changed files with 16 additions and 0 deletions
16
README.md
16
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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue