repo

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

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

	// CreateSqliteTable represents a query to create the Sqlite repos table.
	CreateSqliteTable = `` /* 672-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 WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context 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 RepoInterface added in v0.20.0

type RepoInterface interface {

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

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

RepoInterface 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