Arke.Core.Parameter.String (Arke v0.6.2)

Copy Markdown View Source

Module that define the struct of a String by extending the Arke.Core.Parameter.base_parameters()

{arke_struct} = Parameter.String

Element added

  • min_length => :atom => define the min_length the string could have. It will check during creation
  • max_length => :atom => define the max_length the string could have. It will check during creation
  • values => [list] || [%{label: string, value: any}, ...] => use this to create a parameter with only certain values assignable. (Values must be the same type as the parameter we want to create)
  • multiple => boolean => relevant only if values are set. It makes possible to assign more than a values defined in values
  • unique => boolean => check if there is an existing record in the database with the same value before creating one
  • default => String => default value

Example

iex> params = [id: :string_test, min_length: 1, values: ["value1", "value2"], multiple: true]
...> Arke.Core.Parameter.new(%{type: :string, opts: params})

Return

%Arke.Core.Parameter.String{}

Summary

Functions

after_get_struct(arke, struct)

after_get_struct(arke, unit, struct)

arke_from_attr()

base_parameters()

before_create(arke, unit)

before_delete(arke, unit)

before_load(data, persistence_fn)

before_struct_encode(_, unit)

before_update(arke, unit)

before_update(arke, old_unit, unit)

before_validate(arke, unit)

groups_from_attr()

import(arke)

on_create(arke, unit)

on_delete(arke, unit)

on_load(unit, persistence_fn)

on_struct_encode(_, _, data, opts)

on_update(arke, old_unit, unit)

on_validate(arke, unit)