database

package
v0.0.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TokenSelectByID = tokenSelectBase + `
WHERE token_id = $1
`
View Source
const TokenSelectByPrincipalIDAndIdentifier = tokenSelectBase + `
WHERE token_principal_id = $1 AND LOWER(token_uid) = $2
`

Variables

WireSet provides a wire set for this package.

Functions

func NewServerStore

func NewServerStore(db *sqlx.DB) store.ServerStore

NewServerStore create a new server store.

func PartialMatch

func PartialMatch(column, value string) (string, string)

func ProvideApplicationStore

func ProvideApplicationStore(db *sqlx.DB) store.ApplicationStore

ProvideApplicationStore provides a token store.

func ProvideAuthSettingStore

func ProvideAuthSettingStore(db *sqlx.DB) store.AuthSettingsStore

ProvideAuthSettingStore provides a auth setting store.

func ProvideDatabase

func ProvideDatabase(ctx context.Context, config database.Config) (*sqlx.DB, error)

ProvideDatabase provides a database connection.

func ProvideDeploymentStore

func ProvideDeploymentStore(db *sqlx.DB) store.DeploymentStore

ProvideDeploymentStore provides a deployment store.

func ProvideEnvironmentStore

func ProvideEnvironmentStore(db *sqlx.DB) store.EnvironmentStore

ProvideEnvironmentStore provides a project store.

func ProvideFavoriteStore

func ProvideFavoriteStore(db *sqlx.DB) store.FavoriteStore

ProvideFavoriteStore provides a favorite store.

func ProvideGithubAppStore

func ProvideGithubAppStore(db *sqlx.DB) store.GithubAppStore

ProvideGithubAppStore provides a github app store.

func ProvideInstanceStore

func ProvideInstanceStore(db *sqlx.DB) store.InstanceStore

ProvideInstanceStore provides a instance store.

func ProvideJobStore

func ProvideJobStore(db *sqlx.DB) job.Store

ProvideJobStore provides a volume store.

func ProvideLogStore

func ProvideLogStore(db *sqlx.DB) store.LogStore

ProvideLogStore provides a log store.

func ProvidePrivateKeyStore

func ProvidePrivateKeyStore(db *sqlx.DB) store.PrivateKeyStore

ProvidePrivateKeyStore provides a private key store.

func ProvideProjectMembershipStore

func ProvideProjectMembershipStore(db *sqlx.DB) store.ProjectMembershipStore

ProvideProjectMembership provides a tenant membership store.

func ProvideProjectStore

func ProvideProjectStore(db *sqlx.DB) store.ProjectStore

ProvideProjectStore provides a project store.

func ProvideServerStore

func ProvideServerStore(db *sqlx.DB) store.ServerStore

ProvideServerStore provides a server store.

func ProvideTemplateStore

func ProvideTemplateStore(db *sqlx.DB) store.TemplateStore

ProvideTemplateStore provides a template store.

func ProvideTenantMembershipStore

func ProvideTenantMembershipStore(db *sqlx.DB) store.TenantMembershipStore

ProvideTenantMembershipRow provides a tenant membership store.

func ProvideTenantStore

func ProvideTenantStore(db *sqlx.DB) store.TenantStore

ProvideTenantStore provides a tenant store.

func ProvideTokenStore

func ProvideTokenStore(db *sqlx.DB) store.TokenStore

ProvideTokenStore provides a token store.

func ProvideUserStore

func ProvideUserStore(db *sqlx.DB) store.PrincipalStore

ProvideUserStore provides a user store.

func ProvideVariableStore

func ProvideVariableStore(db *sqlx.DB) store.VariableStore

ProvideEnvironmentVariableStore provides a environment variable store.

func ProvideVolumeStore

func ProvideVolumeStore(db *sqlx.DB) store.VolumeStore

ProvideVolumeStore provides a volume store.

Types

type ApplicationStore

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

ApplicationStore implements a ApplicationStore backed by a relational database.

func NewApplicationStore

func NewApplicationStore(db *sqlx.DB) *ApplicationStore

NewApplicationStore returns new ApplicationStore

func (*ApplicationStore) Count

func (*ApplicationStore) CountByName

func (s *ApplicationStore) CountByName(ctx context.Context, name string) (int64, error)

Find is the app name available.

