-
Notifications
You must be signed in to change notification settings - Fork 53
/
template.go
25 lines (23 loc) · 701 Bytes
/
template.go
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
package main
const entryTmpl = `
entity "**{{ .Name }}**" {
{{- if .Comment.Valid }}
{{ .Comment.String }}
..
{{- end }}
{{- range .Columns }}
{{- if .IsPrimaryKey }}
+ ""{{ .Name }}"": //{{ .DDLType }} [PK]{{if .IsForeignKey }}[FK]{{end}}{{- if .Comment.Valid }} : {{ .Comment.String }}{{- end }}//
{{- end }}
{{- end }}
--
{{- range .Columns }}
{{- if not .IsPrimaryKey }}
{{if .NotNull}}*{{end}}""{{ .Name }}"": //{{ .DDLType }} {{if .IsForeignKey}}[FK]{{end}} {{- if .Comment.Valid }} : {{ .Comment.String }}{{- end }}//
{{- end }}
{{- end }}
}
`
const relationTmpl = `
"**{{ .SourceTableName }}**" {{if .IsOneToOne}} ||-|| {{else}} }-- {{end}} "**{{ .TargetTableName }}**"
`