Documentation ¶
Index ¶
- Variables
- func FetchDefaultValue(fieldType string) (ret string)
- func InitBuiltinTypes(typeTab *TypeTable)
- func LanguagePrimitive(fieldType string, lanType string) string
- func PrimitiveExists(fieldType string) bool
- type Cell
- type DataRow
- type DataTable
- func (self *DataTable) AddCell(row int) *Cell
- func (self *DataTable) AddRow() (row int)
- func (self *DataTable) DataRowIndex() (ret []int)
- func (self *DataTable) GetCell(row, col int) *Cell
- func (self *DataTable) GetValueByName(row int, name string) *Cell
- func (self *DataTable) HeaderByColumn(col int) *HeaderField
- func (self *DataTable) HeaderByName(name string) *HeaderField
- func (self *DataTable) MustGetCell(row, col int) *Cell
- func (self *DataTable) MustGetHeader(col int) (header *HeaderField)
- func (self *DataTable) String() string
- type DataTableList
- type FieldType
- type Globals
- type HeaderField
- type IndexDefine
- type TableKind
- type TypeData
- type TypeDefine
- type TypeTable
- func (self *TypeTable) AddField(tf *TypeDefine, data *DataTable, row int)
- func (self *TypeTable) AllFieldByName(objectType string) (ret []*TypeDefine)
- func (self *TypeTable) AllFields(all bool) (ret []*TypeDefine)
- func (self *TypeTable) EnumNames() (ret []string)
- func (self *TypeTable) FieldByName(objectType, name string) (ret *TypeDefine)
- func (self *TypeTable) IsEnumKind(objectType string) bool
- func (self *TypeTable) ObjectExists(objectType string) bool
- func (self *TypeTable) Print(all bool)
- func (self *TypeTable) Raw() []*TypeData
- func (self *TypeTable) ResolveEnumValue(objectType, value string) string
- func (self *TypeTable) StructNames() (ret []string)
- func (self *TypeTable) ToJSON(all bool) []byte
- type TypeUsage
Constants ¶
This section is empty.
Variables ¶
View Source
var BuiltinSymbolsVisible bool
View Source
var (
FieldTypes = []*FieldType{
{"int16", "int16", "Int16", "0"},
{"int32", "int32", "Int32", "0"},
{"int64", "int64", "Int64", "0"},
{"int", "int32", "Int32", "0"},
{"uint16", "uint16", "UInt16", "0"},
{"uint32", "uint32", "UInt32", "0"},
{"uint64", "uint64", "UInt64", "0"},
{"float", "float32", "float", "0"},
{"double", "float64", "double", "0"},
{"float32", "float32", "float", "0"},
{"float64", "float64", "double", "0"},
{"bool", "bool", "bool", "FALSE"},
{"string", "string", "string", ""},
}
)
Functions ¶
func InitBuiltinTypes ¶
func InitBuiltinTypes(typeTab *TypeTable)
func LanguagePrimitive ¶
将类型转为对应语言的原始类型
Types ¶
type Cell ¶
type DataTable ¶
type DataTable struct { HeaderType string // 表名,Index表里定义的类型 OriginalHeaderType string // HeaderFields对应的ObjectType,KV表为TableField FileName string SheetName string Rows []*DataRow // 0下标为表头数据 Headers []*HeaderField }
表格的完整数据,表头有屏蔽时,对应行值为空
func NewDataTable ¶
func NewDataTable() *DataTable
func (*DataTable) GetValueByName ¶
根据列头找到该行对应的值
func (*DataTable) HeaderByColumn ¶
func (self *DataTable) HeaderByColumn(col int) *HeaderField
func (*DataTable) HeaderByName ¶
func (self *DataTable) HeaderByName(name string) *HeaderField
func (*DataTable) MustGetCell ¶
func (*DataTable) MustGetHeader ¶
func (self *DataTable) MustGetHeader(col int) (header *HeaderField)
type DataTableList ¶
type DataTableList struct {
// contains filtered or unexported fields
}
func (*DataTableList) AddDataTable ¶
func (self *DataTableList) AddDataTable(t *DataTable)
func (*DataTableList) AllTables ¶
func (self *DataTableList) AllTables() []*DataTable
func (*DataTableList) Count ¶
func (self *DataTableList) Count() int
func (*DataTableList) GetDataTable ¶
func (self *DataTableList) GetDataTable(headerType string) *DataTable
type Globals ¶
type Globals struct { Version string // 工具版本号 IndexFile string // 指示文件 PackageName string // 文件生成时的包名 CombineStructName string // 包含最终表所有数据的根结构 IndexGetter helper.FileGetter // 索引文件获取器 TableGetter helper.FileGetter // 其他文件获取器 IndexList []*IndexDefine // 输入的索引文件 Types *TypeTable // 输入的类型及符号 Datas DataTableList // 输出的字符串格式的数据表 GenBinary bool MatchTag string ParaLoading bool UseGBKCSV bool }
func NewGlobals ¶
func NewGlobals() *Globals
type HeaderField ¶
type HeaderField struct { Cell *Cell // 表头单元格内容 TypeInfo *TypeDefine // 在类型表中找到对应的类型信息 }
func (*HeaderField) String ¶
func (self *HeaderField) String() string
type IndexDefine ¶
type IndexDefine struct { Kind TableKind `tb_name:"模式"` TableType string `tb_name:"表类型"` TableFileName string `tb_name:"表文件名"` Tags []string `tb_name:"标记"` // | 分割 }
func (*IndexDefine) MatchTag ¶
func (self *IndexDefine) MatchTag(tag string) bool
type TypeData ¶
type TypeData struct { Define *TypeDefine Tab *DataTable // 类型引用的表 Row int // 类型引用的原始数据(DataTable)中的行 }
type TypeDefine ¶
type TypeDefine struct { Kind TypeUsage `tb_name:"种类"` ObjectType string `tb_name:"对象类型"` Name string `tb_name:"标识名"` FieldName string `tb_name:"字段名"` FieldType string `tb_name:"字段类型"` Value string `tb_name:"值" json:",omitempty"` ArraySplitter string `tb_name:"数组切割" json:",omitempty"` MakeIndex bool `tb_name:"索引" json:",omitempty"` IsBuiltin bool `json:",omitempty"` }
func (*TypeDefine) IsArray ¶
func (self *TypeDefine) IsArray() bool
type TypeTable ¶
type TypeTable struct {
// contains filtered or unexported fields
}
func NewSymbolTable ¶
func NewSymbolTable() *TypeTable
func (*TypeTable) AddField ¶
func (self *TypeTable) AddField(tf *TypeDefine, data *DataTable, row int)
refData,类型表对应源表的位置信息
func (*TypeTable) AllFieldByName ¶
func (self *TypeTable) AllFieldByName(objectType string) (ret []*TypeDefine)
对象的所有字段
func (*TypeTable) AllFields ¶
func (self *TypeTable) AllFields(all bool) (ret []*TypeDefine)
func (*TypeTable) FieldByName ¶
func (self *TypeTable) FieldByName(objectType, name string) (ret *TypeDefine)
数据表中表头对应类型表
func (*TypeTable) ObjectExists ¶
func (*TypeTable) ResolveEnumValue ¶
匹配枚举值
func (*TypeTable) StructNames ¶
Click to show internal directories.
Click to hide internal directories.