func (*ApplicationStore) Create

func (s *ApplicationStore) Create(ctx context.Context, application *types.Application) (*types.Application, error)

func (*ApplicationStore) Find

Find the app by id.

func (*ApplicationStore) FindByUID

func (s *ApplicationStore) FindByUID(ctx context.Context, tenantID, projectID, environmentID, uid int64) (*types.Application, error)

func (*ApplicationStore) FindDeleted

func (s *ApplicationStore) FindDeleted(ctx context.Context, id int64, deletedAt *int64) (*types.Application, error)

func (*ApplicationStore) FindDeletedByUID

func (s *ApplicationStore) FindDeletedByUID(ctx context.Context, tenantID, projectID, environmentID, uid int64, deletedAt *int64) (*types.Application, error)

func (*ApplicationStore) List

List returns a list of applications for the given filter

func (*ApplicationStore) Purge

func (s *ApplicationStore) Purge(ctx context.Context, id int64, deletedAt *int64) error

Purge deletes the application permanently.

func (*ApplicationStore) SoftDelete

func (s *ApplicationStore) SoftDelete(ctx context.Context, application *types.Application, deletedAt int64) error

func (*ApplicationStore) UpdateDeploymentStatus

func (s *ApplicationStore) UpdateDeploymentStatus(ctx context.Context, application *types.Application) (*types.Application, error)

func (*ApplicationStore) UpdateDeploymentTriggerTime

func (s *ApplicationStore) UpdateDeploymentTriggerTime(ctx context.Context, application *types.Application) (*types.Application, error)

func (*ApplicationStore) UpdateNeedsDeployment

func (s *ApplicationStore) UpdateNeedsDeployment(ctx context.Context, application *types.Application) (*types.Application, error)

func (*ApplicationStore) UpdateSpec

func (s *ApplicationStore) UpdateSpec(ctx context.Context, application *types.Application) (*types.Application, error)

func (*ApplicationStore) UpdateStatus

func (s *ApplicationStore) UpdateStatus(ctx context.Context, application *types.Application) (*types.Application, error)

type AuthSettingsStore

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

func NewAuthSettingsStore

func NewAuthSettingsStore(db *sqlx.DB) *AuthSettingsStore

func (*AuthSettingsStore) Create

Create saves the auth setting.

func (*AuthSettingsStore) FindByProvider

func (s *AuthSettingsStore) FindByProvider(ctx context.Context, provider enum.AuthProvider) (*types.AuthSetting, error)

FindByProvider gets the auth settings by provider.

func (*AuthSettingsStore) List

List lists the auth settings.

func (*AuthSettingsStore) Update

Update updates the auth settings

type DeploymentStore

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

DeploymentStore implements a DeploymentStore backed by a relational database.

func NewDeploymentStore

func NewDeploymentStore(db *sqlx.DB) *DeploymentStore

NewDeploymentStore returns new DeploymentStore

func (*DeploymentStore) Create

func (s *DeploymentStore) Create(ctx context.Context, deployment *types.Deployment) (*types.Deployment, error)

func (*DeploymentStore) Find

func (s *DeploymentStore) Find(ctx context.Context, id int64) (*types.Deployment, error)

func (*DeploymentStore) FindByUID

func (s *DeploymentStore) FindByUID(ctx context.Context, applicationID int64, uid int64) (*types.Deployment, error)

func (*DeploymentStore) List

func (s *DeploymentStore) List(ctx context.Context, applicationID int64) ([]*types.Deployment, error)

func (*DeploymentStore) ListIncomplete

func (s *DeploymentStore) ListIncomplete(ctx context.Context) ([]*types.Deployment, error)

func (*DeploymentStore) ListIncompleteByApplicationID

func (s *DeploymentStore) ListIncompleteByApplicationID(ctx context.Context, applicationID int64) ([]*types.Deployment, error)

func (*DeploymentStore) Update

func (s *DeploymentStore) Update(ctx context.Context, deployment *types.Deployment) error

type EnvironmentStore

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

func NewEnvironmentSore

func NewEnvironmentSore(db *sqlx.DB) *EnvironmentStore

func (*EnvironmentStore) Create

func (s *EnvironmentStore) Create(ctx context.Context, environment *types.Environment) (*types.Environment, error)

Create save the environment details.

