MapSchema.DefaultTypes.MSchemaStringToFloat (map_schema v0.2.2) View Source

StringToFloat type

Link to this section Summary

Functions

Callback implementation for MapSchema.CustomType.cast/1.

Using is_float guard -> 1. Will be execute cast(value)

Callback implementation for MapSchema.CustomType.name/0.

Callback implementation for MapSchema.CustomType.nested?/0.

Link to this section Functions

Specs

cast(any()) :: any()

Callback implementation for MapSchema.CustomType.cast/1.

Specs

doctest_values() :: [{any(), any()}]

Callback implementation for MapSchema.CustomType.doctest_values/0.

Specs

is_valid?(any()) :: boolean()

Using is_float guard -> 1. Will be execute cast(value)

Examples

iex> alias MapSchema.DefaultTypes.MSchemaStringToFloat
iex> MSchemaStringToFloat.cast("102.332")
iex> |> MSchemaStringToFloat.is_valid?()
true

iex> alias MapSchema.DefaultTypes.MSchemaStringToFloat
iex> MSchemaStringToFloat.cast("it´s a float")
iex> |> MSchemaStringToFloat.is_valid?()
false

Specs

name() :: atom()

Callback implementation for MapSchema.CustomType.name/0.

Callback implementation for MapSchema.CustomType.nested?/0.