-
Notifications
You must be signed in to change notification settings - Fork 170
/
table.md.tmpl
76 lines (57 loc) · 1.53 KB
/
table.md.tmpl
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# {{ .Table.Name }}
## {{ "Description" | lookup }}
{{- if ne .Table.Comment "" }}
{{ .Table.Comment | nl2mdnl }}
{{- end }}
{{- if .Table.Def }}
<details>
<summary><strong>{{ "Table Definition" | lookup }}</strong></summary>
```sql
{{ .Table.Def }}
```
</details>
{{- end }}
{{- if ne (len .Table.Labels) 0 }}
## {{ "Labels" | lookup }}
{{ .Table.Labels | label_join }}
{{- end }}
## {{ "Columns" | lookup }}
{{ range $l := .Columns }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ $len := len .ReferencedTables }}{{ if ne $len 2 -}}
## {{ "Referenced Tables" | lookup }}
{{ range $l := .ReferencedTables }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ end -}}
{{ $len := len .Viewpoints }}{{ if ne $len 2 -}}
## {{ "Viewpoints" | lookup }}
{{ range $l := .Viewpoints }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ end -}}
{{ $len := len .Constraints -}}{{ if ne $len 2 -}}
## {{ "Constraints" | lookup }}
{{ range $l := .Constraints }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ end -}}
{{ $len := len .Indexes -}}{{ if ne $len 2 -}}
## {{ "Indexes" | lookup }}
{{ range $l := .Indexes }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ end -}}
{{ $len := len .Triggers -}}{{ if ne $len 2 -}}
## {{ "Triggers" | lookup }}
{{ range $l := .Triggers }}
|{{ range $d := $l }} {{ $d | nl2br }} |{{ end }}
{{- end }}
{{ end -}}
{{- if .er -}}
## {{ "Relations" | lookup }}
{{ .erDiagram }}
{{ end -}}
---
> Generated by [tbls](https://github.com/k1LoW/tbls)