View Source Uploadex.Resolver (Uploadex v3.1.0)

Resolver functions to make it easier to use Uploadex with Absinthe.

Note that all functions in this module require the Uploader as an argument. You are free to call them like that:

Example

In your Absinthe schema, assuming user only has one photo:

object :user do
  field :photo_url, :string, resolve: Uploadex.Resolver.get_file_url(:photo, MyUploader)
end

If it has many photos:

object :user do
  field :photos, list_of(:string), resolve: Uploadex.Resolver.get_files_url(:photos, MyUploader)
end

However, by doing use Uploadex in your uploader, you can call these functions directly through the uploader to avoid having to pass this extra argument around:

Example

In your Absinthe schema, assuming user only has one photo:

object :user do
  field :photo_url, :string, resolve: MyUploader.get_file_url(:photo)
end

If it has many photos:

object :user do
  field :photos, list_of(:string), resolve: MyUploader.get_files_url(:photos)
end

Summary

Functions

Link to this function

get_file_url(field, uploader)

View Source
@spec get_file_url(atom(), Uploadex.Uploader.t()) ::
  (any(), any(), any() -> {:ok, any()})
Link to this function

get_files_url(field, uploader)

View Source
@spec get_files_url(atom(), Uploadex.Uploader.t()) ::
  (any(), any(), any() -> {:ok, [any()]})