View Source HypeLib.Utils.Changeset (HypeLib v2.4.1)

changelog

Changelog

2-3-0

2.3.0

First implementation

2-3-1

2.3.1

Fixed credo warnings

2-4-0

2.4.0

Added the initial implementation of the validate_not_nil/2 function

Link to this section Summary

Functions

If the underlying struct contains a non-nil value for the given field, then the function will generate a new random string and puts it into the changeset.

Validates if the given field / list of fields are not nil.

Link to this section Functions

Link to this function

put_generated_string_if_needed(changeset, field, charset, generated_string_length \\ 32)

View Source

If the underlying struct contains a non-nil value for the given field, then the function will generate a new random string and puts it into the changeset.

The charset argument should be generated through the HypeLib.Utils.String.Generator.charsets/1 or HypeLib.Utils.String.Generator.charsets!/1 functions.

changelog

Changelog

2-3-0

2.3.0

First implementation

2-3-2

2.3.2

Added the charset argument. This gives developers more control over the used characters which should be used when generating the random string.

Link to this function

validate_not_nil(changeset, field_or_fields)

View Source

Validates if the given field / list of fields are not nil.

When the changeset contains a field whose value is nil, then the field will be removed from the changeset and an field specific error will be appended to the changeset.

credits

Credits

Stackoverflow user "Dogbert"

changelog

Changelog

2-4-0

2.4.0

Initial implementation

2-4-1

2.4.1

Changed the error message to "can't be nil"