Help us shape the future of Go! Take the 2026 Go Developer Survey

model

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blame

type Blame struct {
	Code    int
	Comment int
	Blank   int
}

func NewBlame

func NewBlame() *Blame

func (*Blame) Add

func (s *Blame) Add(other *Blame)

func (*Blame) Clear

func (s *Blame) Clear()

func (*Blame) IsEmpty

func (s *Blame) IsEmpty() bool

func (*Blame) Reset

func (s *Blame) Reset()

func (*Blame) Total

func (s *Blame) Total() int

type Changes

type Changes struct {
	In6Months     int
	Total         int
	LinesModified int
	LinesAdded    int
	LinesDeleted  int
}

func NewChanges

func NewChanges() *Changes

func (*Changes) Clear

func (c *Changes) Clear()

func (*Changes) IsEmpty

func (c *Changes) IsEmpty() bool

func (*Changes) LinesTotal

func (c *Changes) LinesTotal() int

func (*Changes) Reset

func (c *Changes) Reset()

type Class

type Class struct {
	Package string
	Name    string
	ID      UUID

	Exists  bool
	Size    *Size
	Changes *Changes
	Metrics *Metrics
	Data    map[string]string

	Properties map[string]*Field
	Methods    map[string]*Function
}

func NewClass

func NewClass(pkg string, name string, id *UUID) *Class

func (*Class) GetOrCreateMethod

func (c *Class) GetOrCreateMethod(name string, args []string) *Function

type Field

type Field struct {
	Name string
	Type string
	ID   UUID

	Exists  bool
	Size    *Size
	Changes *Changes
	Metrics *Metrics
	Data    map[string]string
}

type File

type File struct {
	Path string
	ID   UUID

	ProjectID          *UUID
	ProjectDirectoryID *UUID

	RepositoryID *UUID

	ProductAreaID *UUID

	Exists    bool
	Size      *Size
	Changes   *Changes
	Metrics   *Metrics
	Data      map[string]string
	FirstSeen time.Time
	LastSeen  time.Time

	Classes   map[string]*Class
	Functions map[string]*Function
}

func NewFile

func NewFile(path string, id *UUID) *File

func (*File) GetOrCreateClass

func (f *File) GetOrCreateClass(pkg string, name string) *Class

func (*File) GetOrCreateFunction

func (f *File) GetOrCreateFunction(name string, args []string) *Function

func (*File) SeenAt

func (f *File) SeenAt(ts ...time.Time)

type FileChangeType

type FileChangeType int
const (
	FileChangeUnknown FileChangeType = -1
	FileModified      FileChangeType = iota
	FileRenamed
	FileCreated
	FileDeleted
)

type FileContents

type FileContents struct {
	FileID UUID
	Lines  []*FileLine
}

func NewFileContents

func NewFileContents(fileID UUID) *FileContents

func (*FileContents) AppendLine

func (fc *FileContents) AppendLine() *FileLine

type FileLine

type FileLine struct {
	Line         int
	ProjectID    *UUID
	RepositoryID *UUID
	CommitID     *UUID
	AuthorID     *UUID
	CommitterID  *UUID
	Date         time.Time
	Type         FileLineType
	Text         string
}

type FileLineType

type FileLineType int
const (
	CodeFileLine FileLineType = iota
	CommentFileLine
	BlankFileLine
)

type Files

type Files struct {
	// contains filtered or unexported fields
}

func NewFiles

func NewFiles() *Files

func (*Files) GetFile

func (fs *Files) GetFile(path string) *File

func (*Files) GetFileByID

func (fs *Files) GetFileByID(id UUID) *File

func (*Files) GetOrCreateFile

func (fs *Files) GetOrCreateFile(path string) *File

func (*Files) GetOrCreateFileEx

func (fs *Files) GetOrCreateFileEx(path string, id *UUID) *File

func (*Files) GroupFilesByDirectory

func (fs *Files) GroupFilesByDirectory() map[UUID][]*File

func (*Files) ListFiles

func (fs *Files) ListFiles() []*File

func (*Files) ListFilesByProject

func (fs *Files) ListFilesByProject(proj *Project) []*File

func (*Files) ListFilesByProjects

func (fs *Files) ListFilesByProjects(ps []*Project) []*File

type FilterType

type FilterType int
const (
	FilterAll FilterType = iota
	FilterExcludeExternal
)

type Function

type Function struct {
	Name string
	Args []string
	ID   UUID

	Exists  bool
	Size    *Size
	Changes *Changes
	Metrics *Metrics
	Data    map[string]string
}

