module DynFork::QCommons::UnitsManagement

Overview

Units Management.

NOTE Management for choices parameter in dynamic field types.

Extended Modules

Direct including types

Defined in:

dynfork/commons/unit.cr

Instance Method Summary

Instance Method Detail

def unit_manager(unit : DynFork::Globals::Unit) : Nil #

For insert or delete units.

NOTE Management for choices parameter in dynamic field types.

Example:

@[DynFork::Meta(service_name: "TestModel")]
struct ModelName < DynFork::Model
  getter choice_text_dyn = DynFork::Fields::ChoiceTextDynField.new
  getter choice_text_mult_dyn = DynFork::Fields::ChoiceTextMultDynField.new
  getter choice_i64_dyn = DynFork::Fields::ChoiceI64DynField.new
  getter choice_i64_mult_dyn = DynFork::Fields::ChoiceI64MultDynField.new
  getter choice_f64_dyn = DynFork::Fields::ChoiceF64DynField.new
  getter choice_f64_mult_dyn = DynFork::Fields::ChoiceF64MultDynField.new
end

unit = DynFork::Globals::Unit.new(
  field: "field_name",
  title: "Title",
  value: "value", # String | Int64 | Float64
  delete: false   # default is the same as `false`
)

ModelName.unit_manager unit

[View source]