Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Create beautiful system diagrams with Go

License

NotificationsYou must be signed in to change notification settings

blushft/go-diagrams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast and easy application diagrams

Go-Diagrams is a loose port ofdiagrams.

Contents

Features

Turn this:

d,err:=diagram.New(diagram.Filename("app"),diagram.Label("App"),diagram.Direction("LR"))iferr!=nil {log.Fatal(err)}dns:=gcp.Network.Dns(diagram.NodeLabel("DNS"))lb:=gcp.Network.LoadBalancing(diagram.NodeLabel("NLB"))cache:=gcp.Database.Memorystore(diagram.NodeLabel("Cache"))db:=gcp.Database.Sql(diagram.NodeLabel("Database"))dc:=diagram.NewGroup("GCP")dc.NewGroup("services").Label("Service Layer").Add(gcp.Compute.ComputeEngine(diagram.NodeLabel("Server 1")),gcp.Compute.ComputeEngine(diagram.NodeLabel("Server 2")),gcp.Compute.ComputeEngine(diagram.NodeLabel("Server 3")),    ).ConnectAllFrom(lb.ID(),diagram.Forward()).ConnectAllTo(cache.ID(),diagram.Forward())dc.NewGroup("data").Label("Data Layer").Add(cache,db).Connect(cache,db)d.Connect(dns,lb,diagram.Forward()).Group(dc)iferr:=d.Render();err!=nil {log.Fatal(err)}

Into this:

app-diagram

Usage

go get github.com/blushft/go-diagrams

Create a diagram:

d,err:=diagram.New(diagram.Label("my-diagram"),diagram.Filename("diagram"))iferr!=nil {log.Fatal(err)}fw:=generic.Network.Firewall().Label("fw")sw:=generic.Network.Switch().Label("sw")d.Connect(fw,sw)

Render the output:

iferr:=d.Render();err!=nil {log.Fatal(err)}

Go-Diagrams will create a folder in the current working directory with the graphviz DOT file and any image assets.

Create an ouput image with any graphviz compatible renderer:

dot -Tpng diagram.dot> diagram.png

About

Create beautiful system diagrams with Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp