models

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivitySummary

type ActivitySummary struct {
	TotalProjects      int
	TotalCommits       int
	TotalMergeRequests int
	TotalTags          int
}

func CalculateSummary

func CalculateSummary(activities []ProjectActivity) ActivitySummary

type Commit

type Commit struct {
	ID          string
	ShortID     string
	Title       string
	AuthorName  string
	AuthorEmail string
	CreatedAt   time.Time
	WebURL      string
}

type CommitDetail

type CommitDetail struct {
	ID             string
	ShortID        string
	Title          string
	Message        string // Full commit message including body
	AuthorName     string
	AuthorEmail    string
	CommitterName  string
	CommitterEmail string
	CreatedAt      time.Time
	CommittedAt    time.Time
	WebURL         string
	ProjectPath    string
	Stats          CommitStats
	ParentIDs      []string
}

CommitDetail contains full commit information including the body/message

type CommitStats

type CommitStats struct {
	Additions int
	Deletions int
	Total     int
}

CommitStats contains addition/deletion statistics

type Contributor

type Contributor struct {
	Name      string `json:"name"`
	Email     string `json:"email"`
	Commits   int    `json:"commits"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
}

type GitLabIndex

type GitLabIndex struct {
	Version         int               `json:"version"`
	GitLabURL       string            `json:"gitlab_url"`
	LastFullIndexAt time.Time         `json:"last_full_index_at"`
	Projects        []ProjectMetadata `json:"projects"`
	ProjectsByID    map[int]int       `json:"-"`
	ProjectsByPath  map[string]int    `json:"-"`
}

func NewGitLabIndex

func NewGitLabIndex(gitlabURL string) *GitLabIndex

func (*GitLabIndex) BuildLookupMaps

func (idx *GitLabIndex) BuildLookupMaps()

func (*GitLabIndex) FindProject

func (idx *GitLabIndex) FindProject(idOrPath string) *ProjectMetadata

func (*GitLabIndex) ListProjects

func (idx *GitLabIndex) ListProjects(orderBy, sortDir string, limit int) []ProjectMetadata

ListProjects returns projects sorted by the given field with optional limit

func (*GitLabIndex) UpsertProject

func (idx *GitLabIndex) UpsertProject(p ProjectMetadata)

type MRCommit

type MRCommit struct {
	ShortID   string
	Title     string
	Author    string
	CreatedAt time.Time
}

MRCommit is a simplified commit structure for MR commit lists

type MRDiffVersion

type MRDiffVersion struct {
	HeadCommitSHA  string
	BaseCommitSHA  string
	StartCommitSHA string
}

MRDiffVersion contains version info for creating inline comments

type MRDiscussion

type MRDiscussion struct {
	ID             string   // discussion ID (used for replies)
	IndividualNote bool     // true if this is a single note, not a thread
	Notes          []MRNote // notes in this discussion thread
}

MRDiscussion represents a discussion thread on a merge request

type MRFile

type MRFile struct {
	OldPath   string
	NewPath   string
	IsNew     bool
	IsDeleted bool
	IsRenamed bool
	Additions int
	Deletions int
	Diff      string // populated only with --show-diff
}

MRFile represents a file changed in a merge request

type MRNote

type MRNote struct {
	ID           int
	DiscussionID string // ID of the discussion thread this note belongs to
	Body         string
	Author       string
	CreatedAt    time.Time
	System       bool          // true for system-generated notes (e.g., "mentioned in commit")
	Resolvable   bool          // true for notes that can be resolved (e.g., inline comments)
	Resolved     bool          // true if the note has been resolved
	Position     *NotePosition // position info for inline comments (nil for regular comments)
}

MRNote represents a comment/note on a merge request

type MergeRequest

type MergeRequest struct {
	IID       int
	Title     string
	State     string
	Author    string
	CreatedAt time.Time
	UpdatedAt time.Time
	WebURL    string
}

type MergeRequestChanges

type MergeRequestChanges struct {
	Additions int
	Deletions int
	Files     int
}

MergeRequestChanges contains diff statistics

type MergeRequestDetail

type MergeRequestDetail struct {
	IID          int
	Title        string
	Description  string
	State        string
	Author       string
	CreatedAt    time.Time
	UpdatedAt    time.Time
	MergedAt     *time.Time
	MergedBy     string
	WebURL       string
	SourceBranch string
	TargetBranch string
	ProjectPath  string
	Draft        bool
	MergeStatus  string
	HasConflicts bool
	Labels       []string
	Assignees    []string
	Reviewers    []string
	Approvers    []string
	Changes      MergeRequestChanges
	Commits      []MRCommit     // populated on detail view
	Files        []MRFile       // populated on detail view
	Notes        []MRNote       // populated on detail view (flat list for backwards compat)
	Discussions  []MRDiscussion // populated on detail view (threaded discussions)
}

MergeRequestDetail contains full MR information for detailed views

type NotePosition

type NotePosition struct {
	NewPath string // file path in the new version
	OldPath string // file path in the old version
	NewLine int    // line number in new version (0 if not applicable)
	OldLine int    // line number in old version (0 if not applicable)
}

NotePosition contains position information for inline/diff comments

type ProjectActivity

type ProjectActivity struct {
	ProjectID     int
	ProjectName   string
	ProjectPath   string
	WebURL        string
	Commits       []Commit
	MergeRequests []MergeRequest
	Tags          []Tag
}

func (*ProjectActivity) HasActivity

func (p *ProjectActivity) HasActivity() bool

type ProjectMetadata

type ProjectMetadata struct {
	ID              int                `json:"id"`
	Name            string             `json:"name"`
	PathWithNS      string             `json:"path_with_namespace"`
	Description     string             `json:"description"`
	WebURL          string             `json:"web_url"`
	DefaultBranch   string             `json:"default_branch"`
	Visibility      string             `json:"visibility"`
	Topics          []string           `json:"topics"`
	StarCount       int                `json:"star_count"`
	ForksCount      int                `json:"forks_count"`
	Languages       map[string]float32 `json:"languages"`
	TopContributors []Contributor      `json:"top_contributors"`
	LastActivityAt  time.Time          `json:"last_activity_at"`
	IndexedAt       time.Time          `json:"indexed_at"`
}

type SlackChannel

type SlackChannel struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	IsPrivate  bool      `json:"is_private"`
	IsArchived bool      `json:"is_archived"`
	IsMember   bool      `json:"is_member"` // Bot is a member and can post
	NumMembers int       `json:"num_members"`
	Topic      string    `json:"topic,omitempty"`
	Purpose    string    `json:"purpose,omitempty"`
	IndexedAt  time.Time `json:"indexed_at"`
}

SlackChannel represents a Slack channel in the index

type SlackIndex

type SlackIndex struct {
	Version         int            `json:"version"`
	TeamID          string         `json:"team_id"`
	TeamName        string         `json:"team_name"`
	LastFullIndexAt time.Time      `json:"last_full_index_at"`
	Channels        []SlackChannel `json:"channels"`
	Users           []SlackUser    `json:"users"`
	// Lookup maps (not persisted)
	ChannelsByID    map[string]int `json:"-"`
	ChannelsByName  map[string]int `json:"-"`
	UsersByID       map[string]int `json:"-"`
	UsersByUsername map[string]int `json:"-"`
}

SlackIndex holds the cached Slack data (channels and users)

func NewSlackIndex

func NewSlackIndex(teamID, teamName string) *SlackIndex

NewSlackIndex creates a new empty Slack index

func (*SlackIndex) BuildLookupMaps

func (idx *SlackIndex) BuildLookupMaps()

BuildLookupMaps rebuilds all lookup maps

func (*SlackIndex) FindChannel

func (idx *SlackIndex) FindChannel(idOrName string) *SlackChannel

FindChannel looks up a channel by ID or name

func (*SlackIndex) FindUser

func (idx *SlackIndex) FindUser(idOrUsername string) *SlackUser

FindUser looks up a user by ID or username

func (*SlackIndex) ResolveChannelID

func (idx *SlackIndex) ResolveChannelID(idOrName string) string

ResolveChannelID returns the channel ID for a given ID or name

func (*SlackIndex) ResolveUserID

func (idx *SlackIndex) ResolveUserID(idOrUsername string) string

ResolveUserID returns the user ID for a given ID or username

func (*SlackIndex) UpsertChannel

func (idx *SlackIndex) UpsertChannel(ch SlackChannel)

UpsertChannel adds or updates a channel in the index

func (*SlackIndex) UpsertUser

func (idx *SlackIndex) UpsertUser(u SlackUser)

UpsertUser adds or updates a user in the index

type SlackUser

type SlackUser struct {
	ID          string    `json:"id"`
	Username    string    `json:"username"`     // e.g., "john.doe"
	DisplayName string    `json:"display_name"` // e.g., "John Doe"
	RealName    string    `json:"real_name"`
	Email       string    `json:"email,omitempty"`
	IsBot       bool      `json:"is_bot"`
	IsAdmin     bool      `json:"is_admin"`
	IsDeleted   bool      `json:"is_deleted"`
	IndexedAt   time.Time `json:"indexed_at"`
}

SlackUser represents a Slack user in the index

type Tag

type Tag struct {
	Name      string
	Message   string
	CreatedAt time.Time
	WebURL    string
}

Jump to

Keyboard shortcuts

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