File: project.go

package info (click to toggle)
golang-code.forgejo-f3-gof3 3.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,952 kB
  • sloc: sh: 100; makefile: 65
file content (50 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright Earl Warren <contact@earl-warren.org>
// Copyright Loïc Dachary <loic@dachary.org>
// SPDX-License-Identifier: MIT

package f3

type Project struct {
	Common
	Name          string       `json:"name"`
	IsPrivate     bool         `json:"is_private"`
	IsMirror      bool         `json:"is_mirror"`
	Description   string       `json:"description"`
	DefaultBranch string       `json:"default_branch"`
	Forked        *Reference   `json:"forked"`
	HasWiki       bool         `json:"has_wiki"`
	Topics        []*Reference `json:"topics"`
}

func (o Project) Project(other Project) bool {
	return o.Equal(other.Common) &&
		o.Name == other.Name &&
		o.IsPrivate == other.IsPrivate &&
		o.IsMirror == other.IsMirror &&
		o.Description == other.Description &&
		o.DefaultBranch == other.DefaultBranch &&
		nilOrEqual(o.Forked, other.Forked) &&
		o.HasWiki == other.HasWiki &&
		arrayEqual(o.Topics, other.Topics)
}

func (o *Project) GetName() string {
	return o.Name
}

func (o *Project) GetReferences() References {
	references := o.Common.GetReferences()
	if !o.Forked.IsNil() {
		references = append(references, o.Forked)
	}
	for _, topic := range o.Topics {
		references = append(references, topic)
	}
	return references
}

func (o *Project) Clone() Interface {
	clone := &Project{}
	*clone = *o
	return clone
}