func NewFunction

func NewFunction(name string, args []string, id *UUID) *Function

type Metrics

type Metrics struct {
	GuiceDependencies    int
	Abstracts            int
	CyclomaticComplexity int
	CognitiveComplexity  int
	FocusedComplexity    int
}

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Add

func (m *Metrics) Add(other *Metrics)

func (*Metrics) Clear

func (m *Metrics) Clear()

type MonthlyStats

type MonthlyStats struct {
	// contains filtered or unexported fields
}

func NewMonthlyStats

func NewMonthlyStats() *MonthlyStats

func (*MonthlyStats) GetOrCreateLines

func (s *MonthlyStats) GetOrCreateLines(month string, repositoryID UUID, authorID UUID, committerID UUID, fileID UUID, projectID *UUID) *MonthlyStatsLine

func (*MonthlyStats) ListLines

func (s *MonthlyStats) ListLines() []*MonthlyStatsLine

type MonthlyStatsLine

type MonthlyStatsLine struct {
	ID UUID

	Month        string
	RepositoryID UUID
	AuthorID     UUID
	CommitterID  UUID
	FileID       UUID
	ProjectID    *UUID

	Changes *Changes
	Blame   *Blame
}

func NewMonthlyStatsLine

func NewMonthlyStatsLine(month string, repositoryID UUID, authorID UUID, committerID UUID, fileID UUID, projectID *UUID) *MonthlyStatsLine

type People

type People struct {
	// contains filtered or unexported fields
}

func NewPeople

func NewPeople() *People

func (*People) ChangePersonName

func (ps *People) ChangePersonName(person *Person, name string)

func (*People) GetOrCreatePerson

func (ps *People) GetOrCreatePerson(name string) *Person

func (*People) GetOrCreatePersonEx

func (ps *People) GetOrCreatePersonEx(name string, id *UUID) *Person

func (*People) GetOrCreateProductArea

func (ps *People) GetOrCreateProductArea(name string) *ProductArea

func (*People) GetOrCreateProductAreaEx

func (ps *People) GetOrCreateProductAreaEx(name string, id *UUID) *ProductArea

func (*People) GetPerson

func (ps *People) GetPerson(name string) *Person

func (*People) GetPersonByID

func (ps *People) GetPersonByID(id UUID) *Person

func (*People) GetProductAreaByID

func (ps *People) GetProductAreaByID(id UUID) *ProductArea

func (*People) ListPeople

func (ps *People) ListPeople() []*Person

func (*People) ListProductAreas

func (ps *People) ListProductAreas() []*ProductArea

type PeopleRelations

type PeopleRelations struct {
	// contains filtered or unexported fields
}

func NewPeopleRelations

func NewPeopleRelations() *PeopleRelations

func (*PeopleRelations) GetOrCreatePersonFile

func (p *PeopleRelations) GetOrCreatePersonFile(personID UUID, fileID UUID) *PersonFile

func (*PeopleRelations) GetOrCreatePersonRepo

func (p *PeopleRelations) GetOrCreatePersonRepo(personID UUID, repoID UUID) *PersonRepository

func (*PeopleRelations) ListFiles

func (p *PeopleRelations) ListFiles() []*PersonFile

func (*PeopleRelations) ListFilesByPerson

func (p *PeopleRelations) ListFilesByPerson(personID UUID) map[UUID]*PersonFile

func (*PeopleRelations) ListPeopleByFile

func (p *PeopleRelations) ListPeopleByFile(fileID UUID) map[UUID]*PersonFile

func (*PeopleRelations) ListPeopleByRepo

func (p *PeopleRelations) ListPeopleByRepo(repoID UUID) map[UUID]*PersonRepository

func (*PeopleRelations) ListReposByPerson

func (p *PeopleRelations) ListReposByPerson(personID UUID) map[UUID]*PersonRepository

func (*PeopleRelations) ListRepositories

func (p *PeopleRelations) ListRepositories() []*PersonRepository

type Person

type Person struct {
	Name string
	ID   UUID

	Blame     *Blame
	Changes   *Changes
	Data      map[string]string
	FirstSeen time.Time
	LastSeen  time.Time
	// contains filtered or unexported fields
}

func NewPerson

func NewPerson(name string, id *UUID) *Person

func (*Person) AddEmail

func (p *Person) AddEmail(email string)

func (*Person) AddName

func (p *Person) AddName(name string)

