Tyyppi.ExampleValue (tyyppi v0.6.0) View Source
Example of the structure defined with Tyyppi.Struct.defstruct/1
, all values be Tyyppi.Value
The original code of this module follows:
import Kernel, except: [defstruct: 1]
import Tyyppi.Struct, only: [defstruct: 1]
@defaults foo: Tyyppi.Value.atom(:ok), Tyyppi.Value.integer(42)
defstruct foo: Tyyppi.Value.t(), bar: Tyyppi.Value.t()
Link to this section Summary
Functions
Returns the field types of this struct as keyword of
{field :: atom, type :: Tyyppi.T.t()}
pairs.
Updates the struct
This function is supposed to be overwritten in the implementation in cases when custom validation is required.
Link to this section Types
Specs
t() :: %Tyyppi.ExampleValue{foo: Tyyppi.Value.t(), bar: Tyyppi.Value.t()}
The type describing this struct. This type will be used to validate
upserts when called via Access
and/or Tyyppi.ExampleValue.put/3
,
Tyyppi.ExampleValue.update/4
.
Link to this section Functions
Specs
types() :: [{atom(), Tyyppi.T.t()}]
Returns the field types of this struct as keyword of
{field :: atom, type :: Tyyppi.T.t()}
pairs.
Specs
Updates the struct
Specs
This function is supposed to be overwritten in the implementation in cases when custom validation is required.
It would be called after all casts and type validations, if the succeeded