ForgeAbi v1.6.1 ForgeAbi.Util.TypeUrl View Source
quick convertion among type, type_url and type_mod
Link to this section Summary
Functions
Add a type url or a list of type urls to the table
retrieve all types for introspection
Decode the binary inside the Any
Decode the binary inside the Any. Raise if error
Encode a struct and wrap it with Any
Encode a struct and wrap it with Any. Throw exception on error
Retrieve mod by type_url
Initialize the table with prepopulated data
Remove a type_url from the table
Link to this section Functions
add(items) View Source
Add a type url or a list of type urls to the table
add(type_url, mod) View Source
all()
View Source
all() :: Enumerable.t()
all() :: Enumerable.t()
retrieve all types for introspection.
decode_any(arg1)
View Source
decode_any(Google.Protobuf.Any.t() | nil) :: {:error, term()} | {:ok, any()}
decode_any(Google.Protobuf.Any.t() | nil) :: {:error, term()} | {:ok, any()}
Decode the binary inside the Any.
decode_any!(any)
View Source
decode_any!(Google.Protobuf.Any.t() | nil) :: any() | no_return()
decode_any!(Google.Protobuf.Any.t() | nil) :: any() | no_return()
Decode the binary inside the Any. Raise if error.
encode_any(data, type_url \\ nil)
View Source
encode_any(map(), String.t() | nil) ::
{:ok, Google.Protobuf.Any.t()} | {:error, term()}
encode_any(map(), String.t() | nil) :: {:ok, Google.Protobuf.Any.t()} | {:error, term()}
Encode a struct and wrap it with Any.
encode_any!(data, type_url \\ nil)
View Source
encode_any!(map(), String.t() | nil) :: Google.Protobuf.Any.t() | no_return()
encode_any!(map(), String.t() | nil) :: Google.Protobuf.Any.t() | no_return()
Encode a struct and wrap it with Any. Throw exception on error.
get(key) View Source
Retrieve mod by type_url
iex> ForgeAbi.Util.TypeUrl.add("fg:t:declare", ForgeAbi.DeclareTx) iex> ForgeAbi.Util.TypeUrl.get("fg:t:declare") ForgeAbi.DeclareTx
iex> ForgeAbi.Util.TypeUrl.add("fg:s:account", ForgeAbi.AccountState) iex> ForgeAbi.Util.TypeUrl.get("fg:s:account") ForgeAbi.AccountState
init()
View Source
init() :: :ok
init() :: :ok
Initialize the table with prepopulated data
remove(type_url)
View Source
remove(String.t()) :: :ok
remove(String.t()) :: :ok
Remove a type_url from the table