FatEcto v0.4.0 FatUtils.Changeset View Source
Provides different changeset methods.
Link to this section Summary
Functions
Add custom error to changeset. If custom message is not provided default one will be used.
Add custom error message with field and error message.
If specific key is present in the changeset then other key passed as required will be set as required in the changeset.
Compare datetime fields and return error if start date is before end date and it can also compare time by passing compare_type: :time in options.
Compare datetime fields and return error if start date is before or equal end date and it can also compare time by passing compare_type: :time in options.
Takes changeset and check if xor keys are present and return changeset error and also checks if xor keys are empty in the record and return error.
Link to this section Functions
add_error(changeset, error_message_title, error_message \\ "is invalid") View Source
Add custom error to changeset. If custom message is not provided default one will be used.
error_msg_title(options, field_key, default_error_msg) View Source
Add custom error message with field and error message.
require_if_change_present(changeset, list) View Source
If specific key is present in the changeset then other key passed as required will be set as required in the changeset.
validate_before(changeset, start_date_key, end_date_key, options \\ []) View Source
Compare datetime fields and return error if start date is before end date and it can also compare time by passing compare_type: :time in options.
validate_before_equal(changeset, start_date_key, end_date_key, options \\ []) View Source
Compare datetime fields and return error if start date is before or equal end date and it can also compare time by passing compare_type: :time in options.
xor(changeset, record, xor_keys, options \\ []) View Source
Takes changeset and check if xor keys are present and return changeset error and also checks if xor keys are empty in the record and return error.