store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	*sql.DB
	// contains filtered or unexported fields
}

Store is used to access data from the sql/database driver with a relational database backend.

func From

func From(db *sql.DB) *Store

From returns a Store using an existing database connection.

func New

func New(driver, config string) *Store

New creates a database connection for the given driver and datasource and returns a new Store.

func NewTest

func NewTest() *Store

NewTest creates a new database connection for testing purposes. The database driver and connection string are provided by environment variables, with fallback to in-memory sqlite.

func (*Store) Commits

func (db *Store) Commits(repo string) ([]*model.Commit, error)

Commits gets the most recent 20 commits from a repo

func (*Store) CommitsByRepoAndSHA

func (db *Store) CommitsByRepoAndSHA(repo string, hashes []string) ([]*model.Commit, error)

func (*Store) CreateCommit

func (db *Store) CreateCommit(commit *model.Commit) error

CreateCommit stores a new commit in the database

func (*Store) CreateUser

func (db *Store) CreateUser(user *model.User) error

CreateUser stores a new user in the database

func (*Store) KeyValue added in v0.3.0

func (db *Store) KeyValue(key string) (*model.KeyValue, error)

KeyValue returns the value of a given KeyValue key

func (*Store) SaveCommits

func (db *Store) SaveCommits(repo string, commits []*model.Commit) error

SaveCommits stores new commits in the database, or updates them

func (*Store) SaveKeyValue added in v0.3.0

func (db *Store) SaveKeyValue(setting *model.KeyValue) error

SaveKeyValue sets a setting

func (*Store) SaveStatusesOnCommits

func (db *Store) SaveStatusesOnCommits(repo string, statuses map[string]*model.CombinedStatus) error

SaveStatusesOnCommits updates statuses on commits

func (*Store) SaveTagsOnCommits

func (db *Store) SaveTagsOnCommits(repo string, tags map[string][]string) error

SaveTagsOnCommits updates tags on commits

func (*Store) UpdateUser

func (db *Store) UpdateUser(user *model.User) error

UpdateUser updates a user in the database

func (*Store) User

func (db *Store) User(login string) (*model.User, error)

User gets a user by its login name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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