github.com/rivy-go/git-changelog@v0.0.0-20240424224517-b86e6ab57773/internal/changelog/fields.go (about) 1 package changelog 2 3 import "time" 4 5 // Hash of commit 6 type Hash struct { 7 Long string 8 Short string 9 } 10 11 // Author of commit 12 type Author struct { 13 Name string 14 Email string 15 Date time.Time 16 } 17 18 // Committer of commit 19 type Committer struct { 20 Name string 21 Email string 22 Date time.Time 23 } 24 25 // Merge info for commit 26 type Merge struct { 27 Ref string 28 Source string 29 } 30 31 // Revert info for commit 32 type Revert struct { 33 Header string 34 } 35 36 // Ref is abstract data related to commit. (e.g. `Issues`, `Pull Request`) 37 type Ref struct { 38 Action string // (e.g. `Closes`) 39 Ref string // (e.g. `123`) 40 Source string // (e.g. `owner/repository`) 41 } 42 43 // Note of commit 44 type Note struct { 45 Title string // (e.g. `BREAKING CHANGE`) 46 Body string // `Note` content body 47 } 48 49 // NoteGroup is a collection of `Note` grouped by titles 50 type NoteGroup struct { 51 Title string 52 Notes []*Note 53 } 54 55 // Commit data 56 type Commit struct { 57 Hash *Hash 58 Author *Author 59 Committer *Committer 60 Merge *Merge // If it is not a merge commit, `nil` is assigned 61 Revert *Revert // If it is not a revert commit, `nil` is assigned 62 Refs []*Ref 63 Notes []*Note 64 Mentions []string // Name of the user included in the commit header or body 65 Header string // (e.g. `feat(core): Add new feature`) 66 Type string // (e.g. `feat`) 67 Scope string // (e.g. `core`) 68 Separator string // (e.g. `~` or `:`) 69 Subject string // (e.g. `Add new feature`) 70 Body string 71 } 72 73 // CommitGroup is a collection of commits grouped according to the `CommitGroupBy` option 74 type CommitGroup struct { 75 RawTitle string // Raw title before conversion (e.g. `build`) 76 Title string // Conversion by `CommitGroupTitleMaps` option, or title converted in title case (e.g. `Build`) 77 Commits []*Commit 78 } 79 80 // RelateTag is sibling tag data of `Tag`. 81 // If you give `Tag`, the reference hierarchy will be deepened. 82 // This struct is used to minimize the hierarchy of references 83 type RelateTag struct { 84 Name string 85 Subject string 86 Date time.Time 87 } 88 89 // Tag is data of git-tag 90 type Tag struct { 91 Name string 92 Subject string 93 Date time.Time 94 Next *RelateTag 95 Previous *RelateTag 96 } 97 98 // Version is a tag-separated dataset to be included in CHANGELOG 99 type Version struct { 100 Tag *Tag 101 CommitGroups []*CommitGroup 102 Commits []*Commit 103 MergeCommits []*Commit 104 RevertCommits []*Commit 105 NoteGroups []*NoteGroup 106 } 107 108 // Unreleased is unreleased commit dataset 109 type Unreleased struct { 110 CommitGroups []*CommitGroup 111 Commits []*Commit 112 MergeCommits []*Commit 113 RevertCommits []*Commit 114 NoteGroups []*NoteGroup 115 }