rom icon indicating copy to clipboard operation
rom copied to clipboard

Pass command options to changeset

Open qortex opened this issue 4 years ago • 1 comments

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 avatar Apr 06 '20 14:04 qortex

Note: Following a discussion on zulip with @solnic https://rom-rb.zulipchat.com/#narrow/stream/191800-general/topic/rom-sql/near/193048419

qortex avatar Apr 06 '20 15:04 qortex