func (*EnvironmentStore) Find

Find the environment by id.

func (*EnvironmentStore) FindByUID

func (s *EnvironmentStore) FindByUID(ctx context.Context, projectID int64, environmentUID int64) (*types.Environment, error)

FindByUID finds the environment by projectID and environmentUID.

func (*EnvironmentStore) FindDeleted

func (s *EnvironmentStore) FindDeleted(ctx context.Context, id int64, deletedAt *int64) (*types.Environment, error)

func (*EnvironmentStore) FindDeletedByUID

func (s *EnvironmentStore) FindDeletedByUID(ctx context.Context, projectID int64, environmentUID int64, deletedAt **int64) (*types.Environment, error)

func (*EnvironmentStore) List

List returns a list of environment for the given filter

func (*EnvironmentStore) Purge

func (s *EnvironmentStore) Purge(ctx context.Context, id int64, deletedAt *int64) error

func (*EnvironmentStore) SoftDelete

func (s *EnvironmentStore) SoftDelete(ctx context.Context, environment *types.Environment, deletedAt int64) error

func (*EnvironmentStore) Update

func (s *EnvironmentStore) Update(ctx context.Context, environment *types.Environment) (*types.Environment, error)

Update updates the environment details.

type FavoriteStore

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

func NewFavoriteStore

func NewFavoriteStore(db *sqlx.DB) *FavoriteStore

func (*FavoriteStore) Add

func (s *FavoriteStore) Add(ctx context.Context, userID, applicationID int64) error

Add adds a favorite

func (*FavoriteStore) Delete

func (s *FavoriteStore) Delete(ctx context.Context, userID, applicationID int64) error

Delete delete a favorite

func (*FavoriteStore) Find

func (s *FavoriteStore) Find(ctx context.Context, userID, applicationID int64) (*types.Favorite, error)

Find find the favorite by user id and application id

func (*FavoriteStore) List

func (s *FavoriteStore) List(ctx context.Context, userID, tenantID int64) ([]*types.FavoriteDTO, error)

List lists the favorite by tenant id

type GithubAppStore

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

func NewGithubAppStore

func NewGithubAppStore(db *sqlx.DB) *GithubAppStore

func (*GithubAppStore) Create

func (s *GithubAppStore) Create(ctx context.Context, githubapp *types.GithubApp) (*types.GithubApp, error)

Create save the github app.

func (*GithubAppStore) Delete

func (s *GithubAppStore) Delete(ctx context.Context, githubapp *types.GithubApp) error

func (*GithubAppStore) Find

func (s *GithubAppStore) Find(ctx context.Context, tenantID, projectID, githubAppID int64) (*types.GithubApp, error)

func (*GithubAppStore) FindByUID

func (s *GithubAppStore) FindByUID(ctx context.Context, tenantID int64, projectID int64, githubAppUID int64) (*types.GithubApp, error)

func (*GithubAppStore) List

func (s *GithubAppStore) List(ctx context.Context, tenantID, projectID int64) ([]*types.GithubApp, error)

List lists the github apps for tenant and project

func (*GithubAppStore) Update

func (s *GithubAppStore) Update(ctx context.Context, githubapp *types.GithubApp) (*types.GithubApp, error)

Update updates the github app.

type InstanceStore

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

InstanceStore implements a InstanceStore backed by a relational database.

func NewInstanceStore

func NewInstanceStore(db *sqlx.DB) *InstanceStore

NewInstanceStore creates a new instance store.

func (*InstanceStore) Create

func (s *InstanceStore) Create(ctx context.Context, instance *types.Instance) (*types.Instance, error)

Create saves the instance settings.

func (*InstanceStore) Get

func (s *InstanceStore) Get(ctx context.Context) (*types.Instance, error)

Get gets the only instance settings

func (*InstanceStore) Update

func (s *InstanceStore) Update(ctx context.Context, instance *types.Instance) (*types.Instance, error)

Update updates the instance settings

type JobStore

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

func NewJobStore

func NewJobStore(db *sqlx.DB) *JobStore

func (*JobStore) CountRunning

func (s *JobStore) CountRunning(ctx context.Context) (int, error)

CountRunning returns number of jobs that are currently being run.

func (*JobStore) Create

func (s *JobStore) Create(ctx context.Context, job *job.Job) error

