sequence

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sequence is mermaid sequence diagram builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MirrorActors turns on/off the rendering of actors
	// below the diagram as well as above it.
	// Default is false.
	MirrorActors bool
	// BottomMariginAdjustment Adjusts how far down the graph ended.
	// Wide borders styles with css could generate unwanted clipping which is why this config param exists.
	// Default is 1.
	BottomMariginAdjustment uint
	// ActorFontSize is the font size of the actors.
	// Default is 14.
	ActorFontSize uint
	// ActorFontFamily sets the font family for the actor's description.
	// Default is "Open Sans", sans-serif.
	ActorFontFamily string
	// ActorFontWeight sets the font weight for the actor's description
	// Default is "Open Sans", sans-serif.
	ActorFontWeight string
	// NoteFontSize is the font size of the notes.
	// Default is 14.
	NoteFontSize uint
	// NoteFontFamily sets the font family for the note's description.
	// Default is "trebuchet ms", verdana, arial
	NoteFontFamily string
	// NoteFontWeight sets the font weight for the note's description.
	// Default is "trebuchet ms", verdana, arial
	NoteFontWeight string
	// NoteAlign sets the alignment of the note's description.
	// Default is "center"
	NoteAlign string
	// MessageFontSize is the font size of the messages.
	// Default is 16.
	MessageFontSize uint
	// MessageFontFamily sets the font family for actor<->actor messages
	// Default is "trebuchet ms", verdana, arial
	MessageFontFamily string
	// MessageFontWeight sets the font weight for actor<->actor messages
	// Default is "trebuchet ms", verdana, arial
	MessageFontWeight string
}

Config is the configuration for the sequence diagram. Ref. https://mermaid.js.org/syntax/sequenceDiagram.html

func NewConfig

func NewConfig() *Config

NewConfig returns a new Config with default values.

type Diagram

type Diagram struct {
	// contains filtered or unexported fields
}

Diagram is a sequence diagram builder.

func NewDiagram

func NewDiagram(w io.Writer, config ...*Config) *Diagram

NewDiagram returns a new Diagram. Now, Config is not used.

func (*Diagram) Activate

func (d *Diagram) Activate(participant string) *Diagram

Activate add a participant to the sequence diagram.

func (*Diagram) Actor

func (d *Diagram) Actor(actor string) *Diagram

Actor add a participant to the sequence diagram.

func (*Diagram) AltElse

func (d *Diagram) AltElse(description string) *Diagram

AltElse add a alt to the sequence diagram.

func (*Diagram) AltEnd

func (d *Diagram) AltEnd() *Diagram

AltEnd add a alt to the sequence diagram.

func (*Diagram) AltStart

func (d *Diagram) AltStart(description string) *Diagram

AltStart add a alt to the sequence diagram.

func (*Diagram) AsyncRequest

func (d *Diagram) AsyncRequest(from, to, message string) *Diagram

AsyncRequest add a async request to the sequence diagram.

func (*Diagram) AsyncRequestWithActivation

func (d *Diagram) AsyncRequestWithActivation(from, to, message string) *Diagram

AsyncRequestWithActivation add a async request to the sequence diagram.

func (*Diagram) AsyncRequestf

func (d *Diagram) AsyncRequestf(from, to, format string, args ...any) *Diagram

AsyncRequestf add a async request to the sequence diagram.

func (*Diagram) AsyncRequestfWithActivation

func (d *Diagram) AsyncRequestfWithActivation(from, to, format string, args ...any) *Diagram

AsyncRequestfWithActivation add a async request to the sequence diagram.

func (*Diagram) AsyncResponse

func (d *Diagram) AsyncResponse(from, to, message string) *Diagram

AsyncResponse add a async response to the sequence diagram.

func (*Diagram) AsyncResponseWithActivation

func (d *Diagram) AsyncResponseWithActivation(from, to, message string) *Diagram

AsyncResponseWithActivation add a async response to the sequence diagram.

func (*Diagram) AsyncResponsef

func (d *Diagram) AsyncResponsef(from, to, format string, args ...any) *Diagram

AsyncResponsef add a async response to the sequence diagram.

func (*Diagram) AsyncResponsefWithActivation

func (d *Diagram) AsyncResponsefWithActivation(from, to, format string, args ...any) *Diagram

AsyncResponsefWithActivation add a async response to the sequence diagram.

func (*Diagram) AutoNumber

func (d *Diagram) AutoNumber() *Diagram

AutoNumber add auto number to the sequence diagram.

func (*Diagram) BoxEnd

func (d *Diagram) BoxEnd() *Diagram

BoxEnd add a box to the sequence diagram.

func (*Diagram) BoxStart

func (d *Diagram) BoxStart(participant []string) *Diagram

BoxStart add a box to the sequence diagram.

func (*Diagram) BreakEnd

func (d *Diagram) BreakEnd() *Diagram

BreakEnd add a break to the sequence diagram.

func (*Diagram) BreakStart

func (d *Diagram) BreakStart(description string) *Diagram

BreakStart add a break to the sequence diagram.

func (*Diagram) Build

func (d *Diagram) Build() error

Build writes the sequence diagram body to the output destination.

func (*Diagram) CreateActor

func (d *Diagram) CreateActor(actor string) *Diagram

CreateActor add a participant to the sequence diagram.

func (*Diagram) CreateParticipant

func (d *Diagram) CreateParticipant(participant string) *Diagram

