Module that provides function for getting Arke and Unit structs. It also provides functions for encoding and decoding Units.
Summary
Functions
Function that decodes data into a Unit or list of Unit
Function that encodes a Unit or list of Unit
Function that returns a Struct that describes an Arke or a Unit
Types
Functions
@spec decode( project :: atom(), arke_id :: atom(), json :: %{key: String.t() | number() | boolean() | atom()}, format :: atom() ) :: Arke.Core.Unit.t()
Function that decodes data into a Unit or list of Unit
Parameters
- project => :atom => identify the
Arke.Core.Project arke_id => atom | string => arke id
- json => %{key: value} => json data that we want to decode
- type => :json => data input type
Example
iex> StructManager.decode(:arke, my_json_data, :json)
@spec encode(unit :: Arke.Core.Unit.t(), format :: atom()) :: %{ key: String.t() | number() | boolean() | atom() }
Function that encodes a Unit or list of Unit
Parameters
unit => [%{arke_struct}] | %{arke_struct} => unit or list of units that we want to encode
- type => :json => desired encode type
Example
iex> units = QueryManager.filter_by(arke_id: id)
...> StructManager.encode(units, type: :json)
Function that returns a Struct that describes an Arke or a Unit
Parameters
unit => %Unit{} | %Arke{} => unit or arke struct
Example
iex> arke = ArkeManager.get(:test, :default)
...> StructManager.get_struct(arke)