Create creates a new job.

func (*JobStore) DeleteByGroupID

func (s *JobStore) DeleteByGroupID(ctx context.Context, groupID string) (int64, error)

DeleteByGroupID deletes all jobs for a group id.

func (*JobStore) DeleteByUID

func (s *JobStore) DeleteByUID(ctx context.Context, jobUID string) error

DeleteByID deletes a job by its unique identifier.

func (*JobStore) DeleteOld

func (s *JobStore) DeleteOld(ctx context.Context, olderThan time.Time) (int64, error)

DeleteOld removes non-recurring jobs that have finished execution or have failed.

func (*JobStore) Find

func (s *JobStore) Find(ctx context.Context, uid string) (*job.Job, error)

Find fetches a job by its unique identifier.

func (*JobStore) ListByGroupID

func (s *JobStore) ListByGroupID(ctx context.Context, groupID string) ([]*job.Job, error)

ListByGroupID fetches all jobs for a group id.

func (*JobStore) ListDeadlineExceeded

func (s *JobStore) ListDeadlineExceeded(ctx context.Context, now time.Time) ([]*job.Job, error)

ListDeadlineExceeded returns a list of jobs that have exceeded their execution deadline.

func (*JobStore) ListReady

func (s *JobStore) ListReady(ctx context.Context, now time.Time, limit int) ([]*job.Job, error)

ListReady returns a list of jobs that are ready for execution: The jobs with state="scheduled" and scheduled time in the past.

func (*JobStore) NextScheduledTime

func (s *JobStore) NextScheduledTime(ctx context.Context, now time.Time) (time.Time, error)

NextScheduledTime returns a scheduled time of the next ready job or zero time if no such job exists.

func (*JobStore) UpdateDefinition

func (s *JobStore) UpdateDefinition(ctx context.Context, job *job.Job) error

UpdateDefinition is used to update a job definition.

func (*JobStore) UpdateExecution

func (s *JobStore) UpdateExecution(ctx context.Context, job *job.Job) error

UpdateExecution is used to update a job before and after execution.

func (*JobStore) UpdateProgress

func (s *JobStore) UpdateProgress(ctx context.Context, job *job.Job) error

func (*JobStore) Upsert

func (s *JobStore) Upsert(ctx context.Context, job *job.Job) error

Upsert creates or updates a job. If the job didn't exist it will insert it in the database, otherwise it will update it but only if its definition has changed.

type LogStore

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

func NewLogStore

func NewLogStore(db *sqlx.DB) *LogStore

func (*LogStore) Create

func (s *LogStore) Create(ctx context.Context, deploymentID int64, r io.Reader) error

func (*LogStore) Find

func (s *LogStore) Find(ctx context.Context, deploymentID int64) (io.ReadCloser, error)

type PrincipalStore

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

PrincipalStore implements a PrincipalStore backed by a relational database.

func NewPrincipalStore

func NewPrincipalStore(db *sqlx.DB) *PrincipalStore

NewPrincipalStore returns a new PrincipalStore.

func (*PrincipalStore) CountUsers

func (s *PrincipalStore) CountUsers(ctx context.Context) (int64, error)

CountUsers counts the number of users.

func (*PrincipalStore) CreateUser

func (s *PrincipalStore) CreateUser(ctx context.Context, user *types.User) (*types.User, error)

CreateUser saves the user details.

func (*PrincipalStore) DeleteUser

func (s *PrincipalStore) DeleteUser(ctx context.Context, id int64) error

DeleteUser deletes the user.

func (*PrincipalStore) Find

func (s *PrincipalStore) Find(ctx context.Context, id int64) (*types.Principal, error)

Find finds the principal by id.

func (*PrincipalStore) FindUser

func (s *PrincipalStore) FindUser(ctx context.Context, id int64) (*types.User, error)

FindUser finds the user by id.

func (*PrincipalStore) FindUserByEmail

func (s *PrincipalStore) FindUserByEmail(ctx context.Context, email string) (*types.User, error)

FindUserByEmail finds the user by email.

func (*PrincipalStore) FindUserByUID

func (s *PrincipalStore) FindUserByUID(ctx context.Context, uid string) (*types.User, error)

FindUserByUID finds the user by uid.

func (*PrincipalStore) UpdateUser

