| 1 |
package sarif |
| 2 |
|
| 3 |
// CodeFlow ... |
| 4 |
type CodeFlow struct { |
| 5 |
Message *Message `json:"message,omitempty"` |
| 6 |
ThreadFlows []*ThreadFlow `json:"threadFlows,omitempty"` |
| 7 |
PropertyBag |
| 8 |
|
| 9 |
} |
| 10 |
|
| 11 |
// NewCodeFlow creates a new CodeFlow and returns a pointer to it |
| 12 |
func NewCodeFlow() *CodeFlow { |
| 13 |
return &CodeFlow{} |
| 14 |
} |
| 15 |
|
| 16 |
// WithMessage sets the Message |
| 17 |
func (codeFlow *CodeFlow) WithMessage(message *Message) *CodeFlow { |
| 18 |
codeFlow.Message = message |
| 19 |
return codeFlow |
| 20 |
} |
| 21 |
|
| 22 |
// WithTextMessage sets the Message text |
| 23 |
func (codeFlow *CodeFlow) WithTextMessage(text string) *CodeFlow { |
| 24 |
if codeFlow.Message == nil { |
| 25 |
codeFlow.Message = &Message{} |
| 26 |
} |
| 27 |
codeFlow.Message.Text = &text |
| 28 |
return codeFlow |
| 29 |
} |
| 30 |
|
| 31 |
// WithMessageMarkdown sets the Message markdown |
| 32 |
func (codeFlow *CodeFlow) WithMessageMarkdown(markdown string) *CodeFlow { |
| 33 |
if codeFlow.Message == nil { |
| 34 |
codeFlow.Message = &Message{} |
| 35 |
} |
| 36 |
codeFlow.Message.Markdown = &markdown |
| 37 |
return codeFlow |
| 38 |
} |
| 39 |
|
| 40 |
// WithThreadFlows sets the ThreadFlows |
| 41 |
func (codeFlow *CodeFlow) WithThreadFlows(threadFlows []*ThreadFlow) *CodeFlow { |
| 42 |
codeFlow.ThreadFlows = threadFlows |
| 43 |
|
| 44 |
return codeFlow |
| 45 |
} |
| 46 |
|
| 47 |
// AddThreadFlow ... |
| 48 |
func (codeFlow *CodeFlow) AddThreadFlow(threadFlow *ThreadFlow) { |
| 49 |
codeFlow.ThreadFlows = append(codeFlow.ThreadFlows, threadFlow) |
| 50 |
} |