catalog

package
v1.2.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

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

View Source
const NewPackageTemplate = `` /* 2940-byte string literal not displayed */
View Source
const NewProjectTemplate = `` /* 206-byte string literal not displayed */

Variables

This section is empty.

Functions

func AlphabeticalApps

func AlphabeticalApps(m map[string]*sysl.Application) []string

AlphabeticalEndpoints sorts a map of Applications alphabetically

func AlphabeticalEndpoints

func AlphabeticalEndpoints(m map[string]*sysl.Endpoint) []string

AlphabeticalEndpoints sorts a map of endpoints alphabetically

func AlphabeticalModules added in v1.2.31

func AlphabeticalModules(m map[string]*sysl.Module) []string

AlphabeticalEndpoints sorts a map of Applications alphabetically

func AlphabeticalParams added in v1.2.31

func AlphabeticalParams(m map[string]*sysl.Param) []string

AlphabeticalEndpoints sorts a map of Package alphabetically

func AlphabeticalTypes added in v1.2.30

func AlphabeticalTypes(m map[string]*sysl.Type) []string

AlphabeticalEndpoints sorts a map of Applications alphabetically

func AppComment added in v1.2.31

func AppComment(application *sysl.Application) string

func Attribute added in v1.2.31

func Attribute(attr string, Attrs map[string]*sysl.Attribute) string

func CreateSequenceDiagram

func CreateSequenceDiagram(m *sysl.Module, call string) (string, error)

CreateSequenceDiagram creates an sequence diagram and returns the sequence diagram string and any errors

func GetAppPackageName

func GetAppPackageName(app *sysl.Application) (string, string)

GetAppPackageName returns the package and app name of any sysl application

func HttpToFile added in v1.2.31

func HttpToFile(url, fileName string, fs afero.Fs) error

func Map added in v1.2.31

func Map(vs []string, f func(string) string) []string

Map applies a function to every element in a string slice

func ModuleAsPackages added in v1.2.31

func ModuleAsPackages(m *sysl.Module) map[string]*sysl.Module

func ModulePackageName added in v1.2.31

func ModulePackageName(m *sysl.Module) string

func NewTypeRef added in v1.2.30

func NewTypeRef(appName, typeName string) *sysl.Type

NewTypeRef returns a type reference, needed to correctly generate data model diagrams

func PlantUMLURL added in v1.2.31

func PlantUMLURL(plantumlService, contents string) (string, error)

PlantUMLURL returns a PlantUML url

func RetryHTTPRequest added in v1.2.31

func RetryHTTPRequest(url string) ([]byte, error)

RetryHTTPRequest retries the given request

func SanitiseOutputName added in v1.2.31

func SanitiseOutputName(s string) string

SanitiseOutputName removes characters so that the string can be used as a hyperlink.

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

func TypeComment added in v1.2.31

func TypeComment(Type *sysl.Type) string

Types

type Generator added in v1.2.31

type Generator struct {
	FilesToCreate   map[string]string
	Title           string
	LiveReload      bool   // Add live reload javascript to html
	ImageTags       bool   // embedded plantuml img tags, or generated svgs
	Format          string // "html" or "markdown"
	OutputDir       string
	OutputFileName  string
	PlantumlService string
	Log             *logrus.Logger
	Fs              afero.Fs
	Module          *sysl.Module
	ProjectTempl    *template.Template // Templ is used to template the Generator struct
	PackageTempl    *template.Template // PackageTempl is passed down to all Packages
}

Generator is the contextual object that is used in the markdown generation

func NewProject

func NewProject(
	title, plantumlservice, outputType string,
	log *logrus.Logger,
	module *sysl.Module,
	fs afero.Fs, outputDir string) *Generator

NewProject generates a Generator object, fs and outputDir are optional if being used for a web server.

func (*Generator) CreateFileName added in v1.2.31

func (p *Generator) CreateFileName(contents string, absolute string, elems ...string) string

CreateFileName 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 (p *Generator) CreateIntegrationDiagram(m *sysl.Module, title string, EPA bool) string

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{})

CreateMarkdown is a wrapper function that also converts output markdown to html if in server mode

func (*Generator) CreateParamDataModel added in v1.2.31

func (p *Generator) CreateParamDataModel(app *sysl.Application, param *sysl.Param) string

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

func (p *Generator) CreateReturnDataModel(stmnt *sysl.Statement, endpoint *sysl.Endpoint) string

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

func (p *Generator) CreateSequenceDiagram(appName string, endpoint *sysl.Endpoint) string

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

func (p *Generator) GetFuncMap() template.FuncMap

GetFuncMap returns the funcs that are used in diagram generation.

func (*Generator) GetParamType added in v1.2.31

func (p *Generator) GetParamType(app *sysl.Application, param *sysl.Param) *sysl.Type

GetReturnType converts an application and a param into a type, useful for getting attributes.

func (*Generator) GetReturnType added in v1.2.31

func (p *Generator) GetReturnType(endpoint *sysl.Endpoint, stmnt *sysl.Statement) *sysl.Type

GetReturnType converts an endpoint and a statement into a type, useful for getting attributes.

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

func (p *Generator) ServerSettings(server, liveReload, imageTags bool) *Generator

ServerSettings sets the server settings, this should be set before using as http handler

func (*Generator) Update added in v1.2.31

func (p *Generator) Update(m *sysl.Module) *Generator

Update loads another Sysl module into a project and runs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL