ApiCommons.Utils (ApiCommons v0.1.0)
View Source
Utils useable for parameter checks.
Cast value of a paramter to a specific type.
If value already of specified type, just return the value
## Parameter
- value (any) The value to parse
- type (atom) One of following values [:id, :integer, :float, ...]. Representing the type to parse to
## Returns
- The casted value or an error code {error_type, code}
## Examples
Check wether field should be excluded for further processing.
## Parameter
- field_name (atom) The field name to check against
- atom_list (list(atom)|atom) A list of fields or a single value to exclude.
## Returns
## Examples
Check if the passed value is of the schema type.
## Parameter
- field_value (any) Any value to check against
- type (Ecto.Type) Field type primitives to check for
Cast value of a paramter to a specific type.
If value already of specified type, just return the value
## Parameter
- value (any) The value to parse
- type (atom) One of following values [:id, :integer, :float, ...]. Representing the type to parse to
## Returns
- The casted value or an error code {error_type, code}
## Examples
Check wether field should be excluded for further processing.
## Parameter
- field_name (atom) The field name to check against
- atom_list (list(atom)|atom) A list of fields or a single value to exclude.
## Returns
## Examples
Check if the passed value is of the schema type.
## Parameter
- field_value (any) Any value to check against
- type (Ecto.Type) Field type primitives to check for