Pass command options to changeset
qortex opened this issue · 1 comments
qortex commented
We could provide command options while constructing a changeset
object. For now, options are not passed down to the command
being built inside the changeset
.
Examples
When result
is supposed to be :many
instead of the default :one
value for the command:
rel.changeset(:delete, command_options: { result: :many } )
# or directly
rel.changeset(:delete, result: :many )
# or
rel.changeset(:delete).with_command_options(result: :many)
Right now, it is not possible with the current changeset implementation (arguments are considered data, see this file) so we have to circumvent:
c = rel.changeset(:delete)
c.command_options[:result] = :many
c.commit
qortex commented
Note: Following a discussion on zulip with @solnic
https://rom-rb.zulipchat.com/#narrow/stream/191800-general/topic/rom-sql/near/193048419