func (s *PrincipalStore) UpdateUser(ctx context.Context, user *types.User) error

UpdateUser updates an existing user.

type PrivateKeyStore

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

func NewPrivateKeyStore

func NewPrivateKeyStore(db *sqlx.DB) *PrivateKeyStore

func (*PrivateKeyStore) Create

func (s *PrivateKeyStore) Create(ctx context.Context, privatekey *types.PrivateKey) (*types.PrivateKey, error)

Create save the private key

func (*PrivateKeyStore) Delete

func (s *PrivateKeyStore) Delete(ctx context.Context, tenantID, id int64) error

Delete delets the private key

func (*PrivateKeyStore) Find

func (s *PrivateKeyStore) Find(ctx context.Context, tenantID, id int64) (*types.PrivateKey, error)

Find the private key by id.

type ProjectMembershipStore

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

func NewProjectMembershipStore

func NewProjectMembershipStore(db *sqlx.DB) *ProjectMembershipStore

func (*ProjectMembershipStore) Create

func (s *ProjectMembershipStore) Create(ctx context.Context, projectMembership *types.ProjectMembership) error

func (*ProjectMembershipStore) Delete

func (s *ProjectMembershipStore) Delete(ctx context.Context, tenantID, projectID, principalID int64) error

func (*ProjectMembershipStore) Find

func (s *ProjectMembershipStore) Find(ctx context.Context, tenantID, projectID, principalID int64) (*types.ProjectMembership, error)

func (*ProjectMembershipStore) List

func (s *ProjectMembershipStore) List(ctx context.Context, tenantID int64, projectID int64) ([]*types.ProjectMembershipUser, error)

func (*ProjectMembershipStore) Update

func (s *ProjectMembershipStore) Update(ctx context.Context, tenantID, projectID, principalID int64, role enum.ProjectRole) error

type ProjectStore

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

func NewProjectSore

func NewProjectSore(db *sqlx.DB) *ProjectStore

func (*ProjectStore) Count

func (s *ProjectStore) Count(ctx context.Context, filter *types.ProjectFilter) (int64, error)

func (*ProjectStore) Create

func (s *ProjectStore) Create(ctx context.Context, project *types.Project) (*types.Project, error)

func (*ProjectStore) Find

func (s *ProjectStore) Find(ctx context.Context, id int64) (*types.Project, error)

func (*ProjectStore) FindByUID

func (s *ProjectStore) FindByUID(ctx context.Context, tenantID int64, projectUID int64) (*types.Project, error)

func (*ProjectStore) FindDeleted

func (s *ProjectStore) FindDeleted(ctx context.Context, id int64, deletedAt *int64) (*types.Project, error)

func (*ProjectStore) FindDeletedByUID

func (s *ProjectStore) FindDeletedByUID(ctx context.Context, tenantID int64, projectUID int64, deletedAt **int64) (*types.Project, error)

func (*ProjectStore) List

func (s *ProjectStore) List(ctx context.Context, filter *types.ProjectFilter) ([]*types.Project, error)

func (*ProjectStore) Purge

func (s *ProjectStore) Purge(ctx context.Context, id int64, deletedAt *int64) error

Purge deletes the project permanently.

func (*ProjectStore) SoftDelete

func (s *ProjectStore) SoftDelete(ctx context.Context, project *types.Project, deletedAt int64) error

func (*ProjectStore) Update

func (s *ProjectStore) Update(ctx context.Context, project *types.Project) (*types.Project, error)

type ServerStore

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

ServerStore implements a ServerStore backed by a relational database.

func (*ServerStore) Create

func (s *ServerStore) Create(ctx context.Context, server *types.Server) (*types.Server, error)

Create save the server details

func (*ServerStore) Find

func (s *ServerStore) Find(ctx context.Context, id int64) (*types.Server, error)

Find the server by id.

func (*ServerStore) FindByUID

func (s *ServerStore) FindByUID(ctx context.Context, serverUID int64) (*types.Server, error)

FindByUID the server by id.

func (*ServerStore) List

func (s *ServerStore) List(ctx context.Context) ([]*types.Server, error)

List lists the server

func (*ServerStore) Update

func (s *ServerStore) Update(ctx context.Context, server *types.Server) (*types.Server, error)

Update updates the server details