CreateParticipant add a participant to the sequence diagram.

func (*Diagram) CriticalEnd

func (d *Diagram) CriticalEnd() *Diagram

CriticalEnd add a critical to the sequence diagram.

func (*Diagram) CriticalOption

func (d *Diagram) CriticalOption(description string) *Diagram

CriticalOption add a critical opiton to the sequence diagram.

func (*Diagram) CriticalStart

func (d *Diagram) CriticalStart(description string) *Diagram

CriticalStart add a critical to the sequence diagram.

func (*Diagram) Deactivate

func (d *Diagram) Deactivate(participant string) *Diagram

Deactivate add a participant to the sequence diagram.

func (*Diagram) DestroyActor

func (d *Diagram) DestroyActor(actor string) *Diagram

DestroyActor add a participant to the sequence diagram.

func (*Diagram) DestroyParticipant

func (d *Diagram) DestroyParticipant(participant string) *Diagram

DestroyParticipant add a participant to the sequence diagram.

func (*Diagram) Error

func (d *Diagram) Error() error

Error returns the error that occurred during the sequence diagram building.

func (*Diagram) LF

func (d *Diagram) LF() *Diagram

func (*Diagram) LoopEnd

func (d *Diagram) LoopEnd() *Diagram

LoopEnd add a loop to the sequence diagram.

func (*Diagram) LoopStart

func (d *Diagram) LoopStart(description string) *Diagram

LoopStart add a loop to the sequence diagram.

func (*Diagram) NoteLeftOf

func (d *Diagram) NoteLeftOf(participant, message string) *Diagram

NoteLeftOf add a note to the sequence diagram.

func (*Diagram) NoteOver

func (d *Diagram) NoteOver(participant, message string) *Diagram

NoteOver add a note to the sequence diagram.

func (*Diagram) NoteRightOf

func (d *Diagram) NoteRightOf(participant, message string) *Diagram

NoteRightOf add a note to the sequence diagram.

func (*Diagram) OptEnd

func (d *Diagram) OptEnd() *Diagram

OptEnd add a opt to the sequence diagram.

func (*Diagram) OptStart

func (d *Diagram) OptStart(description string) *Diagram

OptStart add a opt to the sequence diagram.

func (*Diagram) ParallelAnd

func (d *Diagram) ParallelAnd(description string) *Diagram

ParallelAnd add a parallel to the sequence diagram.

func (*Diagram) ParallelEnd

func (d *Diagram) ParallelEnd() *Diagram

ParallelEnd add a parallel to the sequence diagram.

func (*Diagram) ParallelStart

func (d *Diagram) ParallelStart(description string) *Diagram

ParallelStart add a parallel to the sequence diagram.

func (*Diagram) Participant

func (d *Diagram) Participant(participant string) *Diagram

Participant add a participant to the sequence diagram.

func (*Diagram) RequestError

func (d *Diagram) RequestError(from, to, message string) *Diagram

RequestError add a request error to the sequence diagram.

func (*Diagram) RequestErrorf

func (d *Diagram) RequestErrorf(from, to, format string, args ...any) *Diagram

RequestErrorf add a request error to the sequence diagram.

func (*Diagram) ResponseError

func (d *Diagram) ResponseError(from, to, message string) *Diagram

ResponseError add a response error to the sequence diagram.

func (*Diagram) ResponseErrorf

func (d *Diagram) ResponseErrorf(from, to, format string, args ...any) *Diagram

ResponseErrorf add a response error to the sequence diagram.

func (*Diagram) String

func (d *Diagram) String() string

String returns the sequence diagram body.

func (*Diagram) SyncRequest

func (d *Diagram) SyncRequest(from, to, message string) *Diagram

SyncRequest add a request to the sequence diagram.

func (*Diagram) SyncRequestWithActivation

func (d *Diagram) SyncRequestWithActivation(from, to, message string) *Diagram

SyncRequestWithActivation add a request to the sequence diagram.

func (*Diagram) SyncRequestf

func (d *Diagram) SyncRequestf(from, to, format string, args ...any) *Diagram

SyncRequestf add a request to the sequence diagram.

func (*Diagram) SyncRequestfWithActivation

func (d *Diagram) SyncRequestfWithActivation(from, to, format string, args ...any) *Diagram

SyncRequestfWithActivation add a request to the sequence diagram.

func (*Diagram) SyncResponse

func (d *Diagram) SyncResponse(from, to, message string) *Diagram

SyncResponse add a response to the sequence diagram.

func (*Diagram) SyncResponseWithActivation

func (d *Diagram) SyncResponseWithActivation(from, to, message string) *Diagram

SyncResponseWithActivation add a response to the sequence diagram.

func (*Diagram) SyncResponsef

func (d *Diagram) SyncResponsef(from, to, format string, args ...any) *Diagram

SyncResponsef add a response to the sequence diagram.

func (*Diagram) SyncResponsefWithActivation

func (d *Diagram) SyncResponsefWithActivation(from, to, format string, args ...any) *Diagram

SyncResponsefWithActivation add a response to the sequence diagram.

type NotePosition

type NotePosition string

NotePosition is a note position.

const (
	// NotePositionOver is a note position.
	NotePositionOver NotePosition = "over"
	// NotePositionRight is a note position.
	NotePositionRight NotePosition = "right of"
	// NotePositionLeft is a note position.
	NotePositionLeft NotePosition = "left of"
)

Jump to

Keyboard shortcuts

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