func (*Person) ListEmails

func (p *Person) ListEmails() []string

func (*Person) ListNames

func (p *Person) ListNames() []string

func (*Person) SeenAt

func (p *Person) SeenAt(ts ...time.Time)

type PersonFile

type PersonFile struct {
	PersonID UUID
	FileID   UUID

	FirstSeen time.Time
	LastSeen  time.Time
}

func NewPersonFile

func NewPersonFile(personID UUID, fileID UUID) *PersonFile

func (*PersonFile) SeenAt

func (p *PersonFile) SeenAt(ts ...time.Time)

type PersonRepository

type PersonRepository struct {
	PersonID     UUID
	RepositoryID UUID

	FirstSeen time.Time
	LastSeen  time.Time
}

func NewPersonRepository

func NewPersonRepository(personID UUID, repositoryID UUID) *PersonRepository

func (*PersonRepository) SeenAt

func (p *PersonRepository) SeenAt(ts ...time.Time)

type ProductArea

type ProductArea struct {
	Name string
	ID   UUID

	Size    *Size
	Changes *Changes
	Metrics *Metrics
	Data    map[string]string
}

func NewProductArea

func NewProductArea(name string, id *UUID) *ProductArea

type Project

type Project struct {
	Root      string
	Name      string
	NameParts []string
	Type      ProjectType
	ID        UUID

	RootDir     string
	ProjectFile string

	RepositoryID *UUID

	Dirs         map[string]*ProjectDirectory
	Dependencies map[string]*ProjectDependency
	Sizes        map[string]*Size
	Size         *Size
	Changes      *Changes
	Metrics      *Metrics
	Data         map[string]string
	FirstSeen    time.Time
	LastSeen     time.Time
}

func NewProject

func NewProject(root, name string, id *UUID) *Project

func (*Project) AddSize

func (p *Project) AddSize(name string, size *Size)

func (*Project) ClearSizes

func (p *Project) ClearSizes()

func (*Project) FullName

func (p *Project) FullName() string

func (*Project) GetData

func (p *Project) GetData(name string) string

func (*Project) GetDirectory

func (p *Project) GetDirectory(relativePath string) *ProjectDirectory

func (*Project) GetMetrics

func (p *Project) GetMetrics() *Metrics

func (*Project) GetOrCreateDependency

func (p *Project) GetOrCreateDependency(d *Project) *ProjectDependency

func (*Project) GetSizeOf

func (p *Project) GetSizeOf(name string) *Size

func (*Project) IsCode

func (p *Project) IsCode() bool

func (*Project) IsExternalDependency

func (p *Project) IsExternalDependency() bool

func (*Project) IsIgnored

func (p *Project) IsIgnored() bool

func (*Project) LevelSimpleName

func (p *Project) LevelSimpleName(level int) string

func (*Project) ListDependencies

func (p *Project) ListDependencies(filter FilterType) []*ProjectDependency

func (*Project) SeenAt

func (p *Project) SeenAt(ts ...time.Time)

func (*Project) SetData

func (p *Project) SetData(name string, value string) bool

func (*Project) SimpleName

func (p *Project) SimpleName() string

func (*Project) String

func (p *Project) String() string

type ProjectDependency

type ProjectDependency struct {
	Source *Project
	Target *Project
	ID     UUID

	Versions *set.Set[string]
	Data     map[string]string
}

func NewDependency

func NewDependency(source *Project, target *Project) *ProjectDependency

func (*ProjectDependency) GetData

func (d *ProjectDependency) GetData(name string) string

func (*ProjectDependency) SetData

func (d *ProjectDependency) SetData(name string, value string) bool

func (*ProjectDependency) String

func (d *ProjectDependency) String() string

type ProjectDirectory

type ProjectDirectory struct {
	RelativePath string
	Type         ProjectDirectoryType
	ID           UUID

	Size      *Size
	Changes   *Changes
	Metrics   *Metrics
	Data      map[string]string
	FirstSeen time.Time
	LastSeen  time.Time
}

func NewProjectDirectory

func NewProjectDirectory(relativePath string) *ProjectDirectory

func (*ProjectDirectory) SeenAt

func (d *ProjectDirectory) SeenAt(ts ...time.Time)

type ProjectDirectoryType

type ProjectDirectoryType int
const (
	SourceDir ProjectDirectoryType = iota
	TestsDir
	ConfigDir
)

func (ProjectDirectoryType) String

func (t ProjectDirectoryType) String() string

type ProjectType

