ticket

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ticket provides types and functions related to tickets in a task tracking system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Name

type Name string

Name represents the name of a task tracker ticket. It is a string that identifies the ticket and is used for display purposes.

func NewName

func NewName(name string) Name

NewName creates a new Name instance from a given string.

func (Name) Empty

func (n Name) Empty() bool

Empty checks if the Name is empty.

func (Name) Equals

func (n Name) Equals(other Name) bool

Equals checks if two Name instances are equal.

func (Name) String

func (n Name) String() string

String returns the string representation of the Name.

type Ticket

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

Ticket represents a task tracker ticket.

func NewTicket

func NewTicket(name Name) Ticket

NewTicket creates a new Ticket instance with the given Name.

func ParseTicket

func ParseTicket(s string, re *regexp.Regexp) Ticket

ParseTicket extracts a Ticket from the given string using the provided regular expression.

The regular expression should contain a capturing group that matches the ticket name. If the string is empty or does not match the regular expression, an empty Ticket is returned.

Example usage:

re := regexp.MustCompile(`^((?:TASK|PROJ|BUG)-\d+)`)
t := ParseTicket("TASK-1234 add new feature", re)
fmt.Println(t.Name()) // Output: TASK-1234

func (Ticket) Empty

func (t Ticket) Empty() bool

Empty checks if the Ticket is empty, which is determined by whether its Name is empty.

func (Ticket) Equals

func (t Ticket) Equals(other Ticket) bool

Equals checks if two Ticket instances are equal based on their Name.

func (Ticket) Name

func (t Ticket) Name() Name

Name returns the Name of the Ticket.

func (Ticket) String

func (t Ticket) String() string

String returns the string representation of the Ticket, which is the string representation of its Name.

Jump to

Keyboard shortcuts

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