github.com/git-chglog/git-chglog@v0.15.5-0.20240126074033-6a6993d52d69/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  // Contact of co-authors and signers
    12  type Contact struct {
    13  	Name  string
    14  	Email string
    15  }
    16  
    17  // Author of commit
    18  type Author struct {
    19  	Name  string
    20  	Email string
    21  	Date  time.Time
    22  }
    23  
    24  // Committer of commit
    25  type Committer struct {
    26  	Name  string
    27  	Email string
    28  	Date  time.Time
    29  }
    30  
    31  // Merge info for commit
    32  type Merge struct {
    33  	Ref    string
    34  	Source string
    35  }
    36  
    37  // Revert info for commit
    38  type Revert struct {
    39  	Header string
    40  }
    41  
    42  // Ref is abstract data related to commit. (e.g. `Issues`, `Pull Request`)
    43  type Ref struct {
    44  	Action string // (e.g. `Closes`)
    45  	Ref    string // (e.g. `123`)
    46  	Source string // (e.g. `owner/repository`)
    47  }
    48  
    49  // Note of commit
    50  type Note struct {
    51  	Title string // (e.g. `BREAKING CHANGE`)
    52  	Body  string // `Note` content body
    53  }
    54  
    55  // NoteGroup is a collection of `Note` grouped by titles
    56  type NoteGroup struct {
    57  	Title string
    58  	Notes []*Note
    59  }
    60  
    61  // JiraIssue is information about a jira ticket (type, summary, description, and labels)
    62  type JiraIssue struct {
    63  	Type        string
    64  	Summary     string
    65  	Description string
    66  	Labels      []string
    67  }
    68  
    69  // Commit data
    70  type Commit struct {
    71  	Hash        *Hash
    72  	Author      *Author
    73  	Committer   *Committer
    74  	Merge       *Merge  // If it is not a merge commit, `nil` is assigned
    75  	Revert      *Revert // If it is not a revert commit, `nil` is assigned
    76  	Refs        []*Ref
    77  	Notes       []*Note
    78  	Mentions    []string   // Name of the user included in the commit header or body
    79  	CoAuthors   []Contact  // (e.g. `Co-authored-by: user <user@email>`)
    80  	Signers     []Contact  // (e.g. `Signed-off-by: user <user@email>`)
    81  	JiraIssue   *JiraIssue // If no issue id found in header, `nil` is assigned
    82  	Header      string     // (e.g. `feat(core)[RNWY-310]: Add new feature`)
    83  	Type        string     // (e.g. `feat`)
    84  	Scope       string     // (e.g. `core`)
    85  	Subject     string     // (e.g. `Add new feature`)
    86  	JiraIssueID string     // (e.g. `RNWY-310`)
    87  	Body        string
    88  	TrimmedBody string // Body without any Notes/Refs/Mentions/CoAuthors/Signers
    89  }
    90  
    91  // CommitGroup is a collection of commits grouped according to the `CommitGroupBy` option
    92  type CommitGroup struct {
    93  	RawTitle string // Raw title before conversion (e.g. `build`)
    94  	Title    string // Conversion by `CommitGroupTitleMaps` option, or title converted in title case (e.g. `Build`)
    95  	Commits  []*Commit
    96  }
    97  
    98  // RelateTag is sibling tag data of `Tag`.
    99  // If you give `Tag`, the reference hierarchy will be deepened.
   100  // This struct is used to minimize the hierarchy of references
   101  type RelateTag struct {
   102  	Name    string
   103  	Subject string
   104  	Date    time.Time
   105  }
   106  
   107  // Tag is data of git-tag
   108  type Tag struct {
   109  	Name     string
   110  	Subject  string
   111  	Date     time.Time
   112  	Next     *RelateTag
   113  	Previous *RelateTag
   114  }
   115  
   116  // Version is a tag-separeted datset to be included in CHANGELOG
   117  type Version struct {
   118  	Tag           *Tag
   119  	CommitGroups  []*CommitGroup
   120  	Commits       []*Commit
   121  	MergeCommits  []*Commit
   122  	RevertCommits []*Commit
   123  	NoteGroups    []*NoteGroup
   124  }
   125  
   126  // Unreleased is unreleased commit dataset
   127  type Unreleased struct {
   128  	CommitGroups  []*CommitGroup
   129  	Commits       []*Commit
   130  	MergeCommits  []*Commit
   131  	RevertCommits []*Commit
   132  	NoteGroups    []*NoteGroup
   133  }