gopuml

command module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 1 Imported by: 0

README

Go PULM

Go API for Plant UML

Constructors

NewPlantUML() PlantUML

Instance a new PlantUML implementation.

puml := NewPlantUML()

NewPlantUMLClient(url string) (PlantUMLClient, error)

Instance a new PlantUMLClient implementation.

cli, err := NewPlantUMLClient("https://www.plantuml.com/plantuml")

API Reference

PlantUML Interface

StartUml() UML

Start a new UML diagram and returns its implementation.

uml := puml.StartUml()

UML Interface

Title(title string) UML

Adds a title to the diagram.

uml.Title("The UML Diagram")
Skinparam(param string, value string) UML

Adds a Skinparam to the diagram.

uml.Skinparam("responseMessageBelowArrow", "true")
Participant(displayName string, name string) UML

Adds a new Participant to the diagram.

uml.Participant("Service", "srv")

It will translate in puml as: participant Service as srv

ArrowR(from string, to string, msg string) UML

Adds an arrow to the diagram.

uml.ArrowR("srv1", "srv2", "msg")

It will translate in puml as: srv1->srv2: msg

ArrowL(from string, to string, msg string) UML

Adds an arrow with style to the diagram

uml.ArrowL("srv1", "srv2", "msg")

It will translate in puml as: srv1<-srv2: msg

String() string

Returns the UML diagram as string representation. Understands this method as Marshal.

diagram := uml.String()

PlantUMLClient

Rest Client that render a PlantUML diagram.

CompressDiagram(diagram []byte) (string, error)

Compress the diagram by Deflate and after encode to PlantUML B64

diag, err := cli.CompressDiagram([]byte(`@startuml
actor1->actor2: Hello World
@enduml`))
Render(renderType PlantUMLRender, diagram []byte) (string, []byte, error)

Render a diagram from bytes to specified Render Type.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.Render(SVG, []byte(`@startuml
actor1->actor2: Hello World
@enduml`))
RenderFile(PlantUMLRender, string) (string, []byte, error)

Render a diagram from file to specified Render Type.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.RenderFile(PlantUMLRender, "./diagram.puml")
BytesToSVG([]byte) (string, []byte, error)

Render a diagram from bytes to SVG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.BytesToSVG([]byte(`@startuml
actor1->actor2: Hello World
@enduml`))
StringToSVG(string) (string, []byte, error)

Render a diagram from string to SVG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.StringToSVG(`@startuml
actor1->actor2: Hello World
@enduml`)
FileToSVG(string) (string, []byte, error)

Render a diagram from file to SVG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.FileToSVG("./my-diagram.puml")
BytesToPNG([]byte) (string, []byte, error)

Render a diagram from bytes to PNG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.BytesToPNG([]byte(`@startuml
actor1->actor2: Hello World
@enduml`))
StringToPNG(string) (string, []byte, error)

Render a diagram from string to PNG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.StringToPNG(`@startuml
actor1->actor2: Hello World
@enduml`)
FileToPNG(string) (string, []byte, error)

Render a diagram from file to PNG.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.FileToPNG("./my-diagram.puml")
BytesToASCII([]byte) (string, []byte, error)

Render a diagram from bytes to ASCII.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.BytesToASCII([]byte(`@startuml
actor1->actor2: Hello World
@enduml`))
StringToASCII(string) (string, []byte, error)

Render a diagram from string to ASCII.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.StringToASCII(`@startuml
actor1->actor2: Hello World
@enduml`)
FileToASCII(string) (string, []byte, error)

Render a diagram from file to ASCII.

Retrieves the: Generated URL for render, Rendered Diagram, Error.

url, render, err := cli.FileToASCII("./my-diagram.puml")

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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