| 1 |
package sarif |
| 2 |
|
| 3 |
// Properties ... |
| 4 |
type Properties map[string]interface{} |
| 5 |
|
| 6 |
// PropertyBag ... |
| 7 |
type PropertyBag struct { |
| 8 |
Properties Properties `json:"properties,omitempty"` |
| 9 |
} |
| 10 |
|
| 11 |
// NewPropertyBag creates a new PropertyBag and returns a pointer to it |
| 12 |
func NewPropertyBag() *PropertyBag { |
| 13 |
return &PropertyBag{ |
| 14 |
Properties: Properties{}, |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
// Add ... |
| 19 |
func (propertyBag *PropertyBag) Add(key string, value interface{}) { |
| 20 |
propertyBag.Properties[key] = value |
| 21 |
} |
| 22 |
|
| 23 |
// AddString ... |
| 24 |
func (propertyBag *PropertyBag) AddString(key, value string) { |
| 25 |
propertyBag.Add(key, value) |
| 26 |
} |
| 27 |
|
| 28 |
// AddBoolean ... |
| 29 |
func (propertyBag *PropertyBag) AddBoolean(key string, value bool) { |
| 30 |
propertyBag.Add(key, value) |
| 31 |
} |
| 32 |
|
| 33 |
// AddInteger ... |
| 34 |
func (propertyBag *PropertyBag) AddInteger(key string, value int) { |
| 35 |
propertyBag.Add(key, value) |
| 36 |
} |
| 37 |
|
| 38 |
// AttachPropertyBag adds a property bag to a rule |
| 39 |
func (propertyBag *PropertyBag) AttachPropertyBag(pb *PropertyBag) { |
| 40 |
propertyBag.Properties = pb.Properties |
| 41 |
} |