resx v0.1.2 Resx

Link to this section Summary

Types

An error

An error

Errors to do with the reference

Errors to do with the resource

Functions

Get the producer module for the given URI scheme

Shorthand for obtaining the reference

Link to this section Types

Link to this type error()
error() :: {:error, {:internal, reason :: term()}}

An error.

See error/1 for more information.

Link to this type error(type)
error(type) :: {:error, {:internal | type, reason :: term()}}

An error.

Any error type follows the format of { :error, { type, reason } } where type is the type of error and reason is additional supporting details.

  • :internal - There was an internal error when handling the request. This is for errors that are not due to user input and don't belong to any of the other specified error types.

Link to this type reference_error()
reference_error() :: :invalid_reference

Errors to do with the reference.

  • :invalid_reference - The reference structure is not valid. e.g. was malformed, reference of that structure is no longer supported, etc.

Link to this type resource_error()
resource_error() :: :unknown_resource

Errors to do with the resource.

  • :unknown_resource - The resource does not exist

Link to this type uri()
uri() :: String.t()

Link to this section Functions

Link to this function producer(uri)
producer(ref() | Resx.Resource.t()) :: module() | nil

Get the producer module for the given URI scheme.

By default the following URI schemes will be matched to these producers:

SchemeProducer
dataResx.Producers.Data
fileResx.Producers.File
resx-transformResx.Producers.Transform

Custom mappings can be provided (or overridden) by configuring the :producers key.

config :resx,
    producers: [
        MyDataProducer, # Add any scheme configuration from MyDataProducer
        { "file", nil }, # Overrides the default file scheme to have no producer
        { "custom", MyDataProducer } # Map a new URI scheme to MyDataProducer
    ]
Link to this function ref(reference)
ref(ref() | Resx.Resource.t()) :: ref()

Shorthand for obtaining the reference.