type ProjectType int
const (
	Library ProjectType = iota
	CodeType
	DatabaseType
)

func (ProjectType) String

func (t ProjectType) String() string

type Projects

type Projects struct {
	// contains filtered or unexported fields
}

func NewProjects

func NewProjects() *Projects

func (*Projects) GetByID

func (ps *Projects) GetByID(id UUID) *Project

func (*Projects) GetOrCreate

func (ps *Projects) GetOrCreate(root, name string) *Project

func (*Projects) GetOrCreateEx

func (ps *Projects) GetOrCreateEx(root, name string, id *UUID) *Project

func (*Projects) ListProjects

func (ps *Projects) ListProjects(ft FilterType) []*Project

func (*Projects) ListProjectsByRoot

func (ps *Projects) ListProjectsByRoot(root string, ft FilterType) []*Project

type Repositories

type Repositories struct {
	// contains filtered or unexported fields
}

func NewRepositories

func NewRepositories() *Repositories

func (*Repositories) Get

func (s *Repositories) Get(rootDir string) *Repository

func (*Repositories) GetByID

func (s *Repositories) GetByID(id UUID) *Repository

func (*Repositories) GetOrCreate

func (s *Repositories) GetOrCreate(rootDir string) *Repository

func (*Repositories) GetOrCreateEx

func (s *Repositories) GetOrCreateEx(rootDir string, id *UUID) *Repository

func (*Repositories) List

func (s *Repositories) List() []*Repository

type Repository

type Repository struct {
	Name    string
	RootDir string
	VCS     string
	ID      UUID

	Data map[string]string

	FirstSeen time.Time
	LastSeen  time.Time

	FilesTotal int
	FilesHead  int
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(rootDir string, id *UUID) *Repository

func (*Repository) ContainsCommit

func (r *Repository) ContainsCommit(hash string) bool

func (*Repository) CountCommits

func (r *Repository) CountCommits() int

func (*Repository) GetCommit

func (r *Repository) GetCommit(hash string) *RepositoryCommit

func (*Repository) GetCommitByID

func (r *Repository) GetCommitByID(id UUID) *RepositoryCommit

func (*Repository) GetOrCreateCommit

func (r *Repository) GetOrCreateCommit(hash string) *RepositoryCommit

func (*Repository) GetOrCreateCommitEx

func (r *Repository) GetOrCreateCommitEx(hash string, id *UUID) *RepositoryCommit

func (*Repository) ListCommits

func (r *Repository) ListCommits() []*RepositoryCommit

func (*Repository) SeenAt

func (r *Repository) SeenAt(ts ...time.Time)

type RepositoryCommit

type RepositoryCommit struct {
	Hash     string
	Message  string
	Parents  []UUID
	Children []UUID
	ID       UUID

	Date         time.Time
	CommitterID  UUID
	DateAuthored time.Time
	AuthorID     UUID

	FilesModified int
	FilesCreated  int
	FilesDeleted  int

	LinesModified int
	LinesAdded    int
	LinesDeleted  int

	Blame *Blame

	Ignore bool
}

func NewRepositoryCommit

func NewRepositoryCommit(hash string, id *UUID) *RepositoryCommit

type RepositoryCommitFile

type RepositoryCommitFile struct {
	FileID UUID
	Hash   string

	Change     FileChangeType
	OldFileIDs map[UUID]UUID

	LinesModified int
	LinesAdded    int
	LinesDeleted  int
}

func NewRepositoryCommitFile

func NewRepositoryCommitFile(fileID UUID) *RepositoryCommitFile

type RepositoryCommitFiles

type RepositoryCommitFiles struct {
	RepositoryID UUID
	CommitID     UUID
	// contains filtered or unexported fields
}

func NewRepositoryCommitFiles

func NewRepositoryCommitFiles(repositoryID UUID, commitID UUID) *RepositoryCommitFiles

func (*RepositoryCommitFiles) GetOrCreate

func (l *RepositoryCommitFiles) GetOrCreate(fileID UUID) *RepositoryCommitFile

func (*RepositoryCommitFiles) List

type Size

type Size struct {
	Lines int
	Files int
	Bytes int
	Other map[string]int
}

func NewSize

func NewSize() *Size

func (*Size) Add

func (s *Size) Add(other *Size)

func (*Size) Clear

func (s *Size) Clear()

func (*Size) IsEmpty

func (s *Size) IsEmpty() bool

type UUID

type UUID string

func NewUUID

func NewUUID(t string) UUID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL