View Source EctoTemp (ecto_temp v0.1.1)

Provides deftemptable/2 and deftemptable/3 macros, and helper functions, for using Postgres temporary tables.

examples

Examples

defmodule MyTest do
  use MyProject.DataCase
  use EctoTemp, repo: MyProject.Repo

  require EctoTemp.Factory
  alias EctoTemp.Factory

  deftemptable :things do
    column :data, :string, null: false
    column :data_with_default, :string, default: "default value"
    deftimestamps()
  end

  setup do
    create_temp_tables()
    :ok
  end

  test "insert records" do
    Factory.insert(:things, data: "stuff")
  end
end

Link to this section Summary

Functions

Imports EctoTemp into a module.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Imports EctoTemp into a module.

options

Options

  • :repo - required - the module defining your Ecto.Repo callbacks.