2024-11-22 16:41:04 +08:00
|
|
|
package model
|
|
|
|
|
|
2024-12-02 16:13:16 +08:00
|
|
|
import (
|
2025-08-05 15:20:07 +08:00
|
|
|
"modelRT/constants"
|
2024-12-02 16:13:16 +08:00
|
|
|
"modelRT/orm"
|
|
|
|
|
)
|
2024-11-22 16:41:04 +08:00
|
|
|
|
2024-12-02 16:13:16 +08:00
|
|
|
// SelectModelByType define select the data structure for parsing based on the input model type
|
2024-12-04 15:57:11 +08:00
|
|
|
func SelectModelByType(modelType int) BasicModelInterface {
|
2025-06-13 15:34:49 +08:00
|
|
|
if modelType == constants.BusbarType {
|
2024-12-02 16:13:16 +08:00
|
|
|
return &orm.BusbarSection{}
|
2025-06-13 15:34:49 +08:00
|
|
|
} else if modelType == constants.AsyncMotorType {
|
2024-12-09 16:05:48 +08:00
|
|
|
return &orm.AsyncMotor{}
|
2025-06-13 15:34:49 +08:00
|
|
|
} else if modelType == constants.DemoType {
|
2024-12-18 16:25:49 +08:00
|
|
|
return &orm.Demo{}
|
2024-12-02 16:13:16 +08:00
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SelectModelNameByType define select the data structure name for parsing based on the input model type
|
|
|
|
|
func SelectModelNameByType(modelType int) string {
|
2024-12-09 16:05:48 +08:00
|
|
|
return SelectModelByType(modelType).ReturnTableName()
|
2024-11-22 16:41:04 +08:00
|
|
|
}
|