language_colours/lib/database.ex
2021-09-03 21:51:45 +03:00

20 lines
619 B
Elixir

defmodule LanguageColours.Database do
@moduledoc """
Behaviour that must be implemented by a database.
Each function gets a database configuration as argument. This configuration should be used to
talk to the correct database instance.
It is not necessary to deal with the fallback as the main module handles that.
"""
@doc """
Get a colour for the given language, or `nil`.
"""
@callback get(language :: String.t(), db_config :: map()) :: LanguageColours.Colour.t() | nil
@doc """
Update the language dataset using the configuration.
"""
@callback update(db_config :: map()) :: :ok
end