utils.anubis
950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Created by PyramIDE.
* User: フランスのトトロ aka (David RENÉ)
* Date: 13/02/2016
* Time: 10:39
* © Calexium
*/
read tools/basis.anubis
read hayamiki_lib/types/hayamiki.anubis
public define Int
longest_table_name_size
(
List(HK_App) apps,
Int current_size
)=
if apps is
{
[] then current_size,
[app . t_apps] then
since app is hk_app(_, _, _, tables),
with max_size = max(map((HK_Table table) |-> length(table.name), tables), current_size),
longest_table_name_size(t_apps, max_size)
}.
define Int
_max
(
List(HK_Model_Column) columns,
Int current_max
)=
if columns is
{
[] then current_max,
[h . t] then
since h is hk_column(name, _, _, _),
_max(t, max(current_max, length(name)))
}
.
public define Int
max
(
List(HK_Model_Column) columns
)=
_max(columns, 0).