convention

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BumpType

type BumpType string
const (
	BumpMajor BumpType = "major"
	BumpMinor BumpType = "minor"
	BumpPatch BumpType = "patch"
	BumpMicro BumpType = "micro"
)

type CalverConvention

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

func NewCalverConvention

func NewCalverConvention(config Config) (*CalverConvention, error)

func (*CalverConvention) CreateInitial

func (s *CalverConvention) CreateInitial(prefix string) Version

func (*CalverConvention) GetIncrementOptions

func (s *CalverConvention) GetIncrementOptions() []string

func (*CalverConvention) Name

func (s *CalverConvention) Name() string

func (*CalverConvention) Parse

func (s *CalverConvention) Parse(tagStr string) (Version, error)

func (*CalverConvention) ValidateFormat

func (s *CalverConvention) ValidateFormat(format string) error

type CalverVersion

type CalverVersion struct {
	Prefix string    `json:"prefix,omitempty"`
	Year   int       `json:"year"`
	Month  int       `json:"month"`
	Day    int       `json:"day"`
	Micro  int       `json:"micro"`
	Format string    `json:"format"`
	Date   time.Time `json:"date"`
}

func (*CalverVersion) Compare

func (v *CalverVersion) Compare(other Version) int

func (*CalverVersion) GetComponents

func (v *CalverVersion) GetComponents() map[string]any

func (*CalverVersion) Increment

func (v *CalverVersion) Increment(component string) error

func (*CalverVersion) String

func (v *CalverVersion) String() string

type Config

type Config struct {
	Prefix   string
	Format   string
	Timezone string
}

type Convention

type Convention interface {
	Name() string
	Parse(tagStr string) (Version, error)
	CreateInitial(prefix string) Version
	GetIncrementOptions() []string
	ValidateFormat(format string) error
}

func New

func New(name string, config Config) (Convention, error)

type SemverConvention

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

func NewSemverConvention

func NewSemverConvention(config Config) *SemverConvention

func (*SemverConvention) CreateInitial

func (s *SemverConvention) CreateInitial(prefix string) Version

func (*SemverConvention) GetIncrementOptions

func (s *SemverConvention) GetIncrementOptions() []string

func (*SemverConvention) Name

func (s *SemverConvention) Name() string

func (*SemverConvention) Parse

func (s *SemverConvention) Parse(tagStr string) (Version, error)

func (*SemverConvention) ValidateFormat

func (s *SemverConvention) ValidateFormat(format string) error

type SemverVersion

type SemverVersion struct {
	Prefix string `json:"prefix,omitempty"`
	Major  int    `json:"major"`
	Minor  int    `json:"minor"`
	Patch  int    `json:"patch"`
}

func (*SemverVersion) Compare

func (v *SemverVersion) Compare(other Version) int

func (*SemverVersion) GetComponents

func (v *SemverVersion) GetComponents() map[string]any

func (*SemverVersion) Increment

func (v *SemverVersion) Increment(component string) error

func (*SemverVersion) String

func (v *SemverVersion) String() string

type Version

type Version interface {
	String() string
	Increment(component string) error
	Compare(other Version) int
	GetComponents() map[string]any
}

Jump to

Keyboard shortcuts

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