Added documentation and changed import to not only allow 'validate' function
This commit is contained in:
		@@ -1,7 +1,15 @@
 | 
			
		||||
defmodule Sukaato.CustomValidators do
 | 
			
		||||
  import Ecto.Changeset
 | 
			
		||||
  import Validate, only: [validate: 2]
 | 
			
		||||
  import Validate
 | 
			
		||||
 | 
			
		||||
  @moduledoc """
 | 
			
		||||
  Provide a collecton of custom validation functions for Ecto database
 | 
			
		||||
  database table update validation.
 | 
			
		||||
  """
 | 
			
		||||
 | 
			
		||||
  @doc """
 | 
			
		||||
  Validate a map or array/list column for an Ecto database table update.
 | 
			
		||||
  """
 | 
			
		||||
  def validate_map_format(changeset, field, conventional_mapping) when is_atom(field) do
 | 
			
		||||
    field_value = get_field(changeset, field)
 | 
			
		||||
    validation_result = validate(field_value, conventional_mapping)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user