From d5b8fa9969d95afa8eaa9f22a5954076a4f58a5f Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 20 May 2024 18:50:04 +0800 Subject: [PATCH] update --- etc/db_tpl/struct.go.tpl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/etc/db_tpl/struct.go.tpl b/etc/db_tpl/struct.go.tpl index 476efa2..74b2896 100644 --- a/etc/db_tpl/struct.go.tpl +++ b/etc/db_tpl/struct.go.tpl @@ -1,9 +1,17 @@ -@echo off -setlocal +package {{.Models}} -set "inputString=hello_world" -for /f "delims=" %%i in ('powershell -File "ConvertToUpperCase.ps1" -inputString "%inputString%"') do set "outputVar=%%i" +{{$ilen := len .Imports}} +{{if gt $ilen 0}} +import ( + {{range .Imports}}"{{.}}"{{end}} +) +{{end}} -echo %outputVar% +{{range .Tables}} +type {{Mapper .Name}} struct { +{{$table := .}} +{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}} +{{end}} +} +{{end}} -endlocal \ No newline at end of file