repo

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres repos table.
	CreatePostgresTable = `` /* 657-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite repos table.
	CreateSqliteTable = `` /* 606-byte string literal not displayed */

)
View Source
const (
	// CreateOrgNameIndex represents a query to create an
	// index on the repos table for the org and name columns.
	CreateOrgNameIndex = `
CREATE INDEX
IF NOT EXISTS
repos_org_name
ON repos (org, name);
`
)

Variables

This section is empty.

Functions

func New

func New(opts ...EngineOpt) (*engine, error)

New creates and returns a Vela service for integrating with repos in the database.

Types

type EngineOpt

type EngineOpt func(*engine) error

EngineOpt represents a configuration option to initialize the database engine for Repos.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Repos.

func WithEncryptionKey

func WithEncryptionKey(key string) EngineOpt

WithEncryptionKey sets the encryption key in the database engine for Repos.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Repos.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for Repos.

type RepoService

type RepoService interface {

	// CreateRepoIndexes defines a function that creates the indexes for the repos table.
	CreateRepoIndexes() error
	// CreateRepoTable defines a function that creates the repos table.
	CreateRepoTable(string) error

	// CountRepos defines a function that gets the count of all repos.
	CountRepos() (int64, error)
	// CountReposForOrg defines a function that gets the count of repos by org name.
	CountReposForOrg(string, map[string]interface{}) (int64, error)
	// CountReposForUser defines a function that gets the count of repos by user ID.
	CountReposForUser(*library.User, map[string]interface{}) (int64, error)
	// CreateRepo defines a function that creates a new repo.
	CreateRepo(*library.Repo) error
	// DeleteRepo defines a function that deletes an existing repo.
	DeleteRepo(*library.Repo) error
	// GetRepo defines a function that gets a repo by ID.
	GetRepo(int64) (*library.Repo, error)
	// GetRepoForOrg defines a function that gets a repo by org and repo name.
	GetRepoForOrg(string, string) (*library.Repo, error)
	// ListRepos defines a function that gets a list of all repos.
	ListRepos() ([]*library.Repo, error)
	// ListReposForOrg defines a function that gets a list of repos by org name.
	ListReposForOrg(string, string, map[string]interface{}, int, int) ([]*library.Repo, int64, error)
	// ListReposForUser defines a function that gets a list of repos by user ID.
	ListReposForUser(*library.User, string, map[string]interface{}, int, int) ([]*library.Repo, int64, error)
	// UpdateRepo defines a function that updates an existing repo.
	UpdateRepo(*library.Repo) error
}

RepoService represents the Vela interface for repo functions with the supported Database backends.

Jump to

Keyboard shortcuts

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