EctoResource (ecto_resource v1.3.1)

This module provides a DSL to easily generate the basic functions for a schema. This allows the context to focus on interesting, atypical implementations rather than the redundent, drifting CRUD functions.

Link to this section Summary

Functions

Macro to define CRUD methods for the given Ecto.Repo in the using module.

Macro to define schema access within a given Ecto.Repo

Link to this section Functions

Link to this macro

__using__(_)

(macro)

Macro to import EctoResource.using_repo/2

Examples

use EctoResource
Link to this macro

resource(schema, options \\ [])

(macro)

Macro to define CRUD methods for the given Ecto.Repo in the using module.

Examples

using(Repo) do
  resource(Schema)
end

using(Repo) do
  resource(Schema, suffix: false)
end

using(Repo) do
  resource(Schema, only: [:get])
end

using(Repo) do
  resource(Schema, except: [:delete])
end

using(Repo) do
  resource(Schema, :read)
end

using(Repo) do
  resource(Schema, :write)
end

using(Repo) do
  resource(Schema, :delete)
end
Link to this macro

using_repo(repo, list)

(macro)

Macro to define schema access within a given Ecto.Repo

Examples

using_repo(Repo) do
  resource(Schema)
end