Documentation ¶
Index ¶
- func DB() *gorm.DB
- func InitDataCenter(rulex typex.RuleX)
- func Name() string
- func Query(goodsId, query string) ([]map[string]any, error)
- func RegisterModel(dist ...interface{})
- func Stop()
- type Column
- type DataCenter
- type DataSource
- type ExternalDb
- type LocalDb
- type SchemaDefine
- type SchemaDetail
- type SqliteDAO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDataCenter ¶
Types ¶
type Column ¶
type Column struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Value interface{} `json:"value,omitempty"` Description string `json:"description,omitempty"` }
* * 列定义 *
type DataCenter ¶
type DataCenter struct { ExternalDb DataSource LocalDb DataSource // contains filtered or unexported fields }
* * 留着未来扩充数据中心的功能 *
type DataSource ¶
type DataSource interface { Init() error GetSchemaDetail(goodsId string) SchemaDetail // 表详情 Query(goodsId, query string) ([]map[string]any, error) }
* * 数据源接口 *
func InitExternalDb ¶
func InitExternalDb(rulex typex.RuleX) DataSource
func InitLocalDb ¶
func InitLocalDb(rulex typex.RuleX) DataSource
type ExternalDb ¶
type ExternalDb struct {
// contains filtered or unexported fields
}
* * 外部扩展数据库 *
func (*ExternalDb) GetSchemaDetail ¶
func (db *ExternalDb) GetSchemaDetail(goodsId string) SchemaDetail
func (*ExternalDb) Init ¶
func (db *ExternalDb) Init() error
func (*ExternalDb) Name ¶
func (db *ExternalDb) Name() string
type LocalDb ¶
type LocalDb struct { Sqlite *SqliteDAO // contains filtered or unexported fields }
* * 本地数据库是Sqlite,用来存储比如Modbus等数据 *
func (*LocalDb) GetSchemaDetail ¶
func (ldb *LocalDb) GetSchemaDetail(goodsId string) SchemaDetail
type SchemaDefine ¶
* * 表结构定义 *
func GetSchemaDefine ¶
func GetSchemaDefine(goodsId string) (SchemaDefine, error)
type SchemaDetail ¶
type SchemaDetail struct { UUID string `json:"uuid"` Name string `json:"name"` // SchemaType 数据库类型,如果是"INTERNAL"则表示原始RULEX;如果是 "EXTERNAL" 则表示扩展设备 // 该字段是为了扩展数据中心, 将数据中心扩展为通用的一个中间层 SchemaType string `json:"schemaType"` LocalPath string `json:"local_path"` NetAddr string `json:"net_addr"` CreateTs uint64 `json:"create_ts"` Size float32 `json:"size"` StorePath string `json:"store_path"` SchemaDefine SchemaDefine `json:"schema_define"` Description string `json:"description"` }
* * 数据仓库的详情 *
func GetSchemaDetail ¶
func GetSchemaDetail(goodsId string) SchemaDetail
* * 获取仓库详情, 现阶段写死的, 后期会在proto中实现 *
Click to show internal directories.
Click to hide internal directories.