Capsule v1.0.0 Capsule View Source

Core utilities for working with Capsule.Locator structs.

Link to this section Summary

Functions

Merges the given metadata into the locator's metadata. Accepts a keyword list or map. Keys are converted to strings. Existing keys are overwritten.

Convenience for add_metadata/2 with a single key-value pair. The key is converted to a string.

Returns the storage module for the given locator. Raises Capsule.Errors.InvalidStorage if the storage module cannot be resolved.

Link to this section Functions

Link to this function

add_metadata(locator, data)

View Source

Specs

add_metadata(Capsule.Locator.t(), keyword() | map()) :: Capsule.Locator.t()

Merges the given metadata into the locator's metadata. Accepts a keyword list or map. Keys are converted to strings. Existing keys are overwritten.

Link to this function

add_metadata(locator, key, val)

View Source

Specs

add_metadata(Capsule.Locator.t(), atom() | String.t(), any()) ::
  Capsule.Locator.t()

Convenience for add_metadata/2 with a single key-value pair. The key is converted to a string.

Specs

storage!(Capsule.Locator.t()) :: module()

Returns the storage module for the given locator. Raises Capsule.Errors.InvalidStorage if the storage module cannot be resolved.