core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListRemoteNames

func ListRemoteNames() ([]string, error)

func SplitGroup

func SplitGroup(name string) (string, string)

Types

type Remote

type Remote struct {
	Name string `toml:"-"`

	Host string `toml:"host" validate:"required"`

	Protocol string `toml:"protocol" validate:"enum_protocol"`

	User  string `toml:"user" validate:"required"`
	Email string `toml:"email" validate:"email"`

	Provider string `toml:"provider" validate:"enum_provider"`
	Token    string `toml:"token"`
	API      string `toml:"api" validate:"omitempty,uri"`

	Groups []*RemoteGroup `toml:"groups" validate:"unique=Name,dive"`
}

func GetRemote

func GetRemote(name string) (*Remote, error)

func (*Remote) GetCloneURL

func (r *Remote) GetCloneURL(repo *Repository) (string, error)

func (*Remote) GetUserEmail

func (r *Remote) GetUserEmail(repo *Repository) (string, string)

type RemoteGroup

type RemoteGroup struct {
	Name string `toml:"name" validate:"required"`

	Protocol string `toml:"protocol" validate:"omitempty,enum_protocol"`

	User  string `toml:"user"`
	Email string `toml:"email" validate:"omitempty,email"`
}

type Repository

type Repository struct {
	Path string

	Name   string
	Remote string

	View uint64
	// contains filtered or unexported fields
}

func AttachRepository

func AttachRepository(remote *Remote, name, path string) (*Repository, error)

func CreateRepository

func CreateRepository(remote *Remote, name string) (*Repository, error)

func (*Repository) Base

func (repo *Repository) Base() string

func (*Repository) FullName

func (repo *Repository) FullName() string

func (*Repository) Group

func (repo *Repository) Group() string

type RepositoryStorage

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

func NewRepositoryStorage

func NewRepositoryStorage() (*RepositoryStorage, error)

func (*RepositoryStorage) Add

func (s *RepositoryStorage) Add(repo *Repository) error

func (*RepositoryStorage) Close

func (s *RepositoryStorage) Close() error

func (*RepositoryStorage) Delete

func (s *RepositoryStorage) Delete(repo *Repository)

func (*RepositoryStorage) GetByName

func (s *RepositoryStorage) GetByName(remote, name string) *Repository

func (*RepositoryStorage) GetByPath

func (s *RepositoryStorage) GetByPath(path string) (*Repository, error)

func (*RepositoryStorage) List

func (s *RepositoryStorage) List(remote string) []*Repository

func (*RepositoryStorage) ReadOnly

func (s *RepositoryStorage) ReadOnly()

Jump to

Keyboard shortcuts

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