Packages

Lib for elixir

Current section

Files

Jump to
gulib lib validations presence.ex
Raw

lib/validations/presence.ex

defmodule Gulib.Validations.Presence do
@moduledoc """
必须不能为空的校验
"""
def validate(value, options \\ []) do
Gulib.Validate.unless_skipping(value, options) do
if Gulib.blank?(value) do
{:fail, :not_present, Gulib.Translator.dgettext("validate", "Not Present")}
else
:ok
end
end
end
end