docs: add short type references

This commit is contained in:
Zach Daniel 2020-07-01 09:37:42 -04:00
parent e90d509ccb
commit 2c6ed51661
No known key found for this signature in database
GPG key ID: C377365383138D4B

View file

@ -15,6 +15,16 @@ defmodule Ash.Type do
]
]
@short_names [
term: Ash.Type.Term,
string: Ash.Type.String,
integer: Ash.Type.Integer,
boolean: Ash.Type.Boolean,
uuid: Ash.Type.UUID,
date: Ash.Type.Date,
utc_datetime: Ash.Type.UtcDatetime
]
@doc_list_constraints Keyword.put(@list_constraints, :items,
type: :any,
doc:
@ -28,6 +38,14 @@ defmodule Ash.Type do
Much better to `use Ash.Type` than to say `@behaviour Ash.Type` and define
everything yourself.
## Built in types
#{
Enum.map_join(@short_names, fn {key, module} ->
"* `#{inspect(key)}` - `#{inspect(module)}`\n"
end)
}
### Composite Types
Currently, the only composite type supported is a list type, specified via:
@ -45,16 +63,6 @@ defmodule Ash.Type do
@callback apply_constraints(term, constraints()) :: :ok | {:error, String.t() | [String.t()]}
@callback equal?(term, term) :: boolean
@short_names [
term: Ash.Type.Term,
string: Ash.Type.String,
integer: Ash.Type.Integer,
boolean: Ash.Type.Boolean,
uuid: Ash.Type.UUID,
date: Ash.Type.Date,
utc_datetime: Ash.Type.UtcDatetime
]
@type t :: atom | {:array, atom}
@doc false