From 4d5445e67589f460970f30ed04d3a9213193422d Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 19 Aug 2024 17:06:35 +0800 Subject: [PATCH] updatwe --- etc/db_tpl/config | 7 +++++++ etc/db_tpl/struct.go.tpl | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 etc/db_tpl/config create mode 100644 etc/db_tpl/struct.go.tpl diff --git a/etc/db_tpl/config b/etc/db_tpl/config new file mode 100644 index 0000000..34c75ee --- /dev/null +++ b/etc/db_tpl/config @@ -0,0 +1,7 @@ +lang=go +genJson=1 +prefix=cos_ +ignoreColumnsJSON= +created= +updated= +deleted= \ No newline at end of file diff --git a/etc/db_tpl/struct.go.tpl b/etc/db_tpl/struct.go.tpl new file mode 100644 index 0000000..74b2896 --- /dev/null +++ b/etc/db_tpl/struct.go.tpl @@ -0,0 +1,17 @@ +package {{.Models}} + +{{$ilen := len .Imports}} +{{if gt $ilen 0}} +import ( + {{range .Imports}}"{{.}}"{{end}} +) +{{end}} + +{{range .Tables}} +type {{Mapper .Name}} struct { +{{$table := .}} +{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}} +{{end}} +} +{{end}} +