mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-21 05:53:18 +12:00
4a02d8c6ad
* improvement: custom-extension implementation * improvement: allow adding custom-extension by module's reference and fixes formatting * ci: fixes formatter
20 lines
548 B
Elixir
20 lines
548 B
Elixir
defmodule AshPostgres.CustomExtension do
|
|
@moduledoc """
|
|
A custom extension implementation.
|
|
"""
|
|
|
|
@callback install(version :: integer) :: String.t()
|
|
|
|
@callback uninstall(version :: integer) :: String.t()
|
|
|
|
defmacro __using__(name: name, latest_version: latest_version) do
|
|
quote do
|
|
@behaviour AshPostgres.CustomExtension
|
|
|
|
@extension_name unquote(name)
|
|
@extension_latest_version unquote(latest_version)
|
|
|
|
def extension, do: {@extension_name, @extension_latest_version, &install/1, &uninstall/1}
|
|
end
|
|
end
|
|
end
|