Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the usage of multi. #44

Open
suzdalnitski opened this issue Aug 19, 2022 · 2 comments
Open

Document the usage of multi. #44

suzdalnitski opened this issue Aug 19, 2022 · 2 comments

Comments

@suzdalnitski
Copy link

suzdalnitski commented Aug 19, 2022

It's not immediately clear what the multi passed to the projection function actually does:

project (%MyEvent{}, _, fn multi -> ... end)

How does using this multi differ from returning a new Ecto.Multi?

project (%MyEvent{}, _, fn -> Ecto.Multi.new() ... end)

Does the multi passed to the projection function already contain some other operations? Does it group some other operations together with the projection?

Thanks!

@yordis
Copy link
Contributor

yordis commented Sep 2, 2022

Does the multi passed to the projection function already contain some other operations?

Yes

|> Ecto.Multi.run(:verify_projection_version, fn repo, _changes ->

|> Ecto.Multi.update(:projection_version, changeset, prefix: prefix)

Does it group some other operations together with the projection?

Yes

|> Ecto.Multi.run(:verify_projection_version, fn repo, _changes ->

|> Ecto.Multi.update(:projection_version, changeset, prefix: prefix)

How does using this multi differ from returning a new Ecto.Multi?

No differences. That multi is an Ecto.Multi

@yordis
Copy link
Contributor

yordis commented Sep 4, 2022

@suzdalnitski do you mind creating a PR tackling your concern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants