Documentation ¶
Index ¶
- Variables
- type Repo
- type SqliteBackend
- func (d *SqliteBackend) AccessLevel(repo string, username string) backend.AccessLevel
- func (d *SqliteBackend) AccessLevelByPublicKey(repo string, pk ssh.PublicKey) backend.AccessLevel
- func (d *SqliteBackend) AddCollaborator(repo string, username string) error
- func (d *SqliteBackend) AddPublicKey(username string, pk ssh.PublicKey) error
- func (d *SqliteBackend) AllowKeyless() bool
- func (d *SqliteBackend) AnonAccess() backend.AccessLevel
- func (d *SqliteBackend) Close() error
- func (d *SqliteBackend) Collaborators(repo string) ([]string, error)
- func (d *SqliteBackend) CreateRepository(name string, opts backend.RepositoryOptions) (backend.Repository, error)
- func (d *SqliteBackend) CreateUser(username string, opts backend.UserOptions) (backend.User, error)
- func (d *SqliteBackend) DeleteRepository(name string) error
- func (d *SqliteBackend) DeleteUser(username string) error
- func (d *SqliteBackend) Description(repo string) (string, error)
- func (d *SqliteBackend) ImportRepository(name string, remote string, opts backend.RepositoryOptions) (backend.Repository, error)
- func (d *SqliteBackend) IsCollaborator(repo string, username string) (bool, error)
- func (d *SqliteBackend) IsHidden(repo string) (bool, error)
- func (d *SqliteBackend) IsMirror(repo string) (bool, error)
- func (d *SqliteBackend) IsPrivate(repo string) (bool, error)
- func (d *SqliteBackend) ListPublicKeys(username string) ([]ssh.PublicKey, error)
- func (d *SqliteBackend) PostReceive(stdout io.Writer, stderr io.Writer, repo string, args []backend.HookArg)
- func (d *SqliteBackend) PostUpdate(stdout io.Writer, stderr io.Writer, repo string, args ...string)
- func (d *SqliteBackend) PreReceive(stdout io.Writer, stderr io.Writer, repo string, args []backend.HookArg)
- func (d *SqliteBackend) ProjectName(repo string) (string, error)
- func (d *SqliteBackend) RemoveCollaborator(repo string, username string) error
- func (d *SqliteBackend) RemovePublicKey(username string, pk ssh.PublicKey) error
- func (d *SqliteBackend) RenameRepository(oldName string, newName string) error
- func (d *SqliteBackend) Repositories() ([]backend.Repository, error)
- func (d *SqliteBackend) Repository(repo string) (backend.Repository, error)
- func (d *SqliteBackend) SetAdmin(username string, admin bool) error
- func (d *SqliteBackend) SetAllowKeyless(allow bool) error
- func (d *SqliteBackend) SetAnonAccess(level backend.AccessLevel) error
- func (d *SqliteBackend) SetDescription(repo string, desc string) error
- func (d *SqliteBackend) SetHidden(repo string, hidden bool) error
- func (d *SqliteBackend) SetPrivate(repo string, private bool) error
- func (d *SqliteBackend) SetProjectName(repo string, name string) error
- func (d *SqliteBackend) SetUsername(username string, newUsername string) error
- func (d *SqliteBackend) Update(stdout io.Writer, stderr io.Writer, repo string, arg backend.HookArg)
- func (d *SqliteBackend) User(username string) (backend.User, error)
- func (d *SqliteBackend) UserByPublicKey(pk ssh.PublicKey) (backend.User, error)
- func (d *SqliteBackend) Users() ([]string, error)
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDuplicateKey is returned when a unique constraint is violated. ErrDuplicateKey = errors.New("record already exists") // ErrNoRecord is returned when a record is not found. ErrNoRecord = errors.New("record not found") // ErrRepoNotExist is returned when a repository does not exist. ErrRepoNotExist = fmt.Errorf("repository does not exist") )
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is a Git repository with metadata stored in a SQLite database.
func (*Repo) Description ¶
Description returns the repository's description.
It implements backend.Repository.
func (*Repo) IsHidden ¶
IsHidden returns whether the repository is hidden.
It implements backend.Repository.
func (*Repo) IsMirror ¶
IsMirror returns whether the repository is a mirror.
It implements backend.Repository.
func (*Repo) IsPrivate ¶
IsPrivate returns whether the repository is private.
It implements backend.Repository.
func (*Repo) Open ¶
func (r *Repo) Open() (*git.Repository, error)
Open opens the repository.
It implements backend.Repository.
func (*Repo) ProjectName ¶
ProjectName returns the repository's project name.
It implements backend.Repository.
type SqliteBackend ¶
type SqliteBackend struct {
// contains filtered or unexported fields
}
SqliteBackend is a backend that uses a SQLite database as a Soft Serve backend.
func NewSqliteBackend ¶
func NewSqliteBackend(ctx context.Context) (*SqliteBackend, error)
NewSqliteBackend creates a new SqliteBackend.
func (*SqliteBackend) AccessLevel ¶
func (d *SqliteBackend) AccessLevel(repo string, username string) backend.AccessLevel
AccessLevel returns the access level of a user for a repository.
It implements backend.Backend.
func (*SqliteBackend) AccessLevelByPublicKey ¶
func (d *SqliteBackend) AccessLevelByPublicKey(repo string, pk ssh.PublicKey) backend.AccessLevel
AccessLevelByPublicKey returns the access level of a user's public key for a repository.
It implements backend.Backend.
func (*SqliteBackend) AddCollaborator ¶
func (d *SqliteBackend) AddCollaborator(repo string, username string) error
AddCollaborator adds a collaborator to a repository.
It implements backend.Backend.
func (*SqliteBackend) AddPublicKey ¶
func (d *SqliteBackend) AddPublicKey(username string, pk ssh.PublicKey) error
AddPublicKey adds a public key to a user.
It implements backend.Backend.
func (*SqliteBackend) AllowKeyless ¶
func (d *SqliteBackend) AllowKeyless() bool
AllowKeyless returns whether or not keyless access is allowed.
It implements backend.Backend.
func (*SqliteBackend) AnonAccess ¶
func (d *SqliteBackend) AnonAccess() backend.AccessLevel
AnonAccess returns the level of anonymous access.
It implements backend.Backend.
func (*SqliteBackend) Collaborators ¶
func (d *SqliteBackend) Collaborators(repo string) ([]string, error)
Collaborators returns a list of collaborators for a repository.
It implements backend.Backend.
func (*SqliteBackend) CreateRepository ¶
func (d *SqliteBackend) CreateRepository(name string, opts backend.RepositoryOptions) (backend.Repository, error)
CreateRepository creates a new repository.
It implements backend.Backend.
func (*SqliteBackend) CreateUser ¶
func (d *SqliteBackend) CreateUser(username string, opts backend.UserOptions) (backend.User, error)
CreateUser creates a new user.
It implements backend.Backend.
func (*SqliteBackend) DeleteRepository ¶
func (d *SqliteBackend) DeleteRepository(name string) error
DeleteRepository deletes a repository.
It implements backend.Backend.
func (*SqliteBackend) DeleteUser ¶
func (d *SqliteBackend) DeleteUser(username string) error
DeleteUser deletes a user.
It implements backend.Backend.
func (*SqliteBackend) Description ¶
func (d *SqliteBackend) Description(repo string) (string, error)
Description returns the description of a repository.
It implements backend.Backend.
func (*SqliteBackend) ImportRepository ¶
func (d *SqliteBackend) ImportRepository(name string, remote string, opts backend.RepositoryOptions) (backend.Repository, error)
ImportRepository imports a repository from remote.
func (*SqliteBackend) IsCollaborator ¶
func (d *SqliteBackend) IsCollaborator(repo string, username string) (bool, error)
IsCollaborator returns true if the user is a collaborator of the repository.
It implements backend.Backend.
func (*SqliteBackend) IsHidden ¶
func (d *SqliteBackend) IsHidden(repo string) (bool, error)
IsHidden returns true if the repository is hidden.
It implements backend.Backend.
func (*SqliteBackend) IsMirror ¶
func (d *SqliteBackend) IsMirror(repo string) (bool, error)
IsMirror returns true if the repository is a mirror.
It implements backend.Backend.
func (*SqliteBackend) IsPrivate ¶
func (d *SqliteBackend) IsPrivate(repo string) (bool, error)
IsPrivate returns true if the repository is private.
It implements backend.Backend.
func (*SqliteBackend) ListPublicKeys ¶
func (d *SqliteBackend) ListPublicKeys(username string) ([]ssh.PublicKey, error)
ListPublicKeys lists the public keys of a user.
func (*SqliteBackend) PostReceive ¶
func (d *SqliteBackend) PostReceive(stdout io.Writer, stderr io.Writer, repo string, args []backend.HookArg)
PostReceive is called by the git post-receive hook.
It implements Hooks.
func (*SqliteBackend) PostUpdate ¶
PostUpdate is called by the git post-update hook.
It implements Hooks.
func (*SqliteBackend) PreReceive ¶
func (d *SqliteBackend) PreReceive(stdout io.Writer, stderr io.Writer, repo string, args []backend.HookArg)
PreReceive is called by the git pre-receive hook.
It implements Hooks.
func (*SqliteBackend) ProjectName ¶
func (d *SqliteBackend) ProjectName(repo string) (string, error)
ProjectName returns the project name of a repository.
It implements backend.Backend.
func (*SqliteBackend) RemoveCollaborator ¶
func (d *SqliteBackend) RemoveCollaborator(repo string, username string) error
RemoveCollaborator removes a collaborator from a repository.
It implements backend.Backend.
func (*SqliteBackend) RemovePublicKey ¶
func (d *SqliteBackend) RemovePublicKey(username string, pk ssh.PublicKey) error
RemovePublicKey removes a public key from a user.
It implements backend.Backend.
func (*SqliteBackend) RenameRepository ¶
func (d *SqliteBackend) RenameRepository(oldName string, newName string) error
RenameRepository renames a repository.
It implements backend.Backend.
func (*SqliteBackend) Repositories ¶
func (d *SqliteBackend) Repositories() ([]backend.Repository, error)
Repositories returns a list of all repositories.
It implements backend.Backend.
func (*SqliteBackend) Repository ¶
func (d *SqliteBackend) Repository(repo string) (backend.Repository, error)
Repository returns a repository by name.
It implements backend.Backend.
func (*SqliteBackend) SetAdmin ¶
func (d *SqliteBackend) SetAdmin(username string, admin bool) error
SetAdmin sets the admin flag of a user.
It implements backend.Backend.
func (*SqliteBackend) SetAllowKeyless ¶
func (d *SqliteBackend) SetAllowKeyless(allow bool) error
SetAllowKeyless sets whether or not keyless access is allowed.
It implements backend.Backend.
func (*SqliteBackend) SetAnonAccess ¶
func (d *SqliteBackend) SetAnonAccess(level backend.AccessLevel) error
SetAnonAccess sets the level of anonymous access.
It implements backend.Backend.
func (*SqliteBackend) SetDescription ¶
func (d *SqliteBackend) SetDescription(repo string, desc string) error
SetDescription sets the description of a repository.
It implements backend.Backend.
func (*SqliteBackend) SetHidden ¶
func (d *SqliteBackend) SetHidden(repo string, hidden bool) error
SetHidden sets the hidden flag of a repository.
It implements backend.Backend.
func (*SqliteBackend) SetPrivate ¶
func (d *SqliteBackend) SetPrivate(repo string, private bool) error
SetPrivate sets the private flag of a repository.
It implements backend.Backend.
func (*SqliteBackend) SetProjectName ¶
func (d *SqliteBackend) SetProjectName(repo string, name string) error
SetProjectName sets the project name of a repository.
It implements backend.Backend.
func (*SqliteBackend) SetUsername ¶
func (d *SqliteBackend) SetUsername(username string, newUsername string) error
SetUsername sets the username of a user.
It implements backend.Backend.
func (*SqliteBackend) Update ¶
func (d *SqliteBackend) Update(stdout io.Writer, stderr io.Writer, repo string, arg backend.HookArg)
Update is called by the git update hook.
It implements Hooks.
func (*SqliteBackend) User ¶
func (d *SqliteBackend) User(username string) (backend.User, error)
User finds a user by username.
It implements backend.Backend.
func (*SqliteBackend) UserByPublicKey ¶
UserByPublicKey finds a user by public key.
It implements backend.Backend.
func (*SqliteBackend) Users ¶
func (d *SqliteBackend) Users() ([]string, error)
Users returns all users.
It implements backend.Backend.