equals func on exec + draft container subobject

This commit is contained in:
mr 2024-09-27 11:14:46 +02:00
parent 0ac55a0ec1
commit 1582654a9c

View File

@ -29,27 +29,27 @@ type AbstractResource struct {
/* /*
* GetModelValue returns the value of the model key * GetModelValue returns the value of the model key
*/ */
func (abs *AbstractResource) GetModelValue(key string) interface{} { func (abs *AbstractResource) GetModelValue(cat string, key string) interface{} {
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil { if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
return nil return nil
} }
if _, ok := abs.ResourceModel.Model[key]; !ok { if _, ok := abs.ResourceModel.Model[key]; !ok {
return nil return nil
} }
return abs.ResourceModel.Model[key].Value return abs.ResourceModel.Model[cat][key].Value
} }
/* /*
* GetModelType returns the type of the model key * GetModelType returns the type of the model key
*/ */
func (abs *AbstractResource) GetModelType(key string) interface{} { func (abs *AbstractResource) GetModelType(cat string, key string) interface{} {
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil { if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
return nil return nil
} }
if _, ok := abs.ResourceModel.Model[key]; !ok { if _, ok := abs.ResourceModel.Model[key]; !ok {
return nil return nil
} }
return abs.ResourceModel.Model[key].Type return abs.ResourceModel.Model[cat][key].Type
} }
/* /*
@ -66,14 +66,14 @@ func (abs *AbstractResource) GetModelKeys() []string {
/* /*
* GetModelReadOnly returns the readonly of the model key * GetModelReadOnly returns the readonly of the model key
*/ */
func (abs *AbstractResource) GetModelReadOnly(key string) interface{} { func (abs *AbstractResource) GetModelReadOnly(cat string, key string) interface{} {
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil { if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
return nil return nil
} }
if _, ok := abs.ResourceModel.Model[key]; !ok { if _, ok := abs.ResourceModel.Model[key]; !ok {
return nil return nil
} }
return abs.ResourceModel.Model[key].ReadOnly return abs.ResourceModel.Model[cat][key].ReadOnly
} }
type Model struct { type Model struct {
@ -90,7 +90,7 @@ type Model struct {
type ResourceModel struct { type ResourceModel struct {
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"` UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"` ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
Model map[string]Model `json:"model,omitempty" bson:"model,omitempty"` Model map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
} }
func (ao *ResourceModel) GetID() string { func (ao *ResourceModel) GetID() string {