View Source OnePiece.Commanded.Helpers (OnePiece.Commanded v0.10.1)

A Swiss Army Knife Helper Module.

Link to this section Summary

Functions

Copy the information from the source map into the given target map.

generate_uuid() deprecated

Deprecated, it has the same behavior as OnePiece.Commanded.Id.new/0.

Transforms the given source map or struct into the target struct.

Link to this section Functions

Link to this function

cast_to(target, source, keys)

View Source
@spec cast_to(target :: map(), source :: map(), keys :: [Map.key()]) :: map()

Copy the information from the source map into the given target map.

iex> OnePiece.Commanded.Helpers.cast_to(%{}, %{name: "ubi-wan", last_name: "kenobi"}, [:last_name])
%{last_name: "kenobi"}
This function is deprecated. Use `OnePiece.Commanded.Id.new/0` instead..
@spec generate_uuid() :: String.t()

Deprecated, it has the same behavior as OnePiece.Commanded.Id.new/0.

Link to this function

struct_from(source, target)

View Source
@spec struct_from(source :: struct(), target :: struct()) :: struct()
@spec struct_from(attrs :: map(), target :: module()) :: struct()

Transforms the given source map or struct into the target struct.