Pantrypoints Pantrypoints

Overview

August 22, 2023 1 minutes  • 60 words
Table of contents

Ecto

Handles external data such as databases and JSON APIs

  • Repo
  • Query
  • Schema
  • Changset

Repo: communicates with external data source or database

Has common methods:

  • get(): gets the record
  • insert(): creates the record in that database
  • update()
  • delete()
  • transaction() …

Phoenix uses Repo through:

  • config.exs as config :appname, Appname.Repo,
  • repo.ex in /lib/appname/repo.ex

Common methods

Repo.count()
Repo.update_all("tablename", set: [updated_at: Ecto.DateTime.utc])
Follow Us! →

We're creating a new Economic System from a new Economic Science! Please support us by leaving your email or leaving a comment above.