github.com/brandonmanuel/git-chglog@v0.0.0-20200903004639-7a62fa08787a/fields.go (about)

     1  package chglog
     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  	Subject   string   // (e.g. `Add new feature`)
    69  	Body      string
    70  }
    71  
    72  // CommitGroup is a collection of commits grouped according to the `CommitGroupBy` option
    73  type CommitGroup struct {
    74  	RawTitle string // Raw title before conversion (e.g. `build`)
    75  	Title    string // Conversion by `CommitGroupTitleMaps` option, or title converted in title case (e.g. `Build`)
    76  	Commits  []*Commit
    77  }
    78  
    79  // RelateTag is sibling tag data of `Tag`.
    80  // If you give `Tag`, the reference hierarchy will be deepened.
    81  // This struct is used to minimize the hierarchy of references
    82  type RelateTag struct {
    83  	Name    string
    84  	Subject string
    85  	Date    time.Time
    86  }
    87  
    88  // Tag is data of git-tag
    89  type Tag struct {
    90  	Name     string
    91  	Subject  string
    92  	Date     time.Time
    93  	Next     *RelateTag
    94  	Previous *RelateTag
    95  }
    96  
    97  // Version is a tag-separeted datset to be included in CHANGELOG
    98  type Version struct {
    99  	Tag           *Tag
   100  	CommitGroups  []*CommitGroup
   101  	Commits       []*Commit
   102  	MergeCommits  []*Commit
   103  	RevertCommits []*Commit
   104  	NoteGroups    []*NoteGroup
   105  }
   106  
   107  // Unreleased is unreleased commit dataset
   108  type Unreleased struct {
   109  	CommitGroups  []*CommitGroup
   110  	Commits       []*Commit
   111  	MergeCommits  []*Commit
   112  	RevertCommits []*Commit
   113  	NoteGroups    []*NoteGroup
   114  }