View Source Estructura.Full (estructura v0.3.0)

Full Example

Link to this section Summary

Functions

Returns the generator to be used in StreamData-powered property testing, based on the specification given to use Estructura.Full.

Returns the generator to be used in StreamData-powered property testing, based on the specification given to use Estructura.Full, which was

Gets the value for the given key from the structure

Puts the value for the given key into the structure, passing coercion and validation

Link to this section Functions

Specs

__generator__() ::
  StreamData.t(%Estructura.Full{
    bar: term(),
    baz: term(),
    foo: term(),
    zzz: term()
  })

Returns the generator to be used in StreamData-powered property testing, based on the specification given to use Estructura.Full.

Specs

__generator__(%Estructura.Full{
  bar: term(),
  baz: term(),
  foo: term(),
  zzz: term()
}) ::
  StreamData.t(%Estructura.Full{
    bar: term(),
    baz: term(),
    foo: term(),
    zzz: term()
  })

Returns the generator to be used in StreamData-powered property testing, based on the specification given to use Estructura.Full, which was

%Estructura.Config{
  access: true,
  coercion: [:foo],
  collectable: :bar,
  enumerable: true,
  generator: [
    foo: {StreamData, :integer, [0..1000]},
    bar: {StreamData, :string, [:alphanumeric]},
    baz: {StreamData, :fixed_map,
     [[key1: {StreamData, :integer}, key2: {StreamData, :integer}]]},
    zzz: &Estructura.Full.zzz_generator/0
  ],
  validation: true
}

The argument given would be used as a template to generate new values.

Link to this function

get(data, key, default \\ nil)

View Source

Specs

get(
  %Estructura.Full{bar: term(), baz: term(), foo: term(), zzz: term()},
  Estructura.Config.key(),
  any()
) :: any()

Gets the value for the given key from the structure

Specs

put(
  %Estructura.Full{bar: term(), baz: term(), foo: term(), zzz: term()},
  Estructura.Config.key(),
  any()
) ::
  {:ok, %Estructura.Full{bar: term(), baz: term(), foo: term(), zzz: term()}}
  | {:error, any()}

Puts the value for the given key into the structure, passing coercion and validation