LanguageColours.Database behaviour (LanguageColours v1.1.0) View Source

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.

Link to this section Summary

Callbacks

Get a colour for the given language, or nil.

Update the language dataset using the configuration.

Link to this section Callbacks

Link to this callback

get(language, db_config)

View Source

Specs

get(language :: String.t(), db_config :: map()) ::
  LanguageColours.Colour.t() | nil

Get a colour for the given language, or nil.

Specs

update(db_config :: map()) :: :ok

Update the language dataset using the configuration.