db

package
v0.0.0-...-3d4bac1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if the given errors is a database result-not-found error

Types

type Database

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

Database is a low-level wrapper around the database driver

func New

func New(l *zap.SugaredLogger, name string, opts config.Database) (*Database, error)

New instantiates a new database

func (*Database) Close

func (db *Database) Close()

Close disconnects from the database

func (*Database) Pool

func (db *Database) Pool() *pgx.ConnPool

Pool returns the underlying pgx connection pool

func (*Database) Repos

func (db *Database) Repos() *ReposDatabase

Repos instantaite a new ReposDatabase client

type GitBurndown

type GitBurndown struct {
	ID     int
	RepoID int
	Month  string

	Global int
	Files  map[string]int
	People map[string]int
}

GitBurndown represents one sample per entry

type RepoMD

type RepoMD struct {
	Description string
}

RepoMD is additional information to include about a repository. Since a lot of stuff isn't include in the initial installation event, this is a separate update.

type ReposDatabase

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

ReposDatabase is a client for accessing repository-related databases

func (*ReposDatabase) DeleteGitBurndownResults

func (r *ReposDatabase) DeleteGitBurndownResults(ctx context.Context, repoID int) error

DeleteGitBurndownResults deletes all git burndown results associated with the given repository ID. TODO: should this be done? see https://github.com/bobheadxi/timelines/issues/44

func (*ReposDatabase) DeleteRepository

func (r *ReposDatabase) DeleteRepository(ctx context.Context, id int) error

DeleteRepository removes a repository and associated items

func (*ReposDatabase) GetFilesBurndown

func (r *ReposDatabase) GetFilesBurndown(
	ctx context.Context,
	repoID int,
	filename string,
) ([]*models.FileBurndownEntry, error)

GetFilesBurndown returns files

func (*ReposDatabase) GetGlobalBurndown

func (r *ReposDatabase) GetGlobalBurndown(
	ctx context.Context,
	repoID int,
) ([]*models.BurndownEntry, error)

GetGlobalBurndown retrieves global burndowns for the given repo TODO: one at a time? all at once?

func (*ReposDatabase) GetRepositories

func (r *ReposDatabase) GetRepositories(ctx context.Context, h host.Host, owner string) ([]*models.Repository, error)

GetRepositories fetches all repositories associated with the given owner

func (*ReposDatabase) GetRepository

func (r *ReposDatabase) GetRepository(
	ctx context.Context, h host.Host, owner, name string,
) (*models.Repository, error)

GetRepository fetches a specific repository

func (*ReposDatabase) InsertGitBurndownResult

func (r *ReposDatabase) InsertGitBurndownResult(
	ctx context.Context,
	repoID int,
	m *analysis.GitRepoMeta,
	bd *analysis.BurndownResult,
) error

InsertGitBurndownResult processes a burndown analysis for insertion

func (*ReposDatabase) InsertHostItems

func (r *ReposDatabase) InsertHostItems(
	ctx context.Context,
	h host.Host,
	repoID int,
	items []*host.Item,
) error

InsertHostItems executes a batch insert on all given items

func (*ReposDatabase) NewRepository

func (r *ReposDatabase) NewRepository(
	ctx context.Context,
	installation string,
	repo host.Repo,
) error

NewRepository creates a new repository entry

func (*ReposDatabase) UpdateRepository

func (r *ReposDatabase) UpdateRepository(
	ctx context.Context, id int, meta RepoMD,
) error

UpdateRepository updates a given repository

Jump to

Keyboard shortcuts

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