exfile v0.1.3 Exfile.Ecto.File

An Ecto.Type used to handle files persisted to the store backend.

Summary

Functions

Casts a recognizable value to an %Exfile.File{} and uploads it to the backend

Dumps an %Exfile.File{} struct to the file ID, suitable for storage in the database

Loads a file ID from the database and returns an %Exfile.File{} struct representing that file

The Ecto type

Functions

cast(file)

Casts a recognizable value to an %Exfile.File{} and uploads it to the backend.

Accepts three patterns:

  • Another %Exfile.File{}
  • An %Exfile.LocalFile{}
  • A %Plug.Upload{}
dump(file)

Dumps an %Exfile.File{} struct to the file ID, suitable for storage in the database.

load(file_id)

Loads a file ID from the database and returns an %Exfile.File{} struct representing that file.

type()

The Ecto type