Skip to content

Commit

Permalink
bonsai
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Jun 5, 2018
1 parent d2dd795 commit decaefb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion output/dot/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/jessevdk/go-assets"
)

var _Assets21532ae17ad95976ac467eeaeab81f2bb1d537e4 = "digraph \"{{ .Schema.Name }}\" {\n // Config\n graph [rankdir=TB, layout=dot, fontname=\"Arial\"];\n node [shape=record, fontsize=14, margin=0.6, fontname=\"Arial\"];\n edge [fontsize=10, labelfloat=false, splines=none, fontname=\"Arial\"];\n\n // Tables\n {{- range $i, $t := .Schema.Tables }}\n {{ $t.Name }} [shape=none, label=<<table border=\"0\" cellborder=\"1\" cellspacing=\"0\" cellpadding=\"6\">\n <tr><td bgcolor=\"#EFEFEF\"><font face=\"Arial Bold\" point-size=\"18\">{{ $t.Name | html }}</font> <font color=\"#666666\">[{{ $t.Type | html }}]</font></td></tr>\n {{- range $ii, $c := $t.Columns }}\n <tr><td port=\"{{ $c.Name | html }}\" align=\"left\">{{ $c.Name | html }} <font color=\"#666666\">[{{ $c.Type | html }}]</font></td></tr>\n {{- end }}\n </table>>];\n {{- end }}\n\n // Relations\n {{- range $j, $r := .Schema.Relations }}\n {{ $r.Table.Name }}:{{ $c := index $r.Columns 0 }}{{ $c.Name }} -> {{ $r.ParentTable.Name }}:{{ $pc := index $r.ParentColumns 0 }}{{ $pc.Name }} [dir=back, arrowtail=crow, {{ if $r.IsAdditional }}style=\"dashed\",{{ end }} taillabel=<<table cellpadding=\"5\" border=\"0\" cellborder=\"0\"><tr><td>{{ $r.Def | html }}</td></tr></table>>];\n {{- end }}\n}\n"
var _Assets5bd148e6149bb9adcdddfcf8cc46d6e3047dbe26 = "digraph {{ .Table.Name }} {\n // Config\n graph [rankdir=TB, layout=dot, fontname=\"Arial\"];\n node [shape=record, fontsize=14, margin=0.6, fontname=\"Arial\"];\n edge [fontsize=10, labelfloat=false, splines=none, fontname=\"Arial\"];\n\n // Tables\n {{ .Table.Name }} [shape=none, label=<<table border=\"3\" cellborder=\"1\" cellspacing=\"0\" cellpadding=\"6\">\n <tr><td bgcolor=\"#EFEFEF\"><font face=\"Arial Bold\" point-size=\"18\">{{ .Table.Name | html }}</font> <font color=\"#666666\">[{{ .Table.Type | html }}]</font></td></tr>\n {{- range $ii, $c := .Table.Columns }}\n <tr><td port=\"{{ $c.Name | html }}\" align=\"left\">{{ $c.Name | html }} <font color=\"#666666\">[{{ $c.Type }}]</font></td></tr>\n {{- end }}\n </table>>];\n {{- range $i, $t := .Tables }}\n {{ $t.Name }} [shape=none, label=<<table border=\"0\" cellborder=\"1\" cellspacing=\"0\" cellpadding=\"6\">\n <tr><td bgcolor=\"#EFEFEF\"><font face=\"Arial Bold\" point-size=\"18\">{{ $t.Name | html }}</font> <font color=\"#666666\">[{{ $t.Type | html }}]</font></td></tr>\n {{- range $ii, $c := $t.Columns }}\n <tr><td port=\"{{ $c.Name | html }}\" align=\"left\">{{ $c.Name | html }} <font color=\"#666666\">[{{ $c.Type | html }}]</font></td></tr>\n {{- end }}\n </table>>];\n {{- end }}\n\n // Relations\n {{- range $i, $r := .Relations }}\n {{ $r.Table.Name }}:{{ $c := index $r.Columns 0 }}{{ $c.Name }} -> {{ $r.ParentTable.Name }}:{{ $pc := index $r.ParentColumns 0 }}{{ $pc.Name }} [dir=back, arrowtail=crow, {{ if $r.IsAdditional }}style =\"dashed\",{{ end }} taillabel=<<table cellpadding=\"5\" border=\"0\" cellborder=\"0\"><tr><td>{{ $r.Def | html }}</td></tr></table>>];\n {{- end }}\n}\n"
var _Assets21532ae17ad95976ac467eeaeab81f2bb1d537e4 = "digraph \"{{ .Schema.Name }}\" {\n // Config\n graph [rankdir=TB, layout=dot, fontname=\"Arial\"];\n node [shape=record, fontsize=14, margin=0.6, fontname=\"Arial\"];\n edge [fontsize=10, labelfloat=false, splines=none, fontname=\"Arial\"];\n\n // Tables\n {{- range $i, $t := .Schema.Tables }}\n {{ $t.Name }} [shape=none, label=<<table border=\"0\" cellborder=\"1\" cellspacing=\"0\" cellpadding=\"6\">\n <tr><td bgcolor=\"#EFEFEF\"><font face=\"Arial Bold\" point-size=\"18\">{{ $t.Name | html }}</font> <font color=\"#666666\">[{{ $t.Type | html }}]</font></td></tr>\n {{- range $ii, $c := $t.Columns }}\n <tr><td port=\"{{ $c.Name | html }}\" align=\"left\">{{ $c.Name | html }} <font color=\"#666666\">[{{ $c.Type | html }}]</font></td></tr>\n {{- end }}\n </table>>];\n {{- end }}\n\n // Relations\n {{- range $j, $r := .Schema.Relations }}\n {{ $r.Table.Name }}:{{ $c := index $r.Columns 0 }}{{ $c.Name }} -> {{ $r.ParentTable.Name }}:{{ $pc := index $r.ParentColumns 0 }}{{ $pc.Name }} [dir=back, arrowtail=crow, {{ if $r.IsAdditional }}style=\"dashed\",{{ end }} taillabel=<<table cellpadding=\"5\" border=\"0\" cellborder=\"0\"><tr><td>{{ $r.Def | html }}</td></tr></table>>];\n {{- end }}\n}\n"

