ndto_validation (ndto v0.3.1)

View Source

Summary

Types

condition/0

-type condition() :: {condition_fun(), condition_args()}.

condition_args/0

-type condition_args() :: [term()].

condition_fun/0

-type condition_fun() :: fun((term()) -> t()).

t/0

-type t() :: true | {false, term()}.

Functions

andalso(Conditions)

-spec 'andalso'(Conditions) -> Result
                   when
                       Conditions :: [condition()],
                       Result :: true | {false, Reason},
                       Reason :: {SchemaPath, Description, FailedIndex},
                       SchemaPath :: atom(),
                       Description :: binary(),
                       FailedIndex :: non_neg_integer().

find(Predicate, List)

-spec find(Predicate, List) -> Resp
              when
                  Predicate :: function(),
                  List :: list(),
                  Resp :: {true, Result} | {false, none},
                  Result :: term().

format_properties(List)

-spec format_properties(List) -> Resp
                           when List :: [Property, ...], Property :: binary(), Resp :: binary().

mfoldl(Fun, Acc, List)

-spec mfoldl(Fun, Acc, List) -> Resp
                when
                    Fun :: function(),
                    Acc :: term(),
                    List :: list(),
                    Resp :: {true, term()} | {false, term(), Reason},
                    Reason :: binary().

orelse(Conditions)

-spec 'orelse'(Conditions) -> Result
                  when
                      Conditions :: [condition()],
                      Result :: true | {false, Reason},
                      Reason :: none_matched.

xor(Conditions)

-spec 'xor'(Conditions) -> Result
               when
                   Conditions :: [condition()],
                   Result :: true | {false, Reason},
                   Reason :: none_matched | {many_matched, {ValidationError, ValidationError}},
                   ValidationError :: {SchemaPath, Description},
                   SchemaPath :: atom(),
                   Description :: binary().