smart_city_registry v3.2.0 SmartCity.Dataset.Metadata View Source

A struct defining internal metadata on a registry event message.

Link to this section Summary

Functions

Returns a new SmartCity.Dataset.Metadata struct. Can be created from Map with string or atom keys. Raises an ArgumentError when passed invalid input

Link to this section Types

Link to this type

t() View Source
t() :: %SmartCity.Dataset.Metadata{expectedBenefit: list(), intendedUse: list()}

Link to this section Functions

Returns a new SmartCity.Dataset.Metadata struct. Can be created from Map with string or atom keys. Raises an ArgumentError when passed invalid input.

Parameters

  • msg: Map with string or atom keys that defines the dataset's metadata.

Examples

iex> SmartCity.Dataset.Metadata.new(%{"intendedUse" => ["a","b","c"], "expectedBenefit" => [1,2,3]})
%SmartCity.Dataset.Metadata{
  expectedBenefit: [1, 2, 3],
  intendedUse: ["a", "b", "c"]
}

iex> SmartCity.Dataset.Metadata.new(%{:intendedUse => ["a","b","c"], :expectedBenefit => [1,2,3]})
%SmartCity.Dataset.Metadata{
  expectedBenefit: [1, 2, 3],
  intendedUse: ["a", "b", "c"]
}

iex> SmartCity.Dataset.Metadata.new("Not a map")
** (ArgumentError) Invalid internal metadata: "Not a map"