Documentation ¶
Index ¶
- Variables
- type Changelog
- func (l *Changelog) Add(ver Version, changes Changes) error
- func (l *Changelog) GetChanges(ver Version) (Changes, bool)
- func (l *Changelog) GetDiff(from, to Version) Changes
- func (l *Changelog) GetLatestVersion() Version
- func (l *Changelog) GetSortedVersions() []Version
- func (l *Changelog) Release(ver Version) error
- func (l *Changelog) ToMarkdown() string
- type Changes
- type ChangesKind
- type ChangesMajority
- type Version
- func (v Version) BumpMajor() Version
- func (v Version) BumpMinor() Version
- func (v Version) BumpPatch() Version
- func (v Version) Equal(ver Version) bool
- func (v Version) GetDate() time.Time
- func (v Version) GetVersion() VersionString
- func (v Version) GreaterThan(ver Version) bool
- func (v Version) IsCommon() bool
- func (v Version) IsLatest() bool
- func (v Version) IsUnrealized() bool
- func (v Version) IsValid() bool
- func (v Version) LessThen(ver Version) bool
- type VersionChanges
- type VersionString
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVersionAlreadyExists = errors.New("version is already exist") ErrNothingToRelease = errors.New("changelog does not contain unreleased changes") )
View Source
var ( Empty = Version{} Unreleased = RequireVersionFromString(UnreleasedValue, nil) Latest = RequireVersionFromString(LatestValue, nil) )
View Source
var ErrNotIsChangesKind = errors.New("the node is not kind of changes")
View Source
var (
ErrNotIsVersion = errors.New("the node is not version")
)
View Source
var MajorityMap = map[ChangesKind]ChangesMajority{ Security: PatchChanges, Fixed: PatchChanges, Deprecated: PatchChanges, Added: MinorChanges, Changed: MinorChanges, Removed: MajorChanges, }
View Source
var OrderedKinds = []ChangesKind{ Security, Fixed, Added, Changed, Removed, Deprecated, }
Functions ¶
This section is empty.
Types ¶
type Changelog ¶
type Changelog struct { Header string Description string Versions map[VersionString]VersionChanges }
func NewChangelog ¶
func NewChangelog(header, description string, versions map[VersionString]VersionChanges) *Changelog
func (*Changelog) GetLatestVersion ¶
func (*Changelog) GetSortedVersions ¶
func (*Changelog) ToMarkdown ¶
type Changes ¶
type Changes map[ChangesKind]string
func NewChanges ¶
func NewChanges() Changes
func (Changes) Get ¶
func (c Changes) Get(kind ChangesKind) string
func (Changes) GetMajority ¶
func (c Changes) GetMajority() ChangesMajority
func (Changes) Has ¶
func (c Changes) Has(kind ChangesKind) bool
func (Changes) Set ¶
func (c Changes) Set(kind ChangesKind, changes string)
func (Changes) ToMarkdown ¶
type ChangesKind ¶
type ChangesKind string
const ( Added ChangesKind = "Added" // for new features. Changed ChangesKind = "Changed" // for changes in existing functionality. Deprecated ChangesKind = "Deprecated" // for soon-to-be removed features. Removed ChangesKind = "Removed" // for now removed features. Fixed ChangesKind = "Fixed" // for any bug fixes. Security ChangesKind = "Security" // in case of vulnerabilities. )
func NewChangesKindFromNode ¶
type ChangesMajority ¶
type ChangesMajority uint
const ( NoChanges ChangesMajority = iota PatchChanges MinorChanges MajorChanges )
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
func NewVersion ¶
func NewVersion(version VersionString, date *time.Time) (Version, error)
func NewVersionFromNode ¶
NewVersionFromNode is method for parsing the version from changelog in markdown format
Valid variations: - [version] - 2000-01-01 - [version] - version - 2000-01-01 - version
The version should be supported by semver or be constant "Unrealized"
func RequireVersionFromString ¶
func RequireVersionFromString(version VersionString, date *time.Time) Version
func (Version) GetVersion ¶
func (v Version) GetVersion() VersionString
func (Version) GreaterThan ¶
func (Version) IsUnrealized ¶
type VersionChanges ¶
func NewVersionChanges ¶
func NewVersionChanges(ver Version, changes Changes) VersionChanges
type VersionString ¶
type VersionString string
const LatestValue VersionString = "Latest"
const UnreleasedValue VersionString = "Unreleased"
Click to show internal directories.
Click to hide internal directories.