Documentation
¶
Index ¶
- Variables
- func AuthorDateToTime(date string, logger *slog.Logger) time.Time
- func GitPatchRequestMiddleware(be *Backend, pr GitPatchRequest) wish.Middleware
- func GitSshServer(cfg *GitCfg)
- func NewCli(sesh ssh.Session, be *Backend, pr GitPatchRequest) *cli.App
- func NewTabWriter(out io.Writer) *tabwriter.Writer
- func StartWebServer(cfg *GitCfg)
- type Acl
- type Backend
- func (be *Backend) IsAdmin(pk ssh.PublicKey) bool
- func (be *Backend) IsPrOwner(pka, pkb int64) bool
- func (be *Backend) KeyForFingerprint(pk ssh.PublicKey) string
- func (be *Backend) KeyForKeyText(pk ssh.PublicKey) string
- func (be *Backend) KeysEqual(pka, pkb string) bool
- func (be *Backend) Pubkey(pk ssh.PublicKey) string
- func (be *Backend) PubkeyToPublicKey(pubkey string) (ssh.PublicKey, error)
- func (be *Backend) RepoID(name string) string
- func (be *Backend) RepoName(id string) string
- func (be *Backend) ReposDir() string
- type DB
- type EventLog
- type EventLogData
- type GitCfg
- type GitPatchRequest
- type LinkData
- type MetaData
- type Patch
- type PatchData
- type PatchRequest
- type Patchset
- type PatchsetData
- type PatchsetOp
- type PrCmd
- func (cmd PrCmd) CreateEventLog(eventLog EventLog) error
- func (cmd PrCmd) DeletePatchsetByID(patchsetID int64) error
- func (cmd PrCmd) DiffPatchsets(prev *Patchset, next *Patchset) ([]*Patch, error)
- func (cmd PrCmd) GetEventLogs() ([]*EventLog, error)
- func (cmd PrCmd) GetEventLogsByPrID(prID int64) ([]*EventLog, error)
- func (cmd PrCmd) GetEventLogsByRepoID(repoID string) ([]*EventLog, error)
- func (cmd PrCmd) GetEventLogsByUserID(userID int64) ([]*EventLog, error)
- func (pr PrCmd) GetLatestPatchsetByPrID(prID int64) (*Patchset, error)
- func (cmd PrCmd) GetPatchRequestByID(prID int64) (*PatchRequest, error)
- func (cmd PrCmd) GetPatchRequests() ([]*PatchRequest, error)
- func (cmd PrCmd) GetPatchRequestsByRepoID(repoID string) ([]*PatchRequest, error)
- func (pr PrCmd) GetPatchesByPatchsetID(patchsetID int64) ([]*Patch, error)
- func (pr PrCmd) GetPatchsetsByPrID(prID int64) ([]*Patchset, error)
- func (pr PrCmd) GetRepoByID(repoID string) (*Repo, error)
- func (pr PrCmd) GetRepos() ([]*Repo, error)
- func (pr PrCmd) GetReposWithLatestPr() ([]RepoWithLatestPr, error)
- func (pr PrCmd) GetUserByID(id int64) (*User, error)
- func (pr PrCmd) GetUserByPubkey(pubkey string) (*User, error)
- func (pr PrCmd) GetUsers() ([]*User, error)
- func (pr PrCmd) IsBanned(pubkey, ipAddress string) error
- func (cmd PrCmd) SubmitPatchRequest(repoID string, userID int64, patchset io.Reader) (*PatchRequest, error)
- func (cmd PrCmd) SubmitPatchset(prID int64, userID int64, op PatchsetOp, patchset io.Reader) ([]*Patch, error)
- func (cmd PrCmd) UpdatePatchRequestName(prID int64, userID int64, name string) error
- func (cmd PrCmd) UpdatePatchRequestStatus(prID int64, userID int64, status string) error
- func (pr PrCmd) UpsertUser(pubkey, name string) (*User, error)
- type PrData
- type PrDetailData
- type PrListData
- type PrWithRepo
- type Repo
- type RepoData
- type RepoDetailData
- type RepoListData
- type RepoWithLatestPr
- type User
- type WebCtx
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPatchExists = errors.New("patch already exists for patch request")
Functions ¶
func GitPatchRequestMiddleware ¶
func GitPatchRequestMiddleware(be *Backend, pr GitPatchRequest) wish.Middleware
func GitSshServer ¶
func GitSshServer(cfg *GitCfg)
func StartWebServer ¶
func StartWebServer(cfg *GitCfg)
Types ¶
type Acl ¶
type Acl struct {
ID int64 `db:"id"`
Pubkey sql.NullString `db:"pubkey"`
IpAddress sql.NullString `db:"ip_address"`
Permission string `db:"permission"`
CreatedAt time.Time `db:"created_at"`
}
Acl is a db model for access control.
type Backend ¶
func (*Backend) PubkeyToPublicKey ¶
type DB ¶
DB is the interface for a pico/git database.
type EventLog ¶
type EventLog struct {
ID int64 `db:"id"`
UserID int64 `db:"user_id"`
RepoID string `db:"repo_id"`
PatchRequestID sql.NullInt64 `db:"patch_request_id"`
PatchsetID sql.NullInt64 `db:"patchset_id"`
Event string `db:"event"`
Data string `db:"data"`
CreatedAt time.Time `db:"created_at"`
}
EventLog is a event log for RSS or other notification systems.
type EventLogData ¶
type GitCfg ¶
type GitCfg struct {
DataDir string `koanf:"data_dir"`
Repos []*Repo `koanf:"repo"`
Url string `koanf:"url"`
Host string `koanf:"host"`
SshPort string `koanf:"ssh_port"`
WebPort string `koanf:"web_port"`
AdminsStr []string `koanf:"admins"`
Admins []ssh.PublicKey `koanf:"admins_pk"`
Theme string `koanf:"theme"`
TimeFormat string `koanf:"time_format"`
Logger *slog.Logger
}
type GitPatchRequest ¶
type GitPatchRequest interface {
GetUsers() ([]*User, error)
GetUserByID(userID int64) (*User, error)
GetUserByPubkey(pubkey string) (*User, error)
UpsertUser(pubkey, name string) (*User, error)
IsBanned(pubkey, ipAddress string) error
GetRepos() ([]*Repo, error)
GetReposWithLatestPr() ([]RepoWithLatestPr, error)
GetRepoByID(repoID string) (*Repo, error)
SubmitPatchRequest(repoID string, userID int64, patchset io.Reader) (*PatchRequest, error)
SubmitPatchset(prID, userID int64, op PatchsetOp, patchset io.Reader) ([]*Patch, error)
GetPatchRequestByID(prID int64) (*PatchRequest, error)
GetPatchRequests() ([]*PatchRequest, error)
GetPatchRequestsByRepoID(repoID string) ([]*PatchRequest, error)
GetPatchsetsByPrID(prID int64) ([]*Patchset, error)
GetLatestPatchsetByPrID(prID int64) (*Patchset, error)
GetPatchesByPatchsetID(prID int64) ([]*Patch, error)
UpdatePatchRequestStatus(prID, userID int64, status string) error
UpdatePatchRequestName(prID, userID int64, name string) error
DeletePatchsetByID(patchsetID int64) error
CreateEventLog(eventLog EventLog) error
GetEventLogs() ([]*EventLog, error)
GetEventLogsByRepoID(repoID string) ([]*EventLog, error)
GetEventLogsByPrID(prID int64) ([]*EventLog, error)
GetEventLogsByUserID(userID int64) ([]*EventLog, error)
DiffPatchsets(aset *Patchset, bset *Patchset) ([]*Patch, error)
}
type Patch ¶
type Patch struct {
ID int64 `db:"id"`
UserID int64 `db:"user_id"`
PatchsetID int64 `db:"patchset_id"`
AuthorName string `db:"author_name"`
AuthorEmail string `db:"author_email"`
AuthorDate string `db:"author_date"`
Title string `db:"title"`
Body string `db:"body"`
BodyAppendix string `db:"body_appendix"`
CommitSha string `db:"commit_sha"`
ContentSha string `db:"content_sha"`
BaseCommitSha sql.NullString `db:"base_commit_sha"`
RawText string `db:"raw_text"`
CreatedAt time.Time `db:"created_at"`
}
Patch is a database model for a single entry in a patchset. This usually corresponds to a git commit.
type PatchRequest ¶
type PatchRequest struct {
ID int64 `db:"id"`
UserID int64 `db:"user_id"`
RepoID string `db:"repo_id"`
Name string `db:"name"`
Text string `db:"text"`
Status string `db:"status"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
// only used for aggregate queries
LastUpdated string `db:"last_updated"`
}
PatchRequest is a database model for patches submitted to a Repo.
type PatchsetData ¶
type PrCmd ¶
type PrCmd struct {
Backend *Backend
}
func (PrCmd) CreateEventLog ¶
func (PrCmd) DeletePatchsetByID ¶
func (PrCmd) DiffPatchsets ¶
func (PrCmd) GetEventLogs ¶
func (PrCmd) GetEventLogsByPrID ¶
func (PrCmd) GetEventLogsByRepoID ¶
func (PrCmd) GetEventLogsByUserID ¶
func (PrCmd) GetLatestPatchsetByPrID ¶
func (PrCmd) GetPatchRequestByID ¶
func (cmd PrCmd) GetPatchRequestByID(prID int64) (*PatchRequest, error)
func (PrCmd) GetPatchRequests ¶
func (cmd PrCmd) GetPatchRequests() ([]*PatchRequest, error)
func (PrCmd) GetPatchRequestsByRepoID ¶
func (cmd PrCmd) GetPatchRequestsByRepoID(repoID string) ([]*PatchRequest, error)
func (PrCmd) GetPatchesByPatchsetID ¶
func (PrCmd) GetPatchsetsByPrID ¶
func (PrCmd) GetReposWithLatestPr ¶
func (pr PrCmd) GetReposWithLatestPr() ([]RepoWithLatestPr, error)
func (PrCmd) SubmitPatchRequest ¶
func (PrCmd) SubmitPatchset ¶
func (PrCmd) UpdatePatchRequestName ¶
func (PrCmd) UpdatePatchRequestStatus ¶
Status types: open, closed, accepted, reviewed.
type PrDetailData ¶
type PrDetailData struct {
Page string
Repo LinkData
Pr PrData
Patches []PatchData
Branch string
Logs []EventLogData
Patchsets []PatchsetData
MetaData
}
type PrListData ¶
type PrWithRepo ¶
type RepoData ¶
type RepoData struct {
LinkData
Desc string
LatestPr *PrListData
}
type RepoDetailData ¶
type RepoDetailData struct {
ID string
CloneAddr string
Branch string
OpenPrs []PrListData
AcceptedPrs []PrListData
ClosedPrs []PrListData
ReviewedPrs []PrListData
MetaData
}
type RepoListData ¶
type RepoWithLatestPr ¶
type RepoWithLatestPr struct {
*Repo
User *User
PatchRequest *PatchRequest
}
Click to show internal directories.
Click to hide internal directories.
