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

Ecto item pipeline configuration #70

Closed
ghost opened this issue Mar 27, 2020 · 2 comments
Closed

Ecto item pipeline configuration #70

ghost opened this issue Mar 27, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2020

I have a problem with build the custom Ecto pipeline.
https://hexdocs.pm/crawly/basic_concepts.html#custom-item-pipelines

If I get it right, I need to define the pipeline module in my config.exs file topipelines:[]section?
Also I miss understanding that does mean this part MyApp.insert_with_ecto(item) ? Do you mean Repo.insert here or what?
Can you please describe in more detail how should I connect it?

P.S. I apologize if the questions seemed stupid, but I still do not understand how this works. I will be thrilled when I figure it out. Ecto is a missed puzzle for my crawly projects.

@Ziinc
Copy link
Collaborator

Ziinc commented Mar 27, 2020

For example, if you're combining it with an existing elixir app, your app would probably be organize by contexts. This insert_with_ecto function would then be a function within your app context. Your context would then do the changeset validation and perform the insert.

You could do a direct Repo.insert, depends on your integration context.

Are you trying to integrate into an existing app, or to create a standalone crawler with its own ecto repo? Either way, the contexts organisation would still be the same

@ghost
Copy link
Author

ghost commented Mar 28, 2020

@Ziinc Thanks all works perfectly. It is was pretty simple :)

In the documentation, the Ecto example part, as I think, lacks one piece. It is too necessary to update the pipelines in the crawly.config file.

@ghost ghost closed this as completed Mar 28, 2020
This issue was closed.
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

1 participant