Sovite.Core.Repo.Tables.Aliases (sovite v0.2.0)

Copy Markdown View Source

Aliases stored in Sovite's database, managed with sovitectl alias.

As a Sovite.Core.Lookup table, a lookup returns the destinations of an enabled alias, joined with ", ".

Summary

Functions

Adds destinations to the alias for address, creating the alias if needed. Returns the alias with its destinations.

Deletes the alias for address and its destinations.

Lists all aliases, by address, with their destinations.

Removes one destination from the alias for address.

Enables or disables an alias.

Functions

add(repo, address, destinations)

@spec add(Sovite.Core.Repo.t(), String.t(), [String.t(), ...]) ::
  {:ok, Sovite.Core.Repo.Schemas.Alias.t()} | {:error, Ecto.Changeset.t()}

Adds destinations to the alias for address, creating the alias if needed. Returns the alias with its destinations.

delete(repo, address)

@spec delete(Sovite.Core.Repo.t(), String.t()) :: :ok | {:error, :not_found}

Deletes the alias for address and its destinations.

list(repo)

Lists all aliases, by address, with their destinations.

remove_destination(repo, address, destination)

@spec remove_destination(Sovite.Core.Repo.t(), String.t(), String.t()) ::
  :ok | {:error, :not_found}

Removes one destination from the alias for address.

set_enabled(repo, address, enabled)

@spec set_enabled(Sovite.Core.Repo.t(), String.t(), boolean()) ::
  {:ok, Sovite.Core.Repo.Schemas.Alias.t()}
  | {:error, :not_found | Ecto.Changeset.t()}

Enables or disables an alias.