roadmap

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: ISC Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCanvasSizes

func GetCanvasSizes(fw, lh uint64) (uint64, uint64)

func RenderImg

func RenderImg(cvs *canvas.Canvas, fileFormat FileFormat) []byte

Types

type Content

type Content string

Content represents a raw string version of a roadmap

func (Content) ToLines

func (c Content) ToLines() []string

ToLines splits a Content into queries, a slice of strings

func (Content) ToRoadmap

func (c Content) ToRoadmap(id uint64, prevID *uint64, title, dateFormat, baseUrl string, now time.Time) Roadmap

ToRoadmap converts a Content to a Roadmap ready to be persisted or to be turned into a VisualRoadmap which can then be rendered

type Dates

type Dates struct {
	StartAt time.Time `json:"start_at"`
	EndAt   time.Time `json:"end_at"`
}

Dates represents a pair of start end end dates

type DbReadWriter

type DbReadWriter interface {
	Get(c code.Code) (*Roadmap, error)
	Create(roadmap Roadmap) error
}

type FileFormat

type FileFormat string
const (
	SvgFormat FileFormat = "svg"
	PngFormat FileFormat = "png"
)

func NewFormatType

func NewFormatType(t string) (FileFormat, error)

type Handler

type Handler struct {
	Logger *zap.Logger
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(logger *zap.Logger, repo DbReadWriter, cb code.Builder, appVersion, matomoDomain, docBaseURL string, selfHosted bool) *Handler

func (*Handler) CreateRoadmapHTML

func (h *Handler) CreateRoadmapHTML(ctx echo.Context) error

func (*Handler) CreateRoadmapJSON added in v0.10.0

func (h *Handler) CreateRoadmapJSON(ctx echo.Context) error

func (*Handler) GetRoadmapHTML

func (h *Handler) GetRoadmapHTML(ctx echo.Context) error

func (*Handler) GetRoadmapImage

func (h *Handler) GetRoadmapImage(ctx echo.Context) error

func (*Handler) GetRoadmapJSON added in v0.10.0

func (h *Handler) GetRoadmapJSON(ctx echo.Context) error

type IO

type IO struct {
}

IO represents a persistence layer using the file system (or standard i/o)

func NewIO

func NewIO() IO

NewIO creates a IO instance

func (IO) Read

func (frw IO) Read(input string) ([]string, error)

Get reads a Roadmap from the file system (or standard i/o)

func (IO) Write

func (frw IO) Write(output string, content string) error

Create writes a roadmap to the file system (or standard i/o)

type Milestone

type Milestone struct {
	Title      string      `json:"title"`
	DeadlineAt *time.Time  `json:"deadline_at,omitempty"`
	Color      *color.RGBA `json:"color,omitempty"`
	URLs       []string    `json:"urls,omitempty"` // nolint
}

Milestone represents a milestone set for the roadmap

func NewMilestoneStub added in v0.10.0

func NewMilestoneStub(minDate, maxDate time.Time, hasBU bool) Milestone

func (Milestone) String

func (m Milestone) String(dateFormat string) string

String converts a Milestone into a string

type MockDbReadWriter

type MockDbReadWriter struct {
	mock.Mock
}

MockDbReadWriter is an autogenerated mock type for the DbReadWriter type

func (*MockDbReadWriter) Create added in v0.9.0

func (_m *MockDbReadWriter) Create(roadmap Roadmap) error

Create provides a mock function with given fields: roadmap

func (*MockDbReadWriter) Get

func (_m *MockDbReadWriter) Get(c code.Code) (*Roadmap, error)

Get provides a mock function with given fields: c

type Project

type Project struct {
	Indentation uint8       `json:"indentation"`
	Title       string      `json:"title"`
	Dates       *Dates      `json:"dates,omitempty"`
	Color       *color.RGBA `json:"color,omitempty"`
	Percentage  uint8       `json:"percentage"`
	URLs        []string    `json:"urls,omitempty"` // nolint
	Milestone   uint8       `json:"milestone,omitempty"`
}

Project represents a project that belongs to a Roadmap

func NewProjectStub added in v0.10.0

func NewProjectStub(milestoneCount, ind int, minDate, maxDate time.Time, hasBU bool) Project

func (Project) String

func (p Project) String(dateFormat string) string

String converts a Project into a string

type Repository

type Repository struct {
	repository.PgRepository
}

Repository represents a persistence layer using a database (Postgres)

func (Repository) Create added in v0.9.0

func (drw Repository) Create(roadmap Roadmap) error

Create writes a roadmap to the database

func (Repository) Get

func (drw Repository) Get(code code.Code) (*Roadmap, error)

Get retrieves a Roadmap from the database

type Roadmap

type Roadmap struct {
	ID         uint64
	PrevID     *uint64
	Title      string
	DateFormat string
	BaseURL    string
	Projects   []Project
	Milestones []Milestone
	CreatedAt  time.Time
	UpdatedAt  time.Time
	AccessedAt time.Time
}

Roadmap represents a roadmap, the main entity of Roadmapper

func (Roadmap) String

func (r Roadmap) String() string

String converts a Roadmap into a string

func (Roadmap) ToContent

func (r Roadmap) ToContent() Content

ToContent converts a Roadmap into a Content

func (Roadmap) ToDates

func (r Roadmap) ToDates() *Dates

ToDates converts a Roadmap into a Dates pointer

func (Roadmap) ToExchange added in v0.10.0

func (r Roadmap) ToExchange() RoadmapExchange

func (Roadmap) ToVisual

func (r Roadmap) ToVisual() *VisualRoadmap

ToVisual converts a roadmap to a visual roadmap main difference between the two is that the visual roadmap will contain calculated values where possible

type RoadmapExchange added in v0.10.0

type RoadmapExchange struct {
	ID         string      `json:"id,omitempty"`
	PrevID     *string     `json:"prev_id,omitempty"`
	Title      string      `json:"title"`
	DateFormat string      `json:"date_format"`
	BaseURL    string      `json:"base_url,omitempty"`
	Projects   []Project   `json:"projects,omitempty"`
	Milestones []Milestone `json:"milestones,omitempty"`
}

Roadmap represents a roadmap, the main entity of Roadmapper

func NewRoadmapExchangeStub added in v0.10.0

func NewRoadmapExchangeStub(minProjects, minMilestones int, minDate, maxDate time.Time) RoadmapExchange

func (RoadmapExchange) ToRoadmap added in v0.10.0

func (re RoadmapExchange) ToRoadmap() Roadmap

type VisualRoadmap

type VisualRoadmap struct {
	Title      string
	Projects   []Project
	Milestones []Milestone
	Dates      *Dates
	DateFormat string
}

VisualRoadmap represent a roadmap in a way that is prepared for visualization

func (*VisualRoadmap) Draw

func (vr *VisualRoadmap) Draw(fullW, lineH float64, withToday bool) *canvas.Canvas

Draw will draw a roadmap on a canvas.Canvas

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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