85 lines
2.2 KiB
Go
85 lines
2.2 KiB
Go
// Package model define model struct of model runtime service
|
|
package model
|
|
|
|
import (
|
|
"modelRT/orm"
|
|
)
|
|
|
|
// AttrModelInterface define basic attr model type interface
|
|
type AttrModelInterface interface {
|
|
GetGridInfo() *orm.Grid
|
|
GetZoneInfo() *orm.Zone
|
|
GetStationInfo() *orm.Station
|
|
GetComponentInfo() *orm.Component
|
|
IsLocal() bool
|
|
}
|
|
|
|
// LongAttrInfo structure define long attribute key info of component
|
|
type LongAttrInfo struct {
|
|
AttrGroupName string
|
|
AttrKey string
|
|
AttrValue interface{}
|
|
GridInfo *orm.Grid
|
|
ZoneInfo *orm.Zone
|
|
StationInfo *orm.Station
|
|
ComponentInfo *orm.Component
|
|
}
|
|
|
|
// GetGridInfo define return the grid information in the long attribute
|
|
func (l *LongAttrInfo) GetGridInfo() *orm.Grid {
|
|
return l.GridInfo
|
|
}
|
|
|
|
// GetZoneInfo define return the zone information in the long attribute
|
|
func (l *LongAttrInfo) GetZoneInfo() *orm.Zone {
|
|
return l.ZoneInfo
|
|
}
|
|
|
|
// GetStationInfo define return the station information in the long attribute
|
|
func (l *LongAttrInfo) GetStationInfo() *orm.Station {
|
|
return l.StationInfo
|
|
}
|
|
|
|
// GetComponentInfo define return the component information in the long attribute
|
|
func (l *LongAttrInfo) GetComponentInfo() *orm.Component {
|
|
return l.ComponentInfo
|
|
}
|
|
|
|
// IsLocal define return the is_local information in the long attribute
|
|
func (l *LongAttrInfo) IsLocal() bool {
|
|
return true
|
|
}
|
|
|
|
// ShortAttrInfo structure define short attribute key info of component
|
|
type ShortAttrInfo struct {
|
|
AttrGroupName string
|
|
AttrKey string
|
|
AttrValue interface{}
|
|
ComponentInfo *orm.Component
|
|
}
|
|
|
|
// GetGridInfo define return the grid information in the short attribute
|
|
func (s *ShortAttrInfo) GetGridInfo() *orm.Grid {
|
|
return nil
|
|
}
|
|
|
|
// GetZoneInfo define return the zone information in the short attribute
|
|
func (s *ShortAttrInfo) GetZoneInfo() *orm.Zone {
|
|
return nil
|
|
}
|
|
|
|
// GetStationInfo define return the station information in the short attribute
|
|
func (s *ShortAttrInfo) GetStationInfo() *orm.Station {
|
|
return nil
|
|
}
|
|
|
|
// GetComponentInfo define return the component information in the short attribute
|
|
func (s *ShortAttrInfo) GetComponentInfo() *orm.Component {
|
|
return s.ComponentInfo
|
|
}
|
|
|
|
// IsLocal define return the is_local information in the short attribute
|
|
func (s *ShortAttrInfo) IsLocal() bool {
|
|
return false
|
|
}
|