repo

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 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 = `` /* 772-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite repos table.
	CreateSqliteTable = `` /* 693-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

This section is empty.

Types

type Engine added in v0.27.0

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

Engine represents the repo functionality that implements the RepoInterface interface.

func New

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

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

func (*Engine) CountRepos added in v0.27.0

func (e *Engine) CountRepos(ctx context.Context) (int64, error)

CountRepos gets the count of all repos from the database.

func (*Engine) CountReposForOrg added in v0.27.0

func (e *Engine) CountReposForOrg(ctx context.Context, org string, filters map[string]interface{}) (int64, error)

CountReposForOrg gets the count of repos by org name from the database.

func (*Engine) CountReposForUser added in v0.27.0

func (e *Engine) CountReposForUser(ctx context.Context, u *api.User, filters map[string]interface{}) (int64, error)

CountReposForUser gets the count of repos by user ID from the database.

func (*Engine) CreateRepo added in v0.27.0

func (e *Engine) CreateRepo(ctx context.Context, r *api.Repo) (*api.Repo, error)

CreateRepo creates a new repo in the database.

func (*Engine) CreateRepoIndexes added in v0.27.0

func (e *Engine) CreateRepoIndexes(ctx context.Context) error

CreateRepoIndexes creates the indexes for the repos table in the database.

func (*Engine) CreateRepoTable added in v0.27.0

func (e *Engine) CreateRepoTable(ctx context.Context, driver string) error

CreateRepoTable creates the repos table in the database.

func (*Engine) DeleteRepo added in v0.27.0

func (e *Engine) DeleteRepo(ctx context.Context, r *api.Repo) error

DeleteRepo deletes an existing repo from the database.

func (*Engine) GetRepo added in v0.27.0

func (e *Engine) GetRepo(ctx context.Context, id int64) (*api.Repo, error)

GetRepo gets a repo by ID from the database.

func (*Engine) GetRepoForOrg added in v0.27.0

func (e *Engine) GetRepoForOrg(ctx context.Context, org, name string) (*api.Repo, error)

GetRepoForOrg gets a repo by org and repo name from the database.

func (*Engine) GetReposInList added in v0.27.0

func (e *Engine) GetReposInList(ctx context.Context, nameList []string) ([]*api.Repo, error)

GetReposInList gets a list of repos from the database from a list of full_names.

func (*Engine) ListRepos added in v0.27.0

func (e *Engine) ListRepos(ctx context.Context) ([]*api.Repo, error)

ListRepos gets a list of all repos from the database.

func (*Engine) ListReposForOrg added in v0.27.0

func (e *Engine) ListReposForOrg(ctx context.Context, org, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error)

ListReposForOrg gets a list of repos by org name from the database.

func (*Engine) ListReposForUser added in v0.27.0

func (e *Engine) ListReposForUser(ctx context.Context, u *api.User, sortBy string, filters map[string]interface{}, page, perPage int) ([]*api.Repo, error)

ListReposForUser gets a list of repos by user ID from the database.

func (*Engine) UpdateRepo added in v0.27.0

func (e *Engine) UpdateRepo(ctx context.Context, r *api.Repo) (*api.Repo, error)

UpdateRepo updates an existing repo in the database.

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

Jump to

Keyboard shortcuts

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