♻️ Refactor av data structure

This commit is contained in:
Daniel 2023-07-12 10:35:17 +08:00
parent 7ca8eab0cd
commit fbd26d1fd6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 63 additions and 38 deletions

View file

@ -21,13 +21,14 @@ import (
"sort"
)
// Table 描述了表格视图的结构。
type Table struct {
Spec int `json:"spec"` // 视图格式版本
ID string `json:"id"` // 视图 ID
// LayoutTable 描述了表格布局的结构。
type LayoutTable struct {
Spec int `json:"spec"` // 布局格式版本
ID string `json:"id"` // 布局 ID
Columns []*TableColumn `json:"columns"` // 表格列
Rows []*TableRow `json:"rows"` // 表格行
ColIDs []string `json:"colIds"` // 列 ID用于自定义排序
RowIDs []string `json:"rowIds"` // 行 ID用于自定义排序
Filters []*ViewFilter `json:"filters"` // 过滤规则
Sorts []*ViewSort `json:"sorts"` // 排序规则
}
@ -49,8 +50,18 @@ type TableRow struct {
Cells []*Cell `json:"cells"`
}
func (table *Table) GetType() ViewType {
return ViewTypeTable
// Table 描述了表格实例的结构。
type Table struct {
ID string `json:"id"` // 表格布局 ID
Name string `json:"name"` // 表格名称
Filters []*ViewFilter `json:"filters"` // 过滤规则
Sorts []*ViewSort `json:"sorts"` // 排序规则
Columns []*TableColumn `json:"columns"` // 表格列
Rows []*TableRow `json:"rows"` // 表格行
}
func (table *Table) GetType() LayoutType {
return LayoutTypeTable
}
func (table *Table) GetID() string {