mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
improvement: add context
option to bulk_create
This commit is contained in:
parent
c571625557
commit
9f97569dce
2 changed files with 6 additions and 1 deletions
|
@ -125,6 +125,7 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
})
|
||||
|> Ash.Actions.Helpers.add_context(opts)
|
||||
|> Ash.Changeset.set_context(%{bulk_create: %{index: index}})
|
||||
|> Ash.Changeset.set_context(opts[:context] || %{})
|
||||
|> Ash.Changeset.prepare_changeset_for_action(action, opts, input)
|
||||
|> Ash.Changeset.run_before_transaction_hooks()
|
||||
end)
|
||||
|
|
|
@ -381,7 +381,11 @@ defmodule Ash.Api do
|
|||
type: :atom,
|
||||
doc:
|
||||
"The identity to use when detecting conflicts for `upsert?`, e.g. `upsert_identity: :full_name`. By default, the primary key is used. Has no effect if `upsert?: true` is not provided"
|
||||
],
|
||||
,
|
||||
context: %{
|
||||
type: :map,
|
||||
doc: "Context to set on each changeset"
|
||||
},
|
||||
upsert_fields: [
|
||||
type: {:list, :atom},
|
||||
doc:
|
||||
|
|
Loading…
Reference in a new issue