gitlab

package
v0.0.0-...-035f8e2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloneProjects

type CloneProjects struct {
	Page         int
	PerPage      int
	Recursive    bool
	Language     string
	WorkspaceDir string
}

type Gitlab

type Gitlab struct {
	PrivateToken string
	Username     string
	Domain       string
	Ctx          context.Context
}

func NewGitlab

func NewGitlab(ctx context.Context, privateToken, domain string) *Gitlab

func (*Gitlab) Clone

func (g *Gitlab) Clone(repository *GitlabRepository, hubDir string) error

Clone clone gitlab repository

func (*Gitlab) CloneGitlabHub

func (g *Gitlab) CloneGitlabHub(projects *CloneProjects) error

func (*Gitlab) CloneRepository

func (g *Gitlab) CloneRepository(url, branch, directory string) error

func (*Gitlab) GetGitlabRepository

func (g *Gitlab) GetGitlabRepository(projects *GitlabProjects) ([]Repository, error)

GetGitlabRepository select gitlab repository

func (*Gitlab) GetProjectLanguage

func (g *Gitlab) GetProjectLanguage(dir string) (string, error)

func (*Gitlab) PullRepository

func (g *Gitlab) PullRepository(repo *git.Repository, branch, name string) error

func (*Gitlab) ScanGitlabHub

func (g *Gitlab) ScanGitlabHub(projects *GitlabProjects) error

ScanGitlabHub scan gitlab hub

func (*Gitlab) UpdateRepositoryLanguage

func (g *Gitlab) UpdateRepositoryLanguage(id int, dir string) error

type GitlabProjects

type GitlabProjects struct {
	Simple     bool
	Membership bool
	Page       int
	PerPage    int
	Recursive  bool
}

type GitlabRepository

type GitlabRepository struct {
	// gorm.Model
	Id                int    `gorm:"cloumn:id"`
	Name              string `gorm:"cloumn:name"`                // name
	Path              string `gorm:"cloumn:path"`                // path
	PathWithNamespace string `gorm:"cloumn:path_with_namespace"` // path with namespace
	DefaultBranch     string `gorm:"cloumn:default_branch"`      // default branch
	Language          string `gorm:"cloumn:language"`            // programming language
	Archived          bool   `gorm:"cloumn:archived"`            // archived
	HttpUrlToRepo     string `gorm:"cloumn:http_url_to_repo"`    // http url to repo
	WebUrl            string `gorm:"cloumn:web_url"`             // web url
	LastActivityAt    string `gorm:"cloumn:last_activity_at"`    // last activity at
	CreateAt          string `gorm:"cloumn:created_at"`          // created at
	Visibility        string `gorm:"cloumn:visibility"`          // visibility
	Description       string `gorm:"cloumn:description"`         // description
	CreatorId         int    `gorm:"cloumn:creator_id"`          // creator id
	NamespaceId       int    `gorm:"cloumn:namespace_id"`        // namespace id
	NamespaceName     string `gorm:"cloumn:namespace_name"`      // namespace name
	NamespacePath     string `gorm:"cloumn:namespace_path"`      // namespace path
	NamespaceKind     string `gorm:"cloumn:namespace_kind"`      // namespace kind
	NamespaceFullPath string `gorm:"cloumn:namespace_full_path"` // namespace full path
	NamespaceParentId int    `gorm:"cloumn:namespace_parent_id"` // namespace parent id
	WorkspaceDir      string `gorm:"cloumn:workspace_dir"`       // workspace dir
}

GitlabRepository gitlab repository

type IRepository

type IRepository interface {
	SaveRepository(repository Repository) error
	UpdateRepository(language, dir string, id int) error
	FindRepositories(page, limit int, language string) ([]GitlabRepository, error)
	GetRepositoryById(id int) (*GitlabRepository, error)
	ExixtsRepository(id []int) ([]int, error)
}

type Namespace

type Namespace struct {
	Id       int    `json:"id"`
	Name     string `json:"name"`
	Path     string `json:"path"`
	Kind     string `json:"kind"`
	FullPath string `json:"full_path"` // 全路径
	ParentId int    `json:"parent_id"`
}

Namespace gitlab namespace

type Repository

type Repository struct {
	Id                int       `json:"id"`
	Name              string    `json:"name"`
	Path              string    `json:"path"`
	PathWithNamespace string    `json:"path_with_namespace"`
	DefaultBranch     string    `json:"default_branch"`
	Namespace         Namespace `json:"namespace"`
	Archived          bool      `json:"archived"`
	HttpUrlToRepo     string    `json:"http_url_to_repo"`
	WebUrl            string    `json:"web_url"`
	CreateAt          string    `json:"created_at"`
	LastActivityAt    string    `json:"last_activity_at"`
	Visibility        string    `json:"visibility"`
	Description       string    `json:"description"`
	CreatorId         int       `json:"creator_id"`
}

type RepositoryService

type RepositoryService struct {
	Db  *gorm.DB
	Ctx context.Context
}

func (*RepositoryService) ExixtsRepository

func (r *RepositoryService) ExixtsRepository(ids []string) ([]int, error)

func (*RepositoryService) FindRepositories

func (r *RepositoryService) FindRepositories(page, limit int, language string) ([]GitlabRepository, error)

func (*RepositoryService) GetRepositoryById

func (r *RepositoryService) GetRepositoryById(id int) (*GitlabRepository, error)

func (*RepositoryService) SaveRepository

func (r *RepositoryService) SaveRepository(repository Repository) error

func (*RepositoryService) UpdateRepository

func (r *RepositoryService) UpdateRepository(language, dir string, id int) error

Jump to

Keyboard shortcuts

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