Debian Codegraph @

doc/src/manual/cowboy_constraints.asciidoc

raw
1 = cowboy_constraints(3)
2
3 == Name
4
5 cowboy_constraints - Constraints
6
7 == Description
8
9 The module `cowboy_constraints` defines the built-in
10 constraints in Cowboy and provides an interface for
11 manipulating these constraints.
12
13 Constraints are functions that define what type of
14 input is allowed. They are used throughout Cowboy,
15 from the router to query strings to cookies.
16
17 == Exports
18
19 Built-in constraints:
20
21 * link:man:cowboy_constraints:int(3)[cowboy_constraints:int(3)] - Integer constraint
22 * link:man:cowboy_constraints:nonempty(3)[cowboy_constraints:nonempty(3)] - Non-empty constraint
23
24 Constraint generators:
25
26 * link:man:cowboy_constraints:from_fun(3)[cowboy_constraints:from_fun(3)] - Create a constraint from a 1-arity function
27
28 == Types
29
30 === constraint()
31
32 [source,erlang]
33 ----
34 constraint() :: int | nonempty | fun()
35 ----
36
37 A constraint function.
38
39 The atom constraints are built-in, see the corresponding
40 function in the exports list above.
41
42 === reason()
43
44 [source,erlang]
45 ----
46 reason() :: {constraint(), Reason, Value}
47
48 Reason :: any()
49 Value :: any()
50 ----
51
52 Reason for the constraint failure.
53
54 It includes the constraint function in question,
55 a machine-readable error reason and the value that
56 made the constraint fail.
57
58 == See also
59
60 link:man:cowboy(7)[cowboy(7)],
61 link:man:cowboy(3)[cowboy(3)],
62 link:man:cowboy_router(3)[cowboy_router(3)],
63 link:man:cowboy_req:match_cookies(3)[cowboy_req:match_cookies(3)],
64 link:man:cowboy_req:match_qs(3)[cowboy_req:match_qs(3)]