-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Яков Сергеев
committed
Nov 27, 2024
1 parent
735c731
commit 5d6660e
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
defmodule Waffle.StorageBehavior do | ||
@moduledoc """ | ||
Defines the behavior for file storage in Waffle. | ||
## Callbacks | ||
- `put/3`: Saves a file and returns the file name or an error. | ||
- `url/3`: Generates a URL for accessing a file. | ||
- `delete/3`: Deletes a file and returns the result of the operation. | ||
""" | ||
|
||
@callback put(definition :: atom, version :: atom, file_and_scope :: {Waffle.File.t(), any}) :: | ||
{:ok, file_name :: String.t()} | {:error, reason :: any} | ||
|
||
@callback url(definition :: atom, version :: atom, file_and_scope :: {Waffle.File.t(), any}) :: | ||
String.t() | ||
|
||
@callback delete(definition :: atom, version :: atom, file_and_scope :: {Waffle.File.t(), any}) :: | ||
atom | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters