mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
docs: Format default options for special attributes as code, in Ash.Resource DSL (#1336)
This commit is contained in:
parent
516ff8ef8e
commit
912fcf99de
2 changed files with 46 additions and 26 deletions
|
@ -120,11 +120,13 @@ Declares a non-writable attribute with a create default of `&DateTime.utc_now/0`
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
default &DateTime.utc_now/0
|
default &DateTime.utc_now/0
|
||||||
match_other_defaults? true
|
match_other_defaults? true
|
||||||
type Ash.Type.UTCDatetimeUsec
|
type Ash.Type.UTCDatetimeUsec
|
||||||
allow_nil? false
|
allow_nil? false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,12 +164,14 @@ Declares a non-writable attribute with a create and update default of `&DateTime
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
default &DateTime.utc_now/0
|
default &DateTime.utc_now/0
|
||||||
match_other_defaults? true
|
match_other_defaults? true
|
||||||
update_default &DateTime.utc_now/0
|
update_default &DateTime.utc_now/0
|
||||||
type Ash.Type.UTCDatetimeUsec
|
type Ash.Type.UTCDatetimeUsec
|
||||||
allow_nil? false
|
allow_nil? false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,11 +211,13 @@ Generated integer primary keys must be supported by the data layer.
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
public? true
|
public? true
|
||||||
writable? false
|
writable? false
|
||||||
primary_key? true
|
primary_key? true
|
||||||
generated? true
|
generated? true
|
||||||
type :integer
|
type :integer
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,11 +255,13 @@ Declares a non writable, non-nil, primary key column of type `uuid`, which defau
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
public? true
|
public? true
|
||||||
default &Ash.UUID.generate/0
|
default &Ash.UUID.generate/0
|
||||||
primary_key? true
|
primary_key? true
|
||||||
type :uuid
|
type :uuid
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,11 +299,13 @@ Declares a non writable, non-nil, primary key column of type `uuid_v7`, which de
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
public? true
|
public? true
|
||||||
default &Ash.UUIDv7.generate/0
|
default &Ash.UUIDv7.generate/0
|
||||||
primary_key? true
|
primary_key? true
|
||||||
type :uuid_v7
|
type :uuid_v7
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,13 @@ defmodule Ash.Resource.Dsl do
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
default &DateTime.utc_now/0
|
default &DateTime.utc_now/0
|
||||||
match_other_defaults? true
|
match_other_defaults? true
|
||||||
type Ash.Type.UTCDatetimeUsec
|
type Ash.Type.UTCDatetimeUsec
|
||||||
allow_nil? false
|
allow_nil? false
|
||||||
|
```
|
||||||
""",
|
""",
|
||||||
examples: [
|
examples: [
|
||||||
"create_timestamp :inserted_at"
|
"create_timestamp :inserted_at"
|
||||||
|
@ -78,12 +80,14 @@ defmodule Ash.Resource.Dsl do
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
default &DateTime.utc_now/0
|
default &DateTime.utc_now/0
|
||||||
match_other_defaults? true
|
match_other_defaults? true
|
||||||
update_default &DateTime.utc_now/0
|
update_default &DateTime.utc_now/0
|
||||||
type Ash.Type.UTCDatetimeUsec
|
type Ash.Type.UTCDatetimeUsec
|
||||||
allow_nil? false
|
allow_nil? false
|
||||||
|
```
|
||||||
""",
|
""",
|
||||||
examples: [
|
examples: [
|
||||||
"update_timestamp :updated_at"
|
"update_timestamp :updated_at"
|
||||||
|
@ -104,11 +108,13 @@ defmodule Ash.Resource.Dsl do
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
public? true
|
public? true
|
||||||
writable? false
|
writable? false
|
||||||
primary_key? true
|
primary_key? true
|
||||||
generated? true
|
generated? true
|
||||||
type :integer
|
type :integer
|
||||||
|
```
|
||||||
""",
|
""",
|
||||||
examples: [
|
examples: [
|
||||||
"integer_primary_key :id"
|
"integer_primary_key :id"
|
||||||
|
@ -128,11 +134,13 @@ defmodule Ash.Resource.Dsl do
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
public? true
|
public? true
|
||||||
default &Ash.UUID.generate/0
|
default &Ash.UUID.generate/0
|
||||||
primary_key? true
|
primary_key? true
|
||||||
type :uuid
|
type :uuid
|
||||||
|
```
|
||||||
""",
|
""",
|
||||||
examples: [
|
examples: [
|
||||||
"uuid_primary_key :id"
|
"uuid_primary_key :id"
|
||||||
|
@ -152,11 +160,13 @@ defmodule Ash.Resource.Dsl do
|
||||||
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
Accepts all the same options as `d:Ash.Resource.Dsl.attributes.attribute`, except for `allow_nil?`, but it sets
|
||||||
the following different defaults:
|
the following different defaults:
|
||||||
|
|
||||||
|
```elixir
|
||||||
writable? false
|
writable? false
|
||||||
public? true
|
public? true
|
||||||
default &Ash.UUIDv7.generate/0
|
default &Ash.UUIDv7.generate/0
|
||||||
primary_key? true
|
primary_key? true
|
||||||
type :uuid_v7
|
type :uuid_v7
|
||||||
|
```
|
||||||
""",
|
""",
|
||||||
examples: [
|
examples: [
|
||||||
"uuid_v7_primary_key :id"
|
"uuid_v7_primary_key :id"
|
||||||
|
|
Loading…
Reference in a new issue