GeoSQL.RepoUtils (GeoSQL v1.3.0)

View Source

Helpers for working with Ecto Repo modules.

Summary

Functions

Macro version of adapter_for/1 for use where a function is not usable or less ergonomic.

Returns an adapter for a given repo, with a sensible default on nil.

Functions

adapter(repo)

(macro)
@spec adapter(Ecto.Repo.t() | nil) :: module()

Macro version of adapter_for/1 for use where a function is not usable or less ergonomic.

adapter_for(repo)

@spec adapter_for(Ecto.Repo.t() | nil) :: module()

Returns an adapter for a given repo, with a sensible default on nil.

As the details of a given SQL call may differ from implementation to implentation, many of the functions in GeoSQL rely on examining the repo module to determine which variant to utilize.

This function provides a convenience to discover the backend adapter given a repo. If no adapter is provided, it defaults to the configured preference, ultimately falling back to PostgreSQL.

To configure the default, adapt this line in config.exs: config :geo_sql, default_adapter: Ecto.Adapters.<PreferredAdapter>