tableau
tableau copied to clipboard
refactor: add new `DocSheet` as middle layer for hierarchical file parsing
refer Pandas: tabular data
https://github.com/tableauio/tableau/blob/68ffb131604d8e74f8e3bc4d69d1f14ed6fd6b95/internal/importer/book/sheet.go#L35-L43
Support two kinds of descriptors:
- [x] flat formats: XLSX/CSV -> FlatSheet
- [ ] hierachy formats: XML/YAML -> DocSheet
Define FlatSheet and DocSheet
type baseSheet struct {
Name string
Meta * tableaupb.Metasheet
}
type FlatSheet struct {
baseSheet
Rows[][] string // 2D array of strings.
}
type Attribute struct {
Name string
Value string
}
type Node struct {
Name string
Attributes[] Attribute
Children []*Node
}
// NOTE: descriptor sheet (name starts with "@") describes the corresponding sheet's structure.
// E.g: "@ItemConf" describes the structure of "ItemConf"
type DocSheet struct {
baseSheet
Nodes[] Node
}
Refer: