Skip to content

Commit c6d0018

Browse files
committed
Add comments on exported funcs (these are parsed by godoc.org)
1 parent b9cbe9e commit c6d0018

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sequence/diagram.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package sequence
22

33
import (
44
"fmt"
5-
"github.com/fogleman/gg"
65
"image/color"
76
"log"
7+
8+
"github.com/fogleman/gg"
89
)
910

1011
const (
@@ -21,6 +22,7 @@ const (
2122
height = 1000
2223
)
2324

25+
// Diagram represents a diagram
2426
type Diagram struct {
2527
participants []participant
2628
edges []edge
@@ -32,6 +34,7 @@ type Diagram struct {
3234
filename string
3335
}
3436

37+
// NewDiagram init function
3538
func NewDiagram(filename string) *Diagram {
3639
coordMap := make(map[string]participantCoord)
3740

@@ -41,6 +44,7 @@ func NewDiagram(filename string) *Diagram {
4144
}
4245
}
4346

47+
// Render generates an image from a `Diagram` object
4448
func (d *Diagram) Render() {
4549
d.dc = gg.NewContext(width, height)
4650
d.dc.DrawRectangle(0, 0, width, height)
@@ -186,6 +190,7 @@ func (d *Diagram) renderEdges() {
186190
}
187191
}
188192

193+
// AddParticipants sets the `participant` array on the Diagram object
189194
func (d *Diagram) AddParticipants(name ...string) {
190195
for _, n := range name {
191196
for i := range d.participants {
@@ -197,6 +202,7 @@ func (d *Diagram) AddParticipants(name ...string) {
197202
}
198203
}
199204

205+
// AddDirectionalEdge adds a connection (renders as an arrowed line) between two participants
200206
func (d *Diagram) AddDirectionalEdge(from, to string, label string) error {
201207
var fromPar *participant
202208
var toPar *participant
@@ -219,6 +225,7 @@ func (d *Diagram) AddDirectionalEdge(from, to string, label string) error {
219225
return nil
220226
}
221227

228+
// AddUndirectionalEdge adds a connection (renders as a line) between two participants
222229
func (d *Diagram) AddUndirectionalEdge(from, to string, label string) error {
223230
var fromPar *participant
224231
var toPar *participant
@@ -238,6 +245,7 @@ func (d *Diagram) AddUndirectionalEdge(from, to string, label string) error {
238245
return nil
239246
}
240247

248+
// SetTitle sets the diagram's title
241249
func (d *Diagram) SetTitle(s string) {
242250
d.title = s
243251
}

0 commit comments

Comments
 (0)