2025-11-04 17:12:15 +08:00
|
|
|
// Package model define model struct of model runtime service
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import "modelRT/orm"
|
|
|
|
|
|
|
|
|
|
// IndentityTokenModelInterface define basic identity token model type interface
|
|
|
|
|
type IndentityTokenModelInterface interface {
|
|
|
|
|
GetComponentInfo() *orm.Component
|
2025-11-05 18:20:54 +08:00
|
|
|
GetMeasurementInfo() *orm.Measurement
|
|
|
|
|
GetGridTag() string // token1
|
|
|
|
|
GetZoneTag() string // token2
|
|
|
|
|
GetStationTag() string // token3
|
|
|
|
|
GetNamespacePath() string // token4(COMPONENT TABLE NSPATH)
|
|
|
|
|
GetComponentTag() string // token5(COMPONENT TABLE TAG)
|
|
|
|
|
GetAttributeGroup() string // token6(component attribute group information)
|
|
|
|
|
GetMeasurementTag() string // token7(measurement value or attribute field)
|
2025-11-04 17:12:15 +08:00
|
|
|
IsLocal() bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LongIdentityTokenModel define struct to long identity token info
|
|
|
|
|
type LongIdentityTokenModel struct {
|
2025-11-05 18:20:54 +08:00
|
|
|
ComponentInfo *orm.Component
|
|
|
|
|
MeasurementInfo *orm.Measurement
|
|
|
|
|
GridTag string
|
|
|
|
|
ZoneTag string
|
|
|
|
|
StationTag string
|
|
|
|
|
NamespacePath string
|
|
|
|
|
ComponentTag string
|
|
|
|
|
AttributeGroup string
|
|
|
|
|
MeasurementTag string
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetComponentInfo define return the component information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetComponentInfo() *orm.Component {
|
|
|
|
|
return l.ComponentInfo
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetMeasurementInfo define return the measurement information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetMeasurementInfo() *orm.Measurement {
|
|
|
|
|
return l.MeasurementInfo
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetGridTag define function to return the grid tag information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetGridTag() string { return l.GridTag }
|
2025-11-04 17:12:15 +08:00
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetZoneTag define function to return the zone tag information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetZoneTag() string { return l.ZoneTag }
|
|
|
|
|
|
|
|
|
|
// GetStationTag define function to return the station tag information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetStationTag() string { return l.StationTag }
|
|
|
|
|
|
|
|
|
|
// GetNamespacePath define function to return the namespace path information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetNamespacePath() string { return l.NamespacePath }
|
|
|
|
|
|
|
|
|
|
// GetComponentTag define function to return the component tag information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetComponentTag() string { return l.ComponentTag }
|
|
|
|
|
|
|
|
|
|
// GetAttributeGroup define function to return the attribute group information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetAttributeGroup() string { return l.AttributeGroup }
|
|
|
|
|
|
|
|
|
|
// GetMeasurementTag define function to return the measurement tag information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) GetMeasurementTag() string {
|
|
|
|
|
return l.MeasurementTag
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IsLocal define return the is_local information in the long identity token
|
|
|
|
|
func (l *LongIdentityTokenModel) IsLocal() bool {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ShortIdentityTokenModel define struct to short identity token info
|
|
|
|
|
type ShortIdentityTokenModel struct {
|
2025-11-05 18:20:54 +08:00
|
|
|
ComponentInfo *orm.Component
|
|
|
|
|
MeasurementInfo *orm.Measurement
|
2025-11-04 17:12:15 +08:00
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
GridTag string // token1
|
|
|
|
|
ZoneTag string // token2
|
|
|
|
|
StationTag string // token3
|
|
|
|
|
NamespacePath string // token4
|
|
|
|
|
MeasurementTag string // token7
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetComponentInfo define return the component information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetComponentInfo() *orm.Component {
|
|
|
|
|
return s.ComponentInfo
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetMeasurementInfo define return the measurement information in the long identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetMeasurementInfo() *orm.Measurement {
|
|
|
|
|
return s.MeasurementInfo
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-05 18:20:54 +08:00
|
|
|
// GetGridTag define function to return the grid tag information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetGridTag() string { return "" }
|
|
|
|
|
|
|
|
|
|
// GetZoneTag define function to return the zone tag information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetZoneTag() string { return "" }
|
|
|
|
|
|
|
|
|
|
// GetStationTag define function to return the station tag information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetStationTag() string { return "" }
|
|
|
|
|
|
|
|
|
|
// GetNamespacePath define function to return the namespace path information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetNamespacePath() string { return s.NamespacePath }
|
|
|
|
|
|
|
|
|
|
// GetComponentTag define function to return the component tag information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetComponentTag() string { return "" }
|
|
|
|
|
|
|
|
|
|
// GetAttributeGroup define function to return the attribute group information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetAttributeGroup() string { return "" }
|
|
|
|
|
|
|
|
|
|
// GetMeasurementTag define function to return the measurement tag information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) GetMeasurementTag() string {
|
|
|
|
|
return ""
|
2025-11-04 17:12:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IsLocal define return the is_local information in the short identity token
|
|
|
|
|
func (s *ShortIdentityTokenModel) IsLocal() bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|