Description
In this course, you will :
- Learn how to use Ecto to connect your Elixir applications to relational databases.
- Master the core modules of Ecto.
- Learn how to write concurrent tests to speed up your test suite.
- Discover how to use nested associations to manage complex table relationships.
- Learn how to use streams to easily handle large result sets.
Syllabus :
1. Get Started with Repo
- Ecto and ElixirCharacteristics of Ecto
- Ecto Modules
- Set Up the Sample Application
- Running the Examples
- Data Model of the Sample Application
- The Repository Pattern
- The Repo Module
- Put Our Repo to WorkGet Values Back
- Execute QueriesCustomize Your Repo
2. Query Your Database
- Introduction to the Query ModuleQuery Basics
- Refine Our Results with the Where Expression
- Protect Against SQL Injection
- Dynamic Values and Their TypesQuery BindingsInsert Raw SQL
- Combine Results with union and union_all Options
- Order and GroupWork With Joins
- Why Use the Composing Queries
- Named Bindings
- Compose Queries with Functions
- Combine Queries with or_where
- Other Ways to Use Queries
3. Connect Tables to Elixir Structs with Schemas
- Introduction to Schemas
- Create Schemas
- How to Write Queries with Schemas
- Insert with SchemasDelete with SchemasAdd Associations to Schemas
- Many-to-Many Associations
- Work with Associations in Queries
- Optimize Associations With Embedded Schemas
- Delete Records With Associations
- Use Schemas to Seed a Database
4. Make Changes with Changesets
- Introduction to Changesets
- Cast and FilterValidate Your DataWork with Constraints
- Capture ErrorsUse Changesets Without Schemas
- Work with Associations
- Associations Using Internal Data
- Associations Using External Data
- Update Records with Associations
- Best Practices for Associations
5. Make Multiple Changes with Transactions and the Multi Module
- Introduction to Transactions and the Multi ModuleRun Transactions with FunctionsForce a Rollback Within a Transaction
- Execute Non-Database Operations Within a Transaction
- Drawbacks of Using Functions
- Run Transactions and Capturing Errors with Ecto.Multi
- Optimize Multi with Changesets
- Execute Non-Database Operations with Multi
6. Make Changes to the Database
- What are Migrations?
- Your First MigrationRun MigrationsAdd Indexes
- Change Data and Table Structure Simultaneously
- Specify Up and Down OperationsChange Default BehaviorsChange Timestamps
- Run Migrations Outside of a Transaction
7. Part II: Ecto Applied
- Overview of Part II
8. Add Ecto to an Elixir Application Without Phoenix
- Ecto in Elixir Applications: An Introduction
- Create a New Project
- Create Your Repo Module
- Add Ecto to the Supervision Tree
- Use Multiple Ecto Repos
- Start Your AppWrapping Up: Add Ecto to an Elixir Application Without Phoenix
9. Work with Changesets and Phoenix Forms
- Ecto and Phoenix Forms: An Introduction
- Generate a Form for a Single Schema
- Display Changeset Errors
- Create a Form with an Association
- Create a Form with Multiple Associations
10. Test with Sandboxes
- Introduction to Sandboxes
- Set Up an Async Test
- Change the Ownership Mode
- Safely Share Connections with Allowances
11. Create and Use Custom Types
- Introduction to Custom Types in Ecto
- Building on Top of Ecto’s Types
- Adding Custom Types Without the Built-In Types
12. Inserting and Updating with Upserts
- Introduction to Upserts
- Perform Upserts Without Schemas
- Perform Upserts with Schemas
13. Optimizeing Your Application Design
- Introduction to Optimized Application Design
- Separate the Pure Code from the Impure Code
- Work with Context
- Work with Umbrella Applications
14. Work with Embedded Schemas
- Introduction to Embedded Schemas
- Create Embedded Schemas
- Make Changes
- Choose Between Embedded Schemas and Associations
15. Creating Polymorphic Associations
- Introduction to Polymorphic Associations
- Polymorphism in Other Frameworks
- Approach #1: Multiple Foreign Keys
- Approach #2: Use an Abstract Schema
- Approach #3: Use many_to_many
16. Optimize IEx for Ecto
- Introduction to Optimizing IEx for Ecto
- Add Imports and Aliases
- Add Helper Functions
17. Use Schemas Without Tables
- Introduction to Schemas Without Tables
- Schemas and Tables
- Create Table-less Schemas
- Save the Table-less Structs
18. Tune for Performance
- Introduction to Performance Tuning
- OptimizationExecute Bulk Operations
- Fetch Large Datasets With Streams