// Assets returns go-assets FileSystem
var Assets = assets.NewFileSystem(map[string][]string{"/": []string{"schema.dot.tmpl", "table.dot.tmpl"}}, map[string]*assets.File{
Expand Down
16 changes: 8 additions & 8 deletions output/md/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import (
)

var _Assets43889384df1c6f74d764c29d91b9d5637eb46061 = "# {{ .Schema.Name }}\n\n## Tables\n\n| Name | Columns | Comment | Type |\n| ---- | ------- | ------- | ---- |\n{{- range $i, $t := .Schema.Tables }}\n| [{{ $t.Name }}]({{ $t.Name }}.md) | {{ len $t.Columns }} | {{ $t.Comment }} | {{ $t.Type }} |\n{{- end }}\n\n{{ if .er -}}\n## Relations\n\n![er](schema.png)\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"
var _Assetsac44302fb6150a621aa9d04a0350aac972bf7e18 = "# {{ .Table.Name }}\n\n## Description\n\n{{ .Table.Comment -}}\n{{ if .Table.Def }}\n<details>\n<summary>**Definition**</summary>\n\n```sql\n{{ .Table.Def }}\n```\n\n</details>\n{{ end }}\n\n## Columns\n\n| Name | Type | Default | Nullable | Children | Parents | Comment |\n| ---- | ---- | ------- | -------- | -------- | ------- | ------- |\n{{- range $i, $c := .Table.Columns }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Default.String }} | {{ $c.Nullable }} | {{ range $ii, $r := $c.ChildRelations -}}[{{ $r.Table.Name }}]({{ $r.Table.Name }}.md) {{ end }} | {{ range $ii, $r := $c.ParentRelations -}}[{{ $r.ParentTable.Name }}]({{ $r.ParentTable.Name }}.md) {{ end }} | {{ $c.Comment }} |\n{{- end }}\n\n## Constraints\n\n| Name | Type | Def |\n| ---- | ---- | --- |\n{{- range $i, $c := .Table.Constraints }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Def }} |\n{{- end }}\n\n## Indexes\n\n| Name | Def |\n| ---- | --- |\n{{- range $i, $idx := .Table.Indexes }}\n| {{ $idx.Name }} | {{ $idx.Def }} |\n{{- end }}\n\n{{ if .er -}}\n## Relations\n\n![er]({{ .Table.Name }}.png)\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"
var _Assetsac44302fb6150a621aa9d04a0350aac972bf7e18 = "# {{ .Table.Name }}\n\n## Description\n\n{{ .Table.Comment -}}\n{{ if .Table.Def }}\n<details>\n<summary><strong>Table Definition</strong></summary>\n\n```sql\n{{ .Table.Def }}\n```\n\n</details>\n{{ end }}\n\n## Columns\n\n| Name | Type | Default | Nullable | Children | Parents | Comment |\n| ---- | ---- | ------- | -------- | -------- | ------- | ------- |\n{{- range $i, $c := .Table.Columns }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Default.String }} | {{ $c.Nullable }} | {{ range $ii, $r := $c.ChildRelations -}}[{{ $r.Table.Name }}]({{ $r.Table.Name }}.md) {{ end }} | {{ range $ii, $r := $c.ParentRelations -}}[{{ $r.ParentTable.Name }}]({{ $r.ParentTable.Name }}.md) {{ end }} | {{ $c.Comment }} |\n{{- end }}\n\n## Constraints\n\n| Name | Type | Def |\n| ---- | ---- | --- |\n{{- range $i, $c := .Table.Constraints }}\n| {{ $c.Name }} | {{ $c.Type }} | {{ $c.Def }} |\n{{- end }}\n\n## Indexes\n\n| Name | Def |\n| ---- | --- |\n{{- range $i, $idx := .Table.Indexes }}\n| {{ $idx.Name }} | {{ $idx.Def }} |\n{{- end }}\n\n{{ if .er -}}\n## Relations\n\n![er]({{ .Table.Name }}.png)\n{{- end }}\n\n---\n\n> Generated by [tbls](https://github.com/k1LoW/tbls)"

// Assets returns go-assets FileSystem
var Assets = assets.NewFileSystem(map[string][]string{"/": []string{"index.md.tmpl", "table.md.tmpl"}}, map[string]*assets.File{
"/": &assets.File{
"/table.md.tmpl": &assets.File{
Path: "/table.md.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1528198538, 1528198538000000000),
Data: []byte(_Assetsac44302fb6150a621aa9d04a0350aac972bf7e18),
}, "/": &assets.File{
Path: "/",
FileMode: 0x800001ed,
Mtime: time.Unix(1528198425, 1528198425000000000),
Mtime: time.Unix(1528198538, 1528198538000000000),
Data: nil,
}, "/index.md.tmpl": &assets.File{
Path: "/index.md.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1527684406, 1527684406000000000),
Data: []byte(_Assets43889384df1c6f74d764c29d91b9d5637eb46061),
}, "/table.md.tmpl": &assets.File{
Path: "/table.md.tmpl",
FileMode: 0x1a4,
Mtime: time.Unix(1528198425, 1528198425000000000),
Data: []byte(_Assetsac44302fb6150a621aa9d04a0350aac972bf7e18),
}}, "")
2 changes: 1 addition & 1 deletion output/md/templates/table.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ .Table.Comment -}}
{{ if .Table.Def }}
<details>
<summary>**Definition**</summary>
<summary><strong>Table Definition</strong></summary>

```sql
{{ .Table.Def }}
Expand Down
2 changes: 1 addition & 1 deletion sample/mysql/post_comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

post and comments View table
<details>
<summary>**Definition**</summary>
<summary><strong>Table Definition</strong></summary>

```sql
(select `c`.`id` AS `id`,`p`.`title` AS `title`,`u2`.`username` AS `post_user`,`c`.`comment` AS `comment`,`u2`.`username` AS `comment_user`,`c`.`created` AS `created`,`c`.`updated` AS `updated` from (((`testdb`.`posts` `p` left join `testdb`.`comments` `c` on((`p`.`id` = `c`.`post_id`))) left join `testdb`.`users` `u` on((`u`.`id` = `p`.`user_id`))) left join `testdb`.`users` `u2` on((`u2`.`id` = `c`.`user_id`))))
Expand Down
2 changes: 1 addition & 1 deletion sample/mysql8/post_comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

post and comments View table
<details>
<summary>**Definition**</summary>
<summary><strong>Table Definition</strong></summary>

```sql
select `c`.`id` AS `id`,`p`.`title` AS `title`,`u2`.`username` AS `post_user`,`c`.`comment` AS `comment`,`u2`.`username` AS `comment_user`,`c`.`created` AS `created`,`c`.`updated` AS `updated` from (((`testdb`.`posts` `p` left join `testdb`.`comments` `c` on((`p`.`id` = `c`.`post_id`))) left join `testdb`.`users` `u` on((`u`.`id` = `p`.`user_id`))) left join `testdb`.`users` `u2` on((`u2`.`id` = `c`.`user_id`)))
Expand Down
2 changes: 1 addition & 1 deletion sample/postgres/post_comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

post and comments View table
<details>
<summary>**Definition**</summary>
<summary><strong>Table Definition</strong></summary>

```sql
SELECT c.id,
Expand Down

0 comments on commit decaefb

Please sign in to comment.