docs: small docs tweaks, more modules

This commit is contained in:
Zach Daniel 2022-07-10 23:39:57 -04:00
parent b7a9cd33ac
commit 4d3c393342
2 changed files with 10 additions and 13 deletions

View file

@ -107,6 +107,9 @@ defmodule Ash.DocIndex.AshDocIndex do
Ash.Resource.Change.Builtins, Ash.Resource.Change.Builtins,
Ash.Resource.Validation, Ash.Resource.Validation,
Ash.Resource.Validation.Builtins, Ash.Resource.Validation.Builtins,
Ash.Resource.Preparation,
Ash.Resource.Preparation.Builtins,
Ash.Filter.TemplateHelpers,
Ash.Calculation, Ash.Calculation,
Ash.Resource.Calculation.Builtins, Ash.Resource.Calculation.Builtins,
Ash.CodeInterface, Ash.CodeInterface,

View file

@ -51,7 +51,7 @@ defmodule Ash.Resource.Dsl do
@timestamps %Ash.Dsl.Entity{ @timestamps %Ash.Dsl.Entity{
name: :timestamps, name: :timestamps,
describe: """ describe: """
Declares non-writable `inserted_at` and `updated_at` attributes whith create and update defaults of `&DateTime.utc_now/0`. Declares non-writable `inserted_at` and `updated_at` attributes with create and update defaults of `&DateTime.utc_now/0`.
""", """,
examples: [ examples: [
"timestamps()" "timestamps()"
@ -65,8 +65,9 @@ defmodule Ash.Resource.Dsl do
@integer_primary_key %Ash.Dsl.Entity{ @integer_primary_key %Ash.Dsl.Entity{
name: :integer_primary_key, name: :integer_primary_key,
describe: """ describe: """
Declares a generated (set by the data layer), non writable, non nil, primary key column of type integer. Declares a generated, non writable, non-nil, primary key column of type integer.
Using `integer_primary_key`, `allow_nil?` is automatically set to `false`.
Generated integer primary keys must be supported by the data layer.
""", """,
examples: [ examples: [
"integer_primary_key :id" "integer_primary_key :id"
@ -80,8 +81,7 @@ defmodule Ash.Resource.Dsl do
@uuid_primary_key %Ash.Dsl.Entity{ @uuid_primary_key %Ash.Dsl.Entity{
name: :uuid_primary_key, name: :uuid_primary_key,
describe: """ describe: """
Declares a non writable, non nil, primary key column of type uuid, which defaults to `Ash.UUID.generate/0`. Declares a non writable, non-nil, primary key column of type uuid, which defaults to `Ash.UUID.generate/0`.
Using `uuid_primary_key`, `allow_nil?` is automatically set to `false`.
""", """,
examples: [ examples: [
"uuid_primary_key :id" "uuid_primary_key :id"
@ -96,8 +96,6 @@ defmodule Ash.Resource.Dsl do
name: :attributes, name: :attributes,
describe: """ describe: """
A section for declaring attributes on the resource. A section for declaring attributes on the resource.
For more information, see {{link:ash:guide:Attributes}}
""", """,
links: [ links: [
guides: [ guides: [
@ -300,14 +298,10 @@ defmodule Ash.Resource.Dsl do
A change to be applied to the changeset after it is generated. They are run in order, from top to bottom. A change to be applied to the changeset after it is generated. They are run in order, from top to bottom.
To implement your own, see `Ash.Resource.Change`. To implement your own, see `Ash.Resource.Change`.
To use it, you can simply refer to the module and its options, like so: To use it, simply refer to the module and its options or just the module if there are no options, like so:
`change {MyChange, foo: 1}` `change {MyChange, foo: 1}`
`change MyChange`
But for readability, you may want to define a function elsewhere and import it,
so you can say something like:
`change my_change(1)`
For destroys, `changes` are not applied unless `soft?` is set to true. For destroys, `changes` are not applied unless `soft?` is set to true.
""", """,