type TemplateStore

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

TemplateStore implements a TemplateStore backed by a relational database.

func NewTemplateStore

func NewTemplateStore(db *sqlx.DB) *TemplateStore

NewTemplateStore returns new TemplateStore

func (*TemplateStore) Find

func (s *TemplateStore) Find(ctx context.Context, id int64) (*types.Template, error)

Find the template by id

func (*TemplateStore) List

func (s *TemplateStore) List(ctx context.Context) ([]*types.Template, error)

List lists the templates

func (*TemplateStore) ListBySlugs

func (s *TemplateStore) ListBySlugs(ctx context.Context, slugs []string) ([]*types.Template, error)

func (*TemplateStore) UpsertMany

func (s *TemplateStore) UpsertMany(ctx context.Context, templates []*types.Template) error

UpsertMany updates or inserts the templates

type TenantMembershipStore

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

func NewTenantMembershipStore

func NewTenantMembershipStore(db *sqlx.DB) *TenantMembershipStore

func (*TenantMembershipStore) Create

func (s *TenantMembershipStore) Create(ctx context.Context, tenantMembership *types.TenantMembership) error

func (*TenantMembershipStore) Delete

func (s *TenantMembershipStore) Delete(ctx context.Context, tenantID, principalID int64) error

func (*TenantMembershipStore) DeleteAll

func (s *TenantMembershipStore) DeleteAll(ctx context.Context, tenantID int64) error

func (*TenantMembershipStore) Find

func (s *TenantMembershipStore) Find(ctx context.Context, tenantID, principalID int64) (*types.TenantMembership, error)

func (*TenantMembershipStore) List

func (s *TenantMembershipStore) List(ctx context.Context, principalID int64) ([]*types.TenantMembershipUser, error)

func (*TenantMembershipStore) ListByTenant

func (s *TenantMembershipStore) ListByTenant(ctx context.Context, principalID int64) ([]*types.TenantMembershipUser, error)

func (*TenantMembershipStore) Update

func (s *TenantMembershipStore) Update(ctx context.Context, tenantID, principalID int64, role enum.TenantRole) error

type TenantStore

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

func NewTenantStore

func NewTenantStore(db *sqlx.DB) *TenantStore

func (*TenantStore) Create

func (s *TenantStore) Create(ctx context.Context, tenant *types.Tenant) (*types.Tenant, error)

func (*TenantStore) Find

func (s *TenantStore) Find(ctx context.Context, id int64) (*types.Tenant, error)

func (*TenantStore) FindByUID

func (s *TenantStore) FindByUID(ctx context.Context, tenantUID int64) (*types.Tenant, error)

func (*TenantStore) FindDeleted

func (s *TenantStore) FindDeleted(ctx context.Context, id int64, deletedAt *int64) (*types.Tenant, error)

func (*TenantStore) FindDeletedByUID

func (s *TenantStore) FindDeletedByUID(ctx context.Context, tenantUID int64, deletedAt **int64) (*types.Tenant, error)

func (*TenantStore) List

func (s *TenantStore) List(ctx context.Context, filter *types.TenantFilter) ([]*types.Tenant, error)

func (*TenantStore) Purge

func (s *TenantStore) Purge(ctx context.Context, id int64, deletedAt *int64) error

Purge deletes the tenant permanently.

func (*TenantStore) SoftDelete

func (s *TenantStore) SoftDelete(ctx context.Context, tenant *types.Tenant, deletedAt int64) error

SoftDelete deletes the tenant softly by setting the deleted timestamp

func (*TenantStore) Update

func (s *TenantStore) Update(ctx context.Context, tenant *types.Tenant) (*types.Tenant, error)

type TokenStore

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

TokenStore implements a TokenStore backed by a relational database.

func NewTokenStore

func NewTokenStore(db *sqlx.DB) *TokenStore

NewTokenStore returns a new TokenStore.

func (*TokenStore) Count

func (s *TokenStore) Count(ctx context.Context,
	principalID int64, tokenType enum.TokenType) (int64, error)

Count returns a count of tokens of a specifc type for a specific principal.

func (*TokenStore) Create

func (s *TokenStore) Create(ctx context.Context, token *types.Token) error

Create saves the token details.

func (*TokenStore) Delete

func (s *TokenStore) Delete(ctx context.Context, id int64) error

