70 lines
2.9 KiB
Go
70 lines
2.9 KiB
Go
package model
|
|
|
|
// TableConfig represents the configuration for a database table
|
|
type TableConfig struct {
|
|
Name string `json:"name" yaml:"name"`
|
|
Alias string `json:"alias" yaml:"alias"`
|
|
PageSize int `json:"page_size" yaml:"page_size"`
|
|
Columns []ColumnConfig `json:"columns" yaml:"columns"`
|
|
Filters []FilterConfig `json:"filters" yaml:"filters"`
|
|
SortFields []string `json:"sort_fields" yaml:"sort_fields"`
|
|
Options map[string]interface{} `json:"options" yaml:"options"`
|
|
}
|
|
|
|
// ColumnConfig represents the configuration for a table column
|
|
type ColumnConfig struct {
|
|
Name string `json:"name" yaml:"name"`
|
|
Alias string `json:"alias" yaml:"alias"`
|
|
RenderType string `json:"render_type" yaml:"render_type"`
|
|
Sortable bool `json:"sortable" yaml:"sortable"`
|
|
Searchable bool `json:"searchable" yaml:"searchable"`
|
|
ShowInList bool `json:"show_in_list" yaml:"show_in_list"`
|
|
IsPrimaryContent bool `json:"is_primary_content" yaml:"is_primary_content"`
|
|
MaxLength int `json:"max_length" yaml:"max_length"`
|
|
Width string `json:"width" yaml:"width"`
|
|
Format string `json:"format" yaml:"format"`
|
|
Values map[string]TagValue `json:"values" yaml:"values"`
|
|
Options map[string]interface{} `json:"options" yaml:"options"`
|
|
}
|
|
|
|
// FilterConfig represents the configuration for a table filter
|
|
type FilterConfig struct {
|
|
Name string `json:"name" yaml:"name"`
|
|
Type string `json:"type" yaml:"type"`
|
|
Options []interface{} `json:"options" yaml:"options"`
|
|
}
|
|
|
|
// TagValue represents a tag value with label and color
|
|
type TagValue struct {
|
|
Label string `json:"label" yaml:"label"`
|
|
Color string `json:"color" yaml:"color"`
|
|
}
|
|
|
|
// DataResponse represents the API response structure
|
|
type DataResponse struct {
|
|
Data []map[string]interface{} `json:"data"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PerPage int `json:"per_page"`
|
|
Pages int `json:"pages"`
|
|
Table string `json:"table"`
|
|
Columns []ColumnConfig `json:"columns"`
|
|
Filters []FilterConfig `json:"filters"`
|
|
}
|
|
|
|
// TableResponse represents the table list response
|
|
type TableResponse struct {
|
|
Tables []TableInfo `json:"tables"`
|
|
}
|
|
|
|
// TableInfo represents basic table information
|
|
type TableInfo struct {
|
|
Name string `json:"name"`
|
|
Alias string `json:"alias"`
|
|
}
|
|
|
|
// DetailResponse represents a single record detail response
|
|
type DetailResponse struct {
|
|
Data map[string]interface{} `json:"data"`
|
|
}
|