View Source Eakins.UseCases.Reflection behaviour (eakins v0.0.1)
Abstracting operations across our image storage types
Link to this section Summary
Callbacks
Creates a changeset that updates an image with the given key in the provided schema
Creates a changeset that deletes the image with the given key
Finds an image in an image container
Returns true if the image container has the image with the given key
Removes the given image from the underlying storage mechanism
Updates the image in the image container
Link to this section Types
@type container_name() :: String.t()
Link to this section Callbacks
@callback add_or_update_image(Eakins.Schema.t(), String.t(), Eakins.key(), any()) :: Ecto.Changeset.t()
Creates a changeset that updates an image with the given key in the provided schema
@callback delete_image(Eakins.Schema.t(), String.t(), Ecto.Changeset.t(), Image.key()) :: Ecto.Changeset.t()
Creates a changeset that deletes the image with the given key
@callback find_image(Eakins.Schema.t(), container_name(), Images.key()) :: Images.image() | nil
Finds an image in an image container
Returns true if the image container has the image with the given key
@callback remove_image_from_storage(Eakins.Schema.t(), String.t(), Images.image()) :: :ok | {:error, any()}
Removes the given image from the underlying storage mechanism
@callback update_image(Eakins.Schema.t(), String.t(), Ecto.Changeset.t(), Images.image()) :: Ecto.Changeset.t()
Updates the image in the image container
Link to this section Functions
add_or_update_image(schema, container_name, image_key, uploaded_image)
View Source@spec add_or_update_image(Eakins.Schema.t(), String.t(), Eakins.key(), any()) :: Ecto.Changeset.t()
@spec delete_image(Eakins.Schema.t(), String.t(), Ecto.Changeset.t(), Image.key()) :: Ecto.Changeset.t()
@spec find_image(Eakins.Schema.t(), String.t(), Images.key()) :: Images.image() | nil
@spec update_image(Eakins.Schema.t(), String.t(), Ecto.Changeset.t(), Images.image()) :: Ecto.Changeset.t()