Documentation
¶
Index ¶
- Constants
- type DeploymentInterface
- type Engine
- func (e *Engine) CountDeployments(ctx context.Context) (int64, error)
- func (e *Engine) CountDeploymentsForRepo(ctx context.Context, r *api.Repo) (int64, error)
- func (e *Engine) CreateDeployment(ctx context.Context, d *api.Deployment) (*api.Deployment, error)
- func (e *Engine) CreateDeploymentIndexes(ctx context.Context) error
- func (e *Engine) CreateDeploymentTable(ctx context.Context, driver string) error
- func (e *Engine) DeleteDeployment(ctx context.Context, d *api.Deployment) error
- func (e *Engine) GetDeployment(ctx context.Context, id int64) (*api.Deployment, error)
- func (e *Engine) GetDeploymentForRepo(ctx context.Context, r *api.Repo, number int64) (*api.Deployment, error)
- func (e *Engine) ListDeployments(ctx context.Context) ([]*api.Deployment, error)
- func (e *Engine) ListDeploymentsForRepo(ctx context.Context, r *api.Repo, page, perPage int) ([]*api.Deployment, error)
- func (e *Engine) UpdateDeployment(ctx context.Context, d *api.Deployment) (*api.Deployment, error)
- type EngineOpt
Constants ¶
const ( // CreatePostgresTable represents a query to create the Postgres deployments table. CreatePostgresTable = `` /* 427-byte string literal not displayed */ // CreateSqliteTable represents a query to create the Sqlite deployments table. CreateSqliteTable = `` /* 440-byte string literal not displayed */ )
const ( // CreateRepoIDIndex represents a query to create an // index on the deployments table for the repo_id column. CreateRepoIDIndex = ` CREATE INDEX IF NOT EXISTS deployments_repo_id ON deployments (repo_id); ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeploymentInterface ¶
type DeploymentInterface interface {
// CreateDeploymentIndexes defines a function that creates the indexes for the deployment table.
CreateDeploymentIndexes(context.Context) error
// CreateDeploymentTable defines a function that creates the deployment table.
CreateDeploymentTable(context.Context, string) error
// CountDeployments defines a function that gets the count of all deployments.
CountDeployments(context.Context) (int64, error)
// CountDeploymentsForRepo defines a function that gets the count of deployments by repo ID.
CountDeploymentsForRepo(context.Context, *api.Repo) (int64, error)
// CreateDeployment defines a function that creates a new deployment.
CreateDeployment(context.Context, *api.Deployment) (*api.Deployment, error)
// DeleteDeployment defines a function that deletes an existing deployment.
DeleteDeployment(context.Context, *api.Deployment) error
// GetDeployment defines a function that gets a deployment by ID.
GetDeployment(context.Context, int64) (*api.Deployment, error)
// GetDeploymentForRepo defines a function that gets a deployment by repo ID and number.
GetDeploymentForRepo(context.Context, *api.Repo, int64) (*api.Deployment, error)
// ListDeployments defines a function that gets a list of all deployments.
ListDeployments(context.Context) ([]*api.Deployment, error)
// ListDeploymentsForRepo defines a function that gets a list of deployments by repo ID.
ListDeploymentsForRepo(context.Context, *api.Repo, int, int) ([]*api.Deployment, error)
// UpdateDeployment defines a function that updates an existing deployment.
UpdateDeployment(context.Context, *api.Deployment) (*api.Deployment, error)
}
type Engine ¶ added in v0.27.0
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the deployment functionality that implements the DeploymentInterface interface.
func (*Engine) CountDeployments ¶ added in v0.27.0
CountDeployments gets the count of all deployments from the database.
func (*Engine) CountDeploymentsForRepo ¶ added in v0.27.0
CountDeploymentsForRepo gets the count of deployments by repo ID from the database.
func (*Engine) CreateDeployment ¶ added in v0.27.0
func (e *Engine) CreateDeployment(ctx context.Context, d *api.Deployment) (*api.Deployment, error)
CreateDeployment creates a new deployment in the database.
func (*Engine) CreateDeploymentIndexes ¶ added in v0.27.0
CreateDeploymetsIndexes creates the indexes for the deployments table in the database.
func (*Engine) CreateDeploymentTable ¶ added in v0.27.0
CreateDeploymentTable creates the deployments table in the database.
func (*Engine) DeleteDeployment ¶ added in v0.27.0
DeleteDeployment deletes an existing deployment from the database.
func (*Engine) GetDeployment ¶ added in v0.27.0
GetDeployment gets a deployment by ID from the database.
func (*Engine) GetDeploymentForRepo ¶ added in v0.27.0
func (e *Engine) GetDeploymentForRepo(ctx context.Context, r *api.Repo, number int64) (*api.Deployment, error)
GetDeploymentForRepo gets a deployment by repo ID and number from the database.
func (*Engine) ListDeployments ¶ added in v0.27.0
ListDeployments gets a list of all deployments from the database.
func (*Engine) ListDeploymentsForRepo ¶ added in v0.27.0
func (e *Engine) ListDeploymentsForRepo(ctx context.Context, r *api.Repo, page, perPage int) ([]*api.Deployment, error)
ListDeploymentsForRepo gets a list of deployments by repo ID from the database.
func (*Engine) UpdateDeployment ¶ added in v0.27.0
func (e *Engine) UpdateDeployment(ctx context.Context, d *api.Deployment) (*api.Deployment, error)
UpdateDeployment updates an existing deployment in the database.
type EngineOpt ¶
EngineOpt represents a configuration option to initialize the database engine for Deployments.
func WithClient ¶
WithClient sets the gorm.io/gorm client in the database engine for Deployments.
func WithContext ¶
WithContext sets the context in the database engine for Deployments.
func WithEncryptionKey ¶ added in v0.26.0
WithEncryptionKey sets the encryption key in the database engine for Deployments.
func WithLogger ¶
WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Deployments.
func WithSkipCreation ¶
WithSkipCreation sets the skip creation logic in the database engine for Deployments.