ExCuid2.Ecto.Type (ex_cuid2 v0.10.1)

Ecto type for CUID2 values.

This allows you to use :cuid2 as a custom type in your Ecto schemas.

Usage

Add the following to your config.exs to register the type:

config :my_app, MyApp.Repo,
  ecto_types: [cuid2: ExCuid2.Ecto.Type]

Then in your schema:

field :id, :cuid2, autogenerate: true

Summary

Functions

Callback implementation for Ecto.Type.cast/1.

Callback implementation for Ecto.Type.dump/1.

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

Callback implementation for Ecto.Type.load/1.

Callback implementation for Ecto.Type.type/0.

Functions

autogenerate(length \\ 24)

cast(cuid)

Callback implementation for Ecto.Type.cast/1.

dump(data)

Callback implementation for Ecto.Type.dump/1.

embed_as(_)

Callback implementation for Ecto.Type.embed_as/1.

equal?(term1, term2)

Callback implementation for Ecto.Type.equal?/2.

load(data)

Callback implementation for Ecto.Type.load/1.

type()

Callback implementation for Ecto.Type.type/0.