mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Start TEngine3.0
Start TEngine3.0
This commit is contained in:
33
Luban/Luban.ClientServer/Templates/config/go_bin/tables.tpl
Normal file
33
Luban/Luban.ClientServer/Templates/config/go_bin/tables.tpl
Normal file
@@ -0,0 +1,33 @@
|
||||
{{~
|
||||
name = x.name
|
||||
namespace = x.namespace
|
||||
tables = x.tables
|
||||
~}}
|
||||
|
||||
package {{namespace}}
|
||||
|
||||
import "{{assembly.args.go_bright_module_name}}/serialization"
|
||||
|
||||
type ByteBufLoader func(string) (*serialization.ByteBuf, error)
|
||||
|
||||
type {{name}} struct {
|
||||
{{~for table in tables ~}}
|
||||
{{table.name}} *{{table.go_full_name}}
|
||||
{{~end~}}
|
||||
}
|
||||
|
||||
func NewTables(loader ByteBufLoader) (*{{name}}, error) {
|
||||
var err error
|
||||
var buf *serialization.ByteBuf
|
||||
|
||||
tables := &{{name}}{}
|
||||
{{~for table in tables ~}}
|
||||
if buf, err = loader("{{table.output_data_file}}") ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.{{table.name}}, err = New{{table.go_full_name}}(buf) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
{{~end~}}
|
||||
return tables, nil
|
||||
}
|
Reference in New Issue
Block a user