| 1 |
package sarif |
| 2 |
|
| 3 |
// Rectangle ... |
| 4 |
type Rectangle struct { |
| 5 |
Bottom *float64 `json:"bottom,omitempty"` |
| 6 |
Left *float64 `json:"left,omitempty"` |
| 7 |
Right *float64 `json:"right,omitempty"` |
| 8 |
Top *float64 `json:"top,omitempty"` |
| 9 |
Message *Message `json:"message,omitempty"` |
| 10 |
PropertyBag |
| 11 |
|
| 12 |
} |
| 13 |
|
| 14 |
// NewRectangle creates a new Rectangle and returns a pointer to it |
| 15 |
func NewRectangle() *Rectangle { |
| 16 |
return &Rectangle{} |
| 17 |
} |
| 18 |
|
| 19 |
// WithBottom sets the Bottom |
| 20 |
func (rectangle *Rectangle) WithBottom(bottom float64) *Rectangle { |
| 21 |
rectangle.Bottom = &bottom |
| 22 |
return rectangle |
| 23 |
} |
| 24 |
|
| 25 |
// WithTop sets the Top |
| 26 |
func (rectangle *Rectangle) WithTop(top float64) *Rectangle { |
| 27 |
rectangle.Top = &top |
| 28 |
return rectangle |
| 29 |
} |
| 30 |
|
| 31 |
// WithLeft sets the Left |
| 32 |
func (rectangle *Rectangle) WithLeft(withLeft float64) *Rectangle { |
| 33 |
rectangle.Left = &withLeft |
| 34 |
return rectangle |
| 35 |
} |
| 36 |
|
| 37 |
// WithRight sets the Right |
| 38 |
func (rectangle *Rectangle) WithRight(right float64) *Rectangle { |
| 39 |
rectangle.Right = &right |
| 40 |
return rectangle |
| 41 |
} |
| 42 |
|
| 43 |
// WithMessage sets the Message |
| 44 |
func (rectangle *Rectangle) WithMessage(message *Message) *Rectangle { |
| 45 |
rectangle.Message = message |
| 46 |
return rectangle |
| 47 |
} |
| 48 |
|
| 49 |
// WithTextMessage sets the Message text |
| 50 |
func (rectangle *Rectangle) WithTextMessage(text string) *Rectangle { |
| 51 |
if rectangle.Message == nil { |
| 52 |
rectangle.Message = &Message{} |
| 53 |
} |
| 54 |
rectangle.Message.Text = &text |
| 55 |
return rectangle |
| 56 |
} |
| 57 |
|
| 58 |
// WithMessageMarkdown sets the Message markdown |
| 59 |
func (rectangle *Rectangle) WithMessageMarkdown(markdown string) *Rectangle { |
| 60 |
if rectangle.Message == nil { |
| 61 |
rectangle.Message = &Message{} |
| 62 |
} |
| 63 |
rectangle.Message.Markdown = &markdown |
| 64 |
return rectangle |
| 65 |
} |