View Source Arke.StructManager (Arke v1.1.33)
Module that provides function for getting Arke and Unit structs. It also provides functions for encoding and decoding Units.
Link to this section 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
Link to this section Types
Link to this section 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
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
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
Parameters
unit => [%{arke_struct}] | %{arke_struct} => unit or list of units that we want to encode
- type => :json => desired encode type
example
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
Parameters
unit => %Unit{} | %Arke{} => unit or arke struct
example
Example
iex> arke = ArkeManager.get(:test, :default)
...> StructManager.get_struct(arke)