Versioning.Adapter behaviour (Versioning v0.4.1) View Source

Defines a versioning adapter.

A versioning adapter is used to parse and compare versions. This allows versions to be defined in a variety of ways - from semantic, to date based.

Link to this section Summary

Callbacks

Callback invoked to compare versions.

Callback invoked to parse a binary version.

Link to this section Types

Link to this section Callbacks

Link to this callback

compare(version, version)

View Source

Specs

compare(version :: term(), version :: term()) :: :gt | :lt | :eq | :error

Callback invoked to compare versions.

Returns :gt if the first verison is greater than the second, and :lt for vice-versa. If the two versions are equal, :eq is returned.

Specs

parse(version :: term()) :: {:ok, term()} | :error

Callback invoked to parse a binary version.

Returns {:ok, term} on success, where term will be the adapters representation of a version. Returns :error if the version cannot be parsed.