exfile v0.3.6 Exfile.Ecto.FileTemplate View Source

A module to help you define an Ecto.Type backed by a custom backend.

Example:

defmodule MyApp.User.ProfilePicture do
  use Exfile.Ecto.File,
    backend: "profile_pictures",
    cache_backend: "cache"
end
defmodule MyApp.User do
  use Ecto.Schema

  schema "users" do
    field :profile_picture, MyApp.User.ProfilePicture
  end
end

This will store any files assigned to the profile_picture field of MyApp.User in the cache backend.