draft test
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
This package contains the models used in the application
|
||||
It's used to create the models dynamically
|
||||
*/
|
||||
var models = map[string]func() utils.DBObject{
|
||||
var ModelsCatalog = map[string]func() utils.DBObject{
|
||||
tools.WORKFLOW_RESOURCE.String(): func() utils.DBObject { return &resource.WorkflowResource{} },
|
||||
tools.DATA_RESOURCE.String(): func() utils.DBObject { return &resource.DataResource{} },
|
||||
tools.COMPUTE_RESOURCE.String(): func() utils.DBObject { return &resource.ComputeResource{} },
|
||||
@@ -43,8 +43,8 @@ var models = map[string]func() utils.DBObject{
|
||||
// Model returns the model object based on the model type
|
||||
func Model(model int) utils.DBObject {
|
||||
log := logs.GetLogger()
|
||||
if _, ok := models[tools.FromInt(model)]; ok {
|
||||
return models[tools.FromInt(model)]()
|
||||
if _, ok := ModelsCatalog[tools.FromInt(model)]; ok {
|
||||
return ModelsCatalog[tools.FromInt(model)]()
|
||||
}
|
||||
log.Error().Msg("Can't find model " + tools.FromInt(model) + ".")
|
||||
return nil
|
||||
@@ -53,7 +53,7 @@ func Model(model int) utils.DBObject {
|
||||
// GetModelsNames returns the names of the models
|
||||
func GetModelsNames() []string {
|
||||
names := []string{}
|
||||
for name := range models {
|
||||
for name := range ModelsCatalog {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
|
||||
Reference in New Issue
Block a user