Skip to content

Commit

Permalink
Merge pull request #451 from MUzairS15/MUzairS15/feat/relationships/s…
Browse files Browse the repository at this point in the history
…elector-sets

[Relationships] Add support for selector sets.
  • Loading branch information
Mohd Uzair authored Jan 16, 2024
2 parents b15a4e1 + e121195 commit 85162ea
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions models/meshmodel/core/v1alpha1/relationship.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ import (
type RelationshipDefinition struct {
ID uuid.UUID `json:"id"`
TypeMeta
Model Model `json:"model"`
HostName string `json:"hostname"`
HostID uuid.UUID `json:"hostID"`
DisplayHostName string `json:"displayhostname"`
Metadata map[string]interface{} `json:"metadata" yaml:"metadata"`
SubType string `json:"subType" yaml:"subType" gorm:"subType"`
EvaluationQuery string `json:"evaluationQuery" yaml:"evaluationQuery" gorm:"evaluationQuery"`
Selectors map[string]interface{} `json:"selectors" yaml:"selectors"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
Model Model `json:"model"`
HostName string `json:"hostname"`
HostID uuid.UUID `json:"hostID"`
DisplayHostName string `json:"displayhostname"`
Metadata map[string]interface{} `json:"metadata" yaml:"metadata"`
SubType string `json:"subType" yaml:"subType" gorm:"subType"`
EvaluationQuery string `json:"evaluationQuery" yaml:"evaluationQuery" gorm:"evaluationQuery"`
Selectors []map[string]interface{} `json:"selectors" yaml:"selectors"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
}

type RelationshipDefinitionDB struct {
Expand Down Expand Up @@ -123,7 +123,7 @@ func (rdb *RelationshipDefinitionDB) GetRelationshipDefinition(m Model) (r Relat
}
_ = json.Unmarshal(rdb.Metadata, &r.Metadata)
if r.Selectors == nil {
r.Selectors = make(map[string]interface{})
r.Selectors = []map[string]interface{}{}
}
_ = json.Unmarshal(rdb.Selectors, &r.Selectors)
r.SubType = rdb.SubType
Expand Down

0 comments on commit 85162ea

Please sign in to comment.