Documentation ¶
Overview ¶
diagram-creation.go: all the methods attached to the generator object to be used in templating
generator.go: struct for converting sysl modules to documentation (Generator)
markdown-template.go: the markdown template used to template the sysl module
server.go: implements http handler interface so that Generator struct can be used directly as a handler
util.go: misc functions to convert/send http requests/sort maps
Index ¶
- Constants
- func AsSet(in []string) map[string]struct{}
- func Attribute(a Attr, query string) string
- func CreateFileName(dir string, elems ...string) (string, string)
- func CreateSequenceDiagram(m *sysl.Module, call string) (string, error)
- func Filter(vs []string, f func(string) bool) []string
- func GenerateAndWriteMermaidDiagram(fs afero.Fs, fileName string, data string) error
- func GetAppPackageName(a Namer) (string, string)
- func GetAppTypeName(param Typer) (string, string)
- func HttpToFile(fs afero.Fs, fileName, url string) error
- func Map(vs []string, f func(string) string) []string
- func ModulePackageName(m *sysl.Module) string
- func NewTypeRef(appName, typeName string) *sysl.Type
- func PlantUMLURL(plantumlService, contents string) (string, error)
- func RetryHTTPRequest(url string) ([]byte, error)
- func SanitiseOutputName(s string) string
- func SortedKeys(m interface{}) []string
- func TernaryOperator(condition bool, i ...interface{}) interface{}
- type Attr
- type Generator
- func (p *Generator) CreateFile(contents string, diagramType int, elems ...string) string
- func (p *Generator) CreateIntegrationDiagram(m *sysl.Module, title string, EPA bool) string
- func (p *Generator) CreateIntegrationDiagramMermaid(m *sysl.Module, title string, EPA bool) string
- func (p *Generator) CreateIntegrationDiagramPlantuml(m *sysl.Module, title string, EPA bool) string
- func (p *Generator) CreateMarkdown(t *template.Template, outputFileName string, i interface{}) error
- func (p *Generator) CreateParamDataModel(app *sysl.Application, param *sysl.Param) string
- func (p *Generator) CreatePathParamDataModel(CurrentAppName string, param *sysl.Endpoint_RestParams_QueryParam) string
- func (p *Generator) CreateQueryParamDataModel(CurrentAppName string, param *sysl.Endpoint_RestParams_QueryParam) string
- func (p *Generator) CreateReturnDataModel(stmnt *sysl.Statement, endpoint *sysl.Endpoint) string
- func (p *Generator) CreateSequenceDiagram(appName string, endpoint *sysl.Endpoint) string
- func (p *Generator) CreateTypeDiagram(app *sysl.Application, typeName string, t *sysl.Type, recursive bool) string
- func (p *Generator) GenerateDataModel(app *sysl.Application) string
- func (p *Generator) GetFuncMap() template.FuncMap
- func (p *Generator) GetParamType(app *sysl.Application, param *sysl.Param) *sysl.Type
- func (p *Generator) GetReturnType(endpoint *sysl.Endpoint, stmnt *sysl.Statement) *sysl.Type
- func (p *Generator) GetRows(module *sysl.Module) []string
- func (p *Generator) ModuleAsMacroPackage(m *sysl.Module) map[string]map[string]*sysl.Module
- func (p *Generator) ModuleAsPackages(m *sysl.Module) map[string]*sysl.Module
- func (p *Generator) Run()
- func (p *Generator) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *Generator) ServerSettings(disableCSS, liveReload, imageTags bool) *Generator
- func (p *Generator) SetOptions(disableCss, disableImages bool) *Generator
- func (p *Generator) Update(m *sysl.Module, errs ...error) *Generator
- func (p *Generator) WithTemplateFiles(p1, p2 afero.File) *Generator
- func (p *Generator) WithTemplateString(p1, p2 string) *Generator
- type Namer
- type Typer
Constants ¶
const NewPackageTemplate = `` /* 2921-byte string literal not displayed */
const NewProjectTemplate = `` /* 371-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func CreateFileName ¶ added in v1.3.0
CreateFileName returns the absolute and relative filepaths
func CreateSequenceDiagram ¶
CreateSequenceDiagram creates an sequence diagram and returns the sequence diagram string and any errors
func GenerateAndWriteMermaidDiagram ¶ added in v1.3.0
GenerateAndWriteMermaidDiagram writes a mermaid svg to file
func GetAppPackageName ¶
GetAppPackageName returns the package and app name of any sysl application
func GetAppTypeName ¶ added in v1.3.0
GetAppTypeName returns the appName and typeName of a param
func ModulePackageName ¶ added in v1.2.31
func NewTypeRef ¶ added in v1.2.30
NewTypeRef returns a type reference, needed to correctly generate data model diagrams
func PlantUMLURL ¶ added in v1.2.31
PlantUMLURL returns a PlantUML url
func RetryHTTPRequest ¶ added in v1.2.31
RetryHTTPRequest retries the given request
func SanitiseOutputName ¶ added in v1.2.31
SanitiseOutputName removes characters so that the string can be used as a hyperlink.
func SortedKeys ¶ added in v1.3.0
func SortedKeys(m interface{}) []string
func TernaryOperator ¶ added in v1.2.31
func TernaryOperator(condition bool, i ...interface{}) interface{}
TernaryOperator returns the first element if bool is true and the second element is false
Types ¶
type Generator ¶ added in v1.2.31
type Generator struct { FilesToCreate map[string]string MermaidFilesToCreate map[string]string SourceFileName string Title string LiveReload bool // Add live reload javascript to html ImageTags bool // embedded plantuml img tags, or generated svgs DisableCss bool // used for rendering raw markdown DisableImages bool // used for omitting image creation Mermaid bool Format string // "html" or "markdown" or "" if custom CurrentDir string Ext string OutputDir string OutputFileName string PlantumlService string Log *logrus.Logger Fs afero.Fs Module *sysl.Module ProjectTempl *template.Template PackageTempl *template.Template // contains filtered or unexported fields }
Generator is the contextual object that is used in the markdown generation
func NewProject ¶
func NewProject( titleAndFileName, plantumlService, outputType string, log *logrus.Logger, module *sysl.Module, fs afero.Fs, outputDir string, mermaidEnabled bool) *Generator
NewProject generates a Generator object, fs and outputDir are optional if being used for a web server.
func (*Generator) CreateFile ¶ added in v1.3.0
CreateFile registers a file that needs to be created in p, or returns the embedded img tag if in server mode
func (*Generator) CreateIntegrationDiagram ¶ added in v1.2.31
func (*Generator) CreateIntegrationDiagramMermaid ¶ added in v1.3.0
TODO @ashwinsajiv: fill out this function to generate mermaid integration diagrams
func (*Generator) CreateIntegrationDiagramPlantuml ¶ added in v1.3.0
CreateIntegrationDiagram creates an integration diagram and returns the filename
func (*Generator) CreateMarkdown ¶ added in v1.2.31
func (p *Generator) CreateMarkdown(t *template.Template, outputFileName string, i interface{}) error
CreateMarkdown is a wrapper function that also converts output markdown to html if in server mode
func (*Generator) CreateParamDataModel ¶ added in v1.2.31
CreateParamDataModel creates a parameter data model and returns a filename
func (*Generator) CreatePathParamDataModel ¶ added in v1.2.31
func (p *Generator) CreatePathParamDataModel(CurrentAppName string, param *sysl.Endpoint_RestParams_QueryParam) string
CreateQueryParamDataModel returns a Path Parameter data model filename.
func (*Generator) CreateQueryParamDataModel ¶ added in v1.2.31
func (p *Generator) CreateQueryParamDataModel(CurrentAppName string, param *sysl.Endpoint_RestParams_QueryParam) string
CreateQueryParamDataModel returns a Query Parameter data model filename.
func (*Generator) CreateReturnDataModel ¶ added in v1.2.31
CreateReturnDataModel creates a return data model and returns a filename, or empty string if it wasn't a return statement.
func (*Generator) CreateSequenceDiagram ¶ added in v1.2.31
CreateSequenceDiagram creates an sequence diagram and returns the filename
func (*Generator) CreateTypeDiagram ¶ added in v1.2.31
func (p *Generator) CreateTypeDiagram(app *sysl.Application, typeName string, t *sysl.Type, recursive bool) string
CreateTypeDiagram creates a data model diagram and returns the filename
func (*Generator) GenerateDataModel ¶ added in v1.2.31
func (p *Generator) GenerateDataModel(app *sysl.Application) string
GenerateDataModel generates a data model for all of the types in app
func (*Generator) GetFuncMap ¶ added in v1.2.31
GetFuncMap returns the funcs that are used in diagram generation.
func (*Generator) GetParamType ¶ added in v1.2.31
GetReturnType converts an application and a param into a type, useful for getting attributes.
func (*Generator) GetReturnType ¶ added in v1.2.31
GetReturnType converts an endpoint and a statement into a type, useful for getting attributes.
func (*Generator) GetRows ¶ added in v1.3.0
GetRows returns a slice of rows that should be output on the index pages of the markdown
func (*Generator) ModuleAsMacroPackage ¶ added in v1.3.0
func (*Generator) ModuleAsPackages ¶ added in v1.3.0
func (*Generator) Run ¶ added in v1.2.31
func (p *Generator) Run()
Run Executes a project and generates markdown and diagrams to a given filesystem.
func (*Generator) ServeHTTP ¶ added in v1.2.31
func (p *Generator) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is implements the handler interface
func (*Generator) ServerSettings ¶ added in v1.2.31
ServerSettings sets the server settings, this should be set before using as http handler
func (*Generator) SetOptions ¶ added in v1.3.0
func (*Generator) Update ¶ added in v1.2.31
Update loads another Sysl module into a project and runs
func (*Generator) WithTemplateFiles ¶ added in v1.3.0
WithTemplateFileNames loads templates from fs registered in p
func (*Generator) WithTemplateString ¶ added in v1.3.0
WithTemplateFileNames loads template strings into project and package of p respectively