store

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 16 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) Artifact

func (db *Store) Artifact(id string) (*model.Event, error)

Artifact returns an artifact by id

func (*Store) Artifacts

func (db *Store) Artifacts(
	repo, branch string,
	gitEvent *dx.GitEvent,
	sourceBranch string,
	sha []string,
	limit, offset int,
	since, until *time.Time) ([]*model.Event, error)

Artifacts returns all events in the database within the given constraints

func (*Store) CreateEvent

func (db *Store) CreateEvent(event *model.Event) (*model.Event, error)

CreateEvent stores a new event in the database

func (*Store) CreateUser

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

CreateUser stores a new user in the database

func (*Store) DeleteUser

func (db *Store) DeleteUser(login string) error

DeleteUser deletes a user in the database

func (*Store) Event

func (db *Store) Event(id string) (*model.Event, error)

Event returns an event by id

func (*Store) GitopsCommit added in v0.4.0

func (db *Store) GitopsCommit(sha string) (*model.GitopsCommit, error)

func (*Store) KeyValue added in v0.5.0

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

KeyValue returns the value of a given KeyValue key

func (*Store) ReposWithCleanupPolicy added in v0.5.0

func (db *Store) ReposWithCleanupPolicy() ([]string, error)

func (*Store) SaveKeyValue added in v0.5.0

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

SaveKeyValue sets a setting

func (*Store) SaveOrUpdateGitopsCommit added in v0.4.0

func (db *Store) SaveOrUpdateGitopsCommit(gitopsCommit *model.GitopsCommit) error

func (*Store) SaveReposWithCleanupPolicy added in v0.5.0

func (db *Store) SaveReposWithCleanupPolicy(reposWithCleanupPolicy []string) error

func (*Store) UnprocessedEvents

func (db *Store) UnprocessedEvents() (events []*model.Event, err error)

UnprocessedEvents selects an event timeline

func (*Store) UpdateEventStatus

func (db *Store) UpdateEventStatus(id string, status string, desc string, gitopsStatusString string) error

UpdateEventStatus updates an event status in the database

func (*Store) User

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

User gets a user by its login name

func (*Store) Users

func (db *Store) Users() ([]*model.User, error)

Users returns all users in the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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