GeoGenius.Provider.Area.Name (geo_genius v0.2.0)

Copy Markdown View Source

One name a GeoGenius.Provider.Area carries.

kind is :official, :alias, :mailing, or :abbreviation -- an atom rather than a bare string, so a provider that misspells it fails to compile against Dialyzer rather than silently writing a name nothing queries for. That protection is armed only where a kind value flows into a spec'd boundary -- Dialyzer checks struct keys against a literal, not against @type t's field types on every construction -- which is why every provider's normalize/2 carries an explicit @spec.

GeoGenius.Catalog.put_area_name/5 binds attrs.kind straight into a SQL parameter. That bind expects a string, not an atom, so the normalization phase that turns a %GeoGenius.Provider.Area{} into Catalog writes stringifies kind on the way through: GeoGenius.Pipeline.Normalize is that seam, and an atom reaching the bind without it surfaces as a Postgrex encode error rather than a compile-time one.

Summary

Types

kind()

@type kind() :: :official | :alias | :mailing | :abbreviation

t()

@type t() :: %GeoGenius.Provider.Area.Name{
  kind: kind(),
  locale: String.t() | nil,
  name: String.t()
}