cockroachdb

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePullRequest

func DecodePullRequest(pr *PullRequest) *database.PullRequest

DecodePullRequest decodes a cockroachdb PullRequest into a generic database.PullRequest

func DecodePullRequestReview

func DecodePullRequestReview(prReview *PullRequestReview) *database.PullRequestReview

DecodePullRequestReview decodes a cockroachdb PullRequestReview into a generic database.PullRequestReview

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func New

func New(host, rootCert, cert, key string) (*cockroachdb, error)

New returns a new cockroachdb context that contains a connection to the specified database that was made using the politeiawww user and the passed in certificates.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Commit

type Commit struct {
	SHA          string `gorm:"primary_key"`
	Repo         string `gorm:"repo"`
	Organization string `gorm:"organization"`
	Date         int64  `gorm:"not null"`
	Author       string `gorm:"not null"`
	Committer    string `gorm:"not null"`
	Message      string `gorm:"not null"`
	URL          string `gorm:"not null"`
	ParentSHA    string `gorm:"not null"`
	ParentURL    string `gorm:"not null"`
	Additions    int    `gorm:"not null"`
	Deletions    int    `gorm:"not null"`
}

func (Commit) TableName

func (Commit) TableName() string

TableName returns the table name of the commits table.

type MatchingReviews

type MatchingReviews struct {
	PullRequestURL string
	ID             int64
	Author         string
	State          string
	SubmittedAt    int64
	CommitID       string
	Repo           string
	Number         int
	Additions      int
	Deletions      int
}

MatchingReviews is a struct that will return results from a review request.

type PullRequest

type PullRequest struct {
	ID           string `gorm:"primary_key"`
	Repo         string `gorm:"not null"`
	Organization string `gorm:"not null"`
	URL          string `gorm:"not null"`
	Number       int    `gorm:"not null"`
	Author       string `gorm:"not null"`
	UpdatedAt    int64  `gorm:"not null"`
	ClosedAt     int64  `gorm:"not null"`
	MergedAt     int64  `gorm:"not null"`
	Merged       bool   `gorm:"not null"`
	State        string `gorm:"not null"`
	Additions    int    `gorm:"not null"`
	Deletions    int    `gorm:"not null"`
	MergedBy     string `gorm:"not null"`
}

PullRequest table has all of the information for a given PullRequest, this also includes its commits and reviews.

func EncodePullRequest

func EncodePullRequest(dbPullRequest *database.PullRequest) PullRequest

EncodePullRequest encodes a database.PullRequest into a cockroachdb PullRequest.

func (PullRequest) TableName

func (PullRequest) TableName() string

TableName returns the table name of the pull requests table.

type PullRequestReview

type PullRequestReview struct {
	PullRequestURL string `gorm:"not null"`
	ID             int64  `gorm:"primary_key"`
	Author         string `gorm:"not null"`
	State          string `gorm:"not null"`
	SubmittedAt    int64  `gorm:"not null"`
	CommitID       string `gorm:"not null"`
	Repo           string `gorm:"not null"`
	Number         int    `gorm:"not null"`
}

PullRequestReview contains all of the information about reviews of a given pull request.

func EncodePullRequestReview

func EncodePullRequestReview(dbPullRequestReview *database.PullRequestReview) PullRequestReview

EncodePullRequestReview encodes a database.PullRequestReview into a cockroachdb PullRequestReview.

func (PullRequestReview) TableName

func (PullRequestReview) TableName() string

TableName returns the table name of the pull requests review table.

type Version

type Version struct {
	ID        string `gorm:"primary_key"` // Primary key
	Version   string `gorm:"not null"`    // Version
	Timestamp int64  `gorm:"not null"`    // UNIX timestamp of record creation
}

Version describes the version of a record or plugin that the database is currently using.

func (Version) TableName

func (Version) TableName() string

TableName returns the table name of the versions table.

Jump to

Keyboard shortcuts

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