db

package
v0.0.0-...-c7609e9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RepositoryDAO = RepositoryDaoImpl{}

Functions

func BootstrapDB

func BootstrapDB(schemaFolder string, DB *sql.DB) error

BootstrapDB attempts to execute all files ending in .sql from the provided directory against the provided database, in alphabetical order by filename. If no files are found, an error is returned.

func LastInsertID

func LastInsertID(db *sql.DB) (int, error)

LastInsertID retrieves the last insert ID. Its use is prone to race-conditions in case multiple queries are being executed simultaneously.

func SeedRepositories

func SeedRepositories(repoCsv string, DB *sql.DB) error

SeedRepositories loads the repositories from the provided CSV file into the database only if there are not any repository records already present in the database.

Types

type Expert

type Expert struct {
	Username        string `prof:"username"`
	AssessmentCount int    `prof:"assessment_count"`
}

Expert is a GitHub user marked as an expert

type ExpertDAOImpl

type ExpertDAOImpl struct {
	Upsert         func(ctx context.Context, q proteus.ContextExecutor, e Expert) (int64, error)        `proq:"q:upsert" prop:"e"`
	FindByUsername func(ctx context.Context, q proteus.ContextQuerier, username string) (Expert, error) `proq:"q:findByUsername" prop:"username"`
}
var ExpertDAO ExpertDAOImpl

type Finding

type Finding struct {
	ID           int64  `prof:"id"`
	GithubOwner  string `prof:"github_owner"`
	GithubRepo   string `prof:"github_repo"`
	Filepath     string `prof:"filepath"`
	RootCommitID string `prof:"root_commit_id"`
	Quote        string `prof:"quote"`
	QuoteMD5Sum  Md5Sum `prof:"quote_md5sum"`
	StartLine    int    `prof:"start_line"`
	EndLine      int    `prof:"end_line"`
	Message      string `prof:"message"`
	ExtraInfo    string `prof:"extra_info"`
}

type FindingDaoImpl

type FindingDaoImpl struct {
	Create        func(ctx context.Context, e proteus.ContextExecutor, f Finding) (int64, error) `proq:"q:create" prop:"f"`
	FindByID      func(ctx context.Context, q proteus.ContextQuerier, id int64) (Finding, error) `proq:"q:findById" prop:"id"`
	ListChecksums func(ctx context.Context, q proteus.ContextQuerier) ([]Md5Sum, error)          `proq:"q:listChecksums"`
}
var FindingDAO FindingDaoImpl

type Gopher

type Gopher struct {
	Username          string `prof:"username"`
	DisagreementCount int    `prof:"disagreement_count"`
	AssessmentCount   int    `prof:"assessment_count"`
}

type GopherDAOImpl

type GopherDAOImpl struct {
	Upsert         func(ctx context.Context, q proteus.ContextExecutor, g Gopher) (int64, error)        `proq:"q:upsert" prop:"g"`
	FindByUsername func(ctx context.Context, q proteus.ContextQuerier, username string) (Gopher, error) `proq:"q:findByUsername" prop:"username"`
}
var GopherDAO GopherDAOImpl

type Issue

type Issue struct {
	FindingID          int    `prof:"finding_id"`
	GithubOwner        string `prof:"github_owner"`
	GithubRepo         string `prof:"github_repo"`
	GithubID           int    `prof:"github_id"`
	ExpertAssessment   string `prof:"expert_assessment"`
	ExpertDisagreement int    `prof:"expert_disagreement"`
}

func (*Issue) ExpertsDisagree

func (i *Issue) ExpertsDisagree() bool

func (*Issue) SetExpertsDisagree

func (i *Issue) SetExpertsDisagree(value bool)

type IssueDAOImpl

type IssueDAOImpl struct {
	FindByCoordinates func(ctx context.Context, q proteus.ContextQuerier, owner, repo string, githubID int) (Issue, error) `proq:"q:findByFindingID" prop:"owner,repo,githubID"`
	Upsert            func(ctx context.Context, q proteus.ContextExecutor, i Issue) (int64, error)                         `proq:"q:upsert" prop:"i"`
}
var IssueDAO IssueDAOImpl

type Md5Sum

type Md5Sum []byte

type RepoState

type RepoState string
const (
	RepoStateFresh   RepoState = "F"
	RepoStateVisited RepoState = "V"
	RepoStateError   RepoState = "E"
)

type Repository

type Repository struct {
	GithubOwner string    `prof:"github_owner"`
	GithubRepo  string    `prof:"github_repo"`
	State       RepoState `prof:"state"`
}

func NewRepository

func NewRepository(owner, repo string) Repository

type RepositoryDaoImpl

type RepositoryDaoImpl struct {
	FindByID    func(ctx context.Context, q proteus.ContextQuerier, owner, repo string) (Repository, error) `proq:"q:findByID" prop:"owner,repo"`
	ListByState func(ctx context.Context, q proteus.ContextQuerier, state RepoState) ([]Repository, error)  `proq:"q:listByState" prop:"state"`
	Upsert      func(ctx context.Context, e proteus.ContextExecutor, r Repository) (int64, error)           `proq:"q:upsert" prop:"r"`
	CountAll    func(ctx context.Context, q proteus.ContextQuerier) (int64, error)                          `proq:"q:count"`
}

Jump to

Keyboard shortcuts

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