-
Notifications
You must be signed in to change notification settings - Fork 7
/
package.go
43 lines (38 loc) · 1.22 KB
/
package.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package catalog
import (
"fmt"
"path"
"regexp"
"github.com/anz-bank/sysl/pkg/sysl"
)
var re = regexp.MustCompile(`(?m)(?:<:)(?:.*)`)
// Package is the second level where apps and endpoints are specified.
type Package struct {
*sysl.Module
Parent *Project
OutputDir string
PackageName string
OutputFile string
SequenceDiagrams map[string][]*Diagram // map[appName][]*Diagram
DatabaseModel map[string]*Diagram
Types map[string]*DiagramPair
Integration *Diagram
EPAIntegration *Diagram
}
// SequenceDiagramFromEndpoint generates a sequence diagram from a sysl endpoint
func (p Package) SequenceDiagramFromEndpoint(appName string, endpoint *sysl.Endpoint) (*Diagram, error) {
call := fmt.Sprintf("%s <- %s", appName, endpoint.Name)
seq, err := CreateSequenceDiagram(p.Parent.Module, call)
if err != nil {
return nil, err
}
diagram := &Diagram{
Parent: &p,
Endpoint: endpoint,
App: p.Parent.Module.Apps[appName],
OutputDir: path.Join(p.Parent.Output, p.PackageName),
PlantUMLDiagramString: seq,
OutputFileName__: sanitiseOutputName(appName+endpoint.Name) + p.Parent.DiagramExt,
}
return diagram, nil
}