Delete deletes the token with the given id.

func (*TokenStore) DeleteExpiredBefore

func (s *TokenStore) DeleteExpiredBefore(
	ctx context.Context,
	before time.Time,
	tknTypes []enum.TokenType,
) (int64, error)

DeleteExpiredBefore deletes all tokens that expired before the provided time. If tokenTypes are provided, then only tokens of that type are deleted.

func (*TokenStore) Find

func (s *TokenStore) Find(ctx context.Context, id int64) (*types.Token, error)

Find finds the token by id.

func (*TokenStore) FindByIdentifier

func (s *TokenStore) FindByIdentifier(ctx context.Context, principalID int64, identifier string) (*types.Token, error)

FindByIdentifier finds the token by principalId and token identifier.

func (*TokenStore) List

func (s *TokenStore) List(ctx context.Context,
	principalID int64, tokenType enum.TokenType) ([]*types.Token, error)

List returns a list of tokens of a specific type for a specific principal.

type VariableStore

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

VariableStore implements a VariableStore backed by a relational database.

func NewVariableStore

func NewVariableStore(db *sqlx.DB) *VariableStore

NewVariableStore creates a new VariableStore

func (*VariableStore) Delete

func (s *VariableStore) Delete(ctx context.Context, applicationID, varUID int64) error

func (*VariableStore) DeleteByKey

func (s *VariableStore) DeleteByKey(ctx context.Context, applicationID int64, key string) error

func (*VariableStore) DeleteByKeys

func (s *VariableStore) DeleteByKeys(ctx context.Context, applicationID int64, keys []string) error

func (*VariableStore) Find

func (s *VariableStore) Find(ctx context.Context, applicationID, varUID int64) (*types.Variable, error)

Find the variable by application id and variable uid

func (*VariableStore) List

func (s *VariableStore) List(ctx context.Context, environmentID, applicaitonID int64) ([]*types.Variable, error)

List lists the variables by environment id and application id

func (*VariableStore) ListInEnvironment

func (s *VariableStore) ListInEnvironment(ctx context.Context, envID int64) ([]*types.Variable, error)

func (*VariableStore) Upsert

func (s *VariableStore) Upsert(ctx context.Context, variable *types.Variable) error

Upsert updates or inserts the variables

func (*VariableStore) UpsertMany

func (s *VariableStore) UpsertMany(ctx context.Context, variables []*types.Variable) error

UpsertMany updates or inserts the variables

type VolumeStore

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

VolumeStore implements a VolumeStore backed by a relational database.

func NewVolumeStore

func NewVolumeStore(db *sqlx.DB) *VolumeStore

NewVolumeStore returns new VolumeStore

func (*VolumeStore) Create

func (s *VolumeStore) Create(ctx context.Context, volume *types.Volume) (*types.Volume, error)

Create creates a new volume

func (*VolumeStore) Find

func (s *VolumeStore) Find(ctx context.Context, id int64) (*types.Volume, error)

Find the volume by id

func (*VolumeStore) FindByUID

func (s *VolumeStore) FindByUID(ctx context.Context, tenantID, projectID, environmentID, uid int64) (*types.Volume, error)

FindByUID finds the volume by tenant id, project id ,environment id, volume id and volume u_id

func (*VolumeStore) FindDeleted

func (s *VolumeStore) FindDeleted(ctx context.Context, id int64, deletedAt *int64) (*types.Volume, error)

func (*VolumeStore) FindDeletedByUID

func (s *VolumeStore) FindDeletedByUID(ctx context.Context, tenantID, projectID, environmentID, uid int64, deletedAt *int64) (*types.Volume, error)

func (*VolumeStore) List

func (s *VolumeStore) List(ctx context.Context, filter *types.VolumeFilter) ([]*types.Volume, error)

List lists the volumes by filter

func (*VolumeStore) Purge

func (s *VolumeStore) Purge(ctx context.Context, id int64, deletedAt *int64) error

func (*VolumeStore) SoftDelete

func (s *VolumeStore) SoftDelete(ctx context.Context, volume *types.Volume, deletedAt int64) error

func (*VolumeStore) Update

func (s *VolumeStore) Update(ctx context.Context, volume *types.Volume) (*types.Volume, error)

Update updates the volume

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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