catalog

package
v0.0.0-...-b5c0664 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 26 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)

util.go: misc functions to convert/send http requests/sort maps

Index

Constants

View Source
const AllInOneTemplate = `` /* 5513-byte string literal not displayed */
View Source
const EndTags = `</div>
</body>
</html>`
View Source
const GithubStyle = `` /* 3020-byte string literal not displayed */
View Source
const Header = `` /* 171-byte string literal not displayed */

Variables

This section is empty.

Functions

func Attribute

func Attribute(a Attr, query string) string

func CreateFileName

func CreateFileName(dir string, elems ...string) (string, string)

CreateFileName returns the absolute and relative filepaths

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 FieldType

func FieldType(t *sysl.Type) string

func Fields

func Fields(t *sysl.Type) map[string]*sysl.Type

func Filter

func Filter(vs []string, f func(string) bool) []string

Map applies a function to every element in a string slice

func GenerateCatalog

func GenerateCatalog(module []byte, templ, plantuml string) (string, error)

func GetAppPackageName

func GetAppPackageName(a Namer) (string, string)

GetAppPackageName returns the package and app name of any sysl application

func GetAppTypeName

func GetAppTypeName(param Typer) (appName string, typeName string)

GetAppTypeName takes a Sysl Type and returns the appName and typeName of a param If the type is a primitive, the appName returned is "primitive"

func GetPackageName

func GetPackageName(m *sysl.Module, a Namer) string

func ModulePackageName

func ModulePackageName(m *sysl.Module) string

func NewTypeRef

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

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

func PlantUMLURL

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

PlantUMLURL returns a PlantUML url

func SanitiseOutputName

func SanitiseOutputName(s string) string

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

func ServiceMetadata

func ServiceMetadata(a Attr) string

func SortedKeys

func SortedKeys(m interface{}) []string

func TernaryOperator

func TernaryOperator(condition bool, i ...interface{}) interface{}

TernaryOperator returns the first element if bool is true and the second element is false

func UnmarshallJson

func UnmarshallJson(b []byte, m *sysl.Module) error

Unmarshall Json unmarshalls json bytes into a sysl module

Types

type Attr

type Attr interface {
	GetAttrs() map[string]*sysl.Attribute
}

type Generator

type Generator struct {
	RootModule      *sysl.Module
	SourceFileName  string
	ProjectTitle    string
	PlantumlService string
	Interceptor     func(string, ...string) string

	Log *logrus.Logger
}

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

func NewProject

func NewProject(
	titleAndFileName, plantumlService string,
	logger *logrus.Logger,
	module *sysl.Module) *Generator

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

func NewProjectFromJson

func NewProjectFromJson(
	titleAndFileName, plantumlService string,
	logger *logrus.Logger,
	module []byte) *Generator

NewProjectFromJson generates a generator object with a json byte input (of a sysl module) instead of a sysl module

func (*Generator) CreateIntegrationDiagram

func (p *Generator) CreateIntegrationDiagram(m *sysl.Module, title string, EPA bool) string

CreateIntegrationDiagram creates an integration diagram and returns the filename

func (*Generator) CreateParamDataModel

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

CreateParamDataModel creates a parameter data model and returns a filename

func (*Generator) CreateReturnDataModel

func (p *Generator) CreateReturnDataModel(appname string, 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

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

CreateSequenceDiagram creates an sequence diagram and returns the filename

func (*Generator) CreateTypeDiagram

func (p *Generator) CreateTypeDiagram(appName, typeName string, t *sysl.Type, recursive bool) string

func (*Generator) CreateTypeDiagramPlantUml

func (p *Generator) CreateTypeDiagramPlantUml(appName, typeName, typeAlias string, t *sysl.Type, recursive bool) string

func (*Generator) GenerateDataModel

func (p *Generator) GenerateDataModel(app *sysl.Application) string

GenerateDataModel generates a data model for all of the types in app

func (*Generator) GetFuncMap

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

GetFuncMap returns the funcs that are used in diagram generation.

func (*Generator) GetParamType

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

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) ModuleAsMacroPackage

func (p *Generator) ModuleAsMacroPackage(m *sysl.Module) map[string]*sysl.Module

func (*Generator) ModuleAsPackages

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

ModuleAsPackages returns a map of [packagename]*sysl.Module

func (*Generator) PlantumlInterceptor

func (p *Generator) PlantumlInterceptor(content string, path ...string) string

type Namer

type Namer interface {
	Attr
	GetName() *sysl.AppName
}

type Param

type Param interface {
	Typer
	GetName() string
}

type SourceCoder

type SourceCoder interface {
	Attr
}

type Typer

type Typer interface {
	GetType() *sysl.Type
}

Jump to

Keyboard shortcuts

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