mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
docs: add short type references
This commit is contained in:
parent
e90d509ccb
commit
2c6ed51661
1 changed files with 18 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue