forked from davyxu/tabtoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
text.go
21 lines (18 loc) · 761 Bytes
/
text.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package luasrc
// 报错行号+3
const templateText = `-- Generated by github.com/davyxu/tabtoy
-- Version: {{.Version}}
local tab = { {{range $di, $tab := .Datas.AllTables}}
{{$tab.HeaderType}} = { {{range $unusedrow,$row := $tab.DataRowIndex}}{{$headers := $.Types.AllFieldByName $tab.OriginalHeaderType}}
{ {{range $col, $header := $headers}}{{$header.FieldName}} = {{WrapTabValue $ $tab $headers $row $col}}, {{end}}}, {{end}}
},{{end}}
}
{{range $ii, $idx := GetIndices $}}
-- {{$idx.Table.HeaderType}}
tab.{{$idx.Table.HeaderType}}By{{$idx.FieldInfo.FieldName}} = {}
for _, rec in pairs(tab.{{$idx.Table.HeaderType}}) do
tab.{{$idx.Table.HeaderType}}By{{$idx.FieldInfo.FieldName}}[rec.{{$idx.FieldInfo.FieldName}}] = rec
end
{{end}}
return tab
`