store

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(err error) error

FormatError returns err as a bytebase error, if possible. Otherwise returns the original error.

Types

type ActivityService

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

ActivityService represents a service for managing activity.

func NewActivityService

func NewActivityService(logger *zap.Logger, db *DB) *ActivityService

NewActivityService returns a new instance of ActivityService.

func (*ActivityService) CreateActivity

func (s *ActivityService) CreateActivity(ctx context.Context, create *api.ActivityCreate) (*api.ActivityRaw, error)

CreateActivity creates a new activity.

func (*ActivityService) DeleteActivity

func (s *ActivityService) DeleteActivity(ctx context.Context, delete *api.ActivityDelete) error

DeleteActivity deletes an existing activity by ID.

func (*ActivityService) FindActivity

func (s *ActivityService) FindActivity(ctx context.Context, find *api.ActivityFind) (*api.ActivityRaw, error)

FindActivity retrieves a single activity based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*ActivityService) FindActivityList

func (s *ActivityService) FindActivityList(ctx context.Context, find *api.ActivityFind) ([]*api.ActivityRaw, error)

FindActivityList retrieves a list of activities based on the find condition.

func (*ActivityService) PatchActivity

func (s *ActivityService) PatchActivity(ctx context.Context, patch *api.ActivityPatch) (*api.ActivityRaw, error)

PatchActivity updates an existing activity by ID. Returns ENOTFOUND if activity does not exist.

type AnomalyService

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

AnomalyService represents a service for managing anomaly.

func NewAnomalyService

func NewAnomalyService(logger *zap.Logger, db *DB) *AnomalyService

NewAnomalyService returns a new instance of AnomalyService.

func (*AnomalyService) ArchiveAnomaly

func (s *AnomalyService) ArchiveAnomaly(ctx context.Context, archive *api.AnomalyArchive) error

ArchiveAnomaly archives an existing anomaly by ID. Returns ENOTFOUND if anomaly does not exist.

func (*AnomalyService) FindAnomalyList

func (s *AnomalyService) FindAnomalyList(ctx context.Context, find *api.AnomalyFind) ([]*api.AnomalyRaw, error)

FindAnomalyList retrieves a list of anomalies based on the find condition.

func (*AnomalyService) UpsertActiveAnomaly

func (s *AnomalyService) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsert) (*api.AnomalyRaw, error)

UpsertActiveAnomaly would update the existing active anomaly if both database id and type match, otherwise create a new one. Do not use ON CONFLICT (upsert syntax) as it will consume autoincrement id. Functional wise, this is fine, but from the UX perspective, it's not great, since user will see large id gaps.

type BackupService

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

BackupService represents a service for managing backup.

func NewBackupService

func NewBackupService(logger *zap.Logger, db *DB, policyService api.PolicyService) *BackupService

NewBackupService returns a new instance of BackupService.

func (*BackupService) CreateBackup

func (s *BackupService) CreateBackup(ctx context.Context, create *api.BackupCreate) (*api.BackupRaw, error)

CreateBackup creates a new backup.

func (*BackupService) FindBackup

func (s *BackupService) FindBackup(ctx context.Context, find *api.BackupFind) (*api.BackupRaw, error)

FindBackup retrieves a single backup based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*BackupService) FindBackupList

func (s *BackupService) FindBackupList(ctx context.Context, find *api.BackupFind) ([]*api.BackupRaw, error)

FindBackupList retrieves a list of backups based on find.

func (*BackupService) FindBackupSetting

func (s *BackupService) FindBackupSetting(ctx context.Context, find *api.BackupSettingFind) (*api.BackupSetting, error)

FindBackupSetting finds the backup setting for a database. Returns ECONFLICT if finding more than 1 matching records.

func (*BackupService) FindBackupSettingsMatch

func (s *BackupService) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSettingsMatch) ([]*api.BackupSetting, error)

FindBackupSettingsMatch retrieves a list of backup settings based on match condition.

func (*BackupService) PatchBackup

func (s *BackupService) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.BackupRaw, error)

PatchBackup updates an existing backup by ID. Returns ENOTFOUND if backup does not exist.

func (*BackupService) UpsertBackupSetting

func (s *BackupService) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error)

UpsertBackupSetting sets the backup settings for a database.

func (*BackupService) UpsertBackupSettingTx

func (s *BackupService) UpsertBackupSettingTx(ctx context.Context, tx *sql.Tx, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error)

UpsertBackupSettingTx updates an existing backup setting.

type BookmarkService

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

BookmarkService represents a service for managing bookmark.

func NewBookmarkService

func NewBookmarkService(logger *zap.Logger, db *DB) *BookmarkService

NewBookmarkService returns a new instance of BookmarkService.

func (*BookmarkService) CreateBookmark

func (s *BookmarkService) CreateBookmark(ctx context.Context, create *api.BookmarkCreate) (*api.Bookmark, error)

CreateBookmark creates a new bookmark.

func (*BookmarkService) DeleteBookmark

func (s *BookmarkService) DeleteBookmark(ctx context.Context, delete *api.BookmarkDelete) error

DeleteBookmark deletes an existing bookmark by ID. Returns ENOTFOUND if bookmark does not exist.

func (*BookmarkService) FindBookmark

func (s *BookmarkService) FindBookmark(ctx context.Context, find *api.BookmarkFind) (*api.Bookmark, error)

FindBookmark retrieves a single bookmark based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*BookmarkService) FindBookmarkList

func (s *BookmarkService) FindBookmarkList(ctx context.Context, find *api.BookmarkFind) ([]*api.Bookmark, error)

FindBookmarkList retrieves a list of bookmarks based on find.

type ColumnService

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

ColumnService represents a service for managing column.

func NewColumnService

func NewColumnService(logger *zap.Logger, db *DB) *ColumnService

NewColumnService returns a new instance of ColumnService.

func (*ColumnService) CreateColumn

func (s *ColumnService) CreateColumn(ctx context.Context, create *api.ColumnCreate) (*api.Column, error)

CreateColumn creates a new column.

func (*ColumnService) FindColumn

func (s *ColumnService) FindColumn(ctx context.Context, find *api.ColumnFind) (*api.Column, error)

FindColumn retrieves a single column based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*ColumnService) FindColumnList

func (s *ColumnService) FindColumnList(ctx context.Context, find *api.ColumnFind) ([]*api.Column, error)

FindColumnList retrieves a list of columns based on find.

func (*ColumnService) PatchColumn

func (s *ColumnService) PatchColumn(ctx context.Context, patch *api.ColumnPatch) (*api.Column, error)

PatchColumn updates an existing column by ID. Returns ENOTFOUND if column does not exist.

type DB

type DB struct {

	// Returns the current time. Defaults to time.Now().
	// Can be mocked for tests.
	Now func() time.Time
	// contains filtered or unexported fields
}

DB represents the database connection.

func NewDB

func NewDB(logger *zap.Logger, dsn string, connCfg dbdriver.ConnectionConfig, seedDir string, forceResetSeed bool, readonly bool, releaseVersion string) *DB

NewDB returns a new instance of DB associated with the given datasource name.

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx starts a transaction and returns a wrapper Tx type. This type provides a reference to the database and a fixed timestamp at the start of the transaction. The timestamp allows us to mock time during tests as well.

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (*DB) Open

func (db *DB) Open(ctx context.Context) (err error)

Open opens the database connection.

type DataSourceService

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

DataSourceService represents a service for managing dataSource.

func NewDataSourceService

func NewDataSourceService(logger *zap.Logger, db *DB, cache api.CacheService) *DataSourceService

NewDataSourceService returns a new instance of DataSourceService.

func (*DataSourceService) CreateDataSource

func (s *DataSourceService) CreateDataSource(ctx context.Context, create *api.DataSourceCreate) (*api.DataSourceRaw, error)

CreateDataSource creates a new dataSource.

func (*DataSourceService) CreateDataSourceTx

func (s *DataSourceService) CreateDataSourceTx(ctx context.Context, tx *sql.Tx, create *api.DataSourceCreate) (*api.DataSourceRaw, error)

CreateDataSourceTx creates a data source with a transaction.

func (*DataSourceService) FindDataSource

func (s *DataSourceService) FindDataSource(ctx context.Context, find *api.DataSourceFind) (*api.DataSourceRaw, error)

FindDataSource retrieves a single dataSource based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*DataSourceService) FindDataSourceList

func (s *DataSourceService) FindDataSourceList(ctx context.Context, find *api.DataSourceFind) ([]*api.DataSourceRaw, error)

FindDataSourceList retrieves a list of data sources based on find.

func (*DataSourceService) PatchDataSource

func (s *DataSourceService) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch) (*api.DataSourceRaw, error)

PatchDataSource updates an existing dataSource by ID. Returns ENOTFOUND if dataSource does not exist.

type DatabaseService

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

DatabaseService represents a service for managing database.

func NewDatabaseService

func NewDatabaseService(logger *zap.Logger, db *DB, cache api.CacheService, policyService api.PolicyService, backupService api.BackupService) *DatabaseService

NewDatabaseService returns a new instance of DatabaseService.

func (*DatabaseService) CreateDatabase

func (s *DatabaseService) CreateDatabase(ctx context.Context, create *api.DatabaseCreate) (*api.Database, error)

CreateDatabase creates a new database.

func (*DatabaseService) CreateDatabaseTx

func (s *DatabaseService) CreateDatabaseTx(ctx context.Context, tx *sql.Tx, create *api.DatabaseCreate) (*api.Database, error)

CreateDatabaseTx creates a database with a transaction.

func (*DatabaseService) FindDatabase

func (s *DatabaseService) FindDatabase(ctx context.Context, find *api.DatabaseFind) (*api.Database, error)

FindDatabase retrieves a single database based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*DatabaseService) FindDatabaseList

func (s *DatabaseService) FindDatabaseList(ctx context.Context, find *api.DatabaseFind) ([]*api.Database, error)

FindDatabaseList retrieves a list of databases based on find.

func (*DatabaseService) PatchDatabase

func (s *DatabaseService) PatchDatabase(ctx context.Context, patch *api.DatabasePatch) (*api.Database, error)

PatchDatabase updates an existing database by ID. Returns ENOTFOUND if database does not exist.

type DeploymentConfigService

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

DeploymentConfigService represents a service for managing deployment configurations.

func NewDeploymentConfigService

func NewDeploymentConfigService(logger *zap.Logger, db *DB) *DeploymentConfigService

NewDeploymentConfigService returns a new instance of DeploymentConfigService.

func (*DeploymentConfigService) FindDeploymentConfig

func (s *DeploymentConfigService) FindDeploymentConfig(ctx context.Context, find *api.DeploymentConfigFind) (*api.DeploymentConfig, error)

FindDeploymentConfig finds the deployment configuration in a project.

func (*DeploymentConfigService) UpsertDeploymentConfig

func (s *DeploymentConfigService) UpsertDeploymentConfig(ctx context.Context, upsert *api.DeploymentConfigUpsert) (*api.DeploymentConfig, error)

UpsertDeploymentConfig upserts a deployment configuration to a project.

type EnvironmentService

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

EnvironmentService represents a service for managing environment.

func NewEnvironmentService

func NewEnvironmentService(logger *zap.Logger, db *DB, cache api.CacheService) *EnvironmentService

NewEnvironmentService returns a new instance of EnvironmentService.

func (*EnvironmentService) CreateEnvironment

func (s *EnvironmentService) CreateEnvironment(ctx context.Context, create *api.EnvironmentCreate) (*api.EnvironmentRaw, error)

CreateEnvironment creates a new environment.

func (*EnvironmentService) FindEnvironment

func (s *EnvironmentService) FindEnvironment(ctx context.Context, find *api.EnvironmentFind) (*api.EnvironmentRaw, error)

FindEnvironment retrieves a single environment based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*EnvironmentService) FindEnvironmentList

func (s *EnvironmentService) FindEnvironmentList(ctx context.Context, find *api.EnvironmentFind) ([]*api.EnvironmentRaw, error)

FindEnvironmentList retrieves a list of environments based on find.

func (*EnvironmentService) PatchEnvironment

func (s *EnvironmentService) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatch) (*api.EnvironmentRaw, error)

PatchEnvironment updates an existing environment by ID. Returns ENOTFOUND if environment does not exist.

type InboxService

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

InboxService represents a service for managing inbox.

func NewInboxService

func NewInboxService(logger *zap.Logger, db *DB, activityService api.ActivityService) *InboxService

NewInboxService returns a new instance of InboxService.

func (*InboxService) CreateInbox

func (s *InboxService) CreateInbox(ctx context.Context, create *api.InboxCreate) (*api.Inbox, error)

CreateInbox creates a new inbox.

func (*InboxService) FindInbox

func (s *InboxService) FindInbox(ctx context.Context, find *api.InboxFind) (*api.Inbox, error)

FindInbox retrieves a single inbox based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*InboxService) FindInboxList

func (s *InboxService) FindInboxList(ctx context.Context, find *api.InboxFind) ([]*api.Inbox, error)

FindInboxList retrieves a list of inboxes based on find.

func (*InboxService) FindInboxSummary

func (s *InboxService) FindInboxSummary(ctx context.Context, principalID int) (*api.InboxSummary, error)

FindInboxSummary returns the inbox summary for a particular principal

func (*InboxService) PatchInbox

func (s *InboxService) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inbox, error)

PatchInbox updates an existing inbox by ID. Returns ENOTFOUND if inbox does not exist.

type IndexService

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

IndexService represents a service for managing index.

func NewIndexService

func NewIndexService(logger *zap.Logger, db *DB) *IndexService

NewIndexService returns a new instance of IndexService.

func (*IndexService) CreateIndex

func (s *IndexService) CreateIndex(ctx context.Context, create *api.IndexCreate) (*api.Index, error)

CreateIndex creates a new index.

func (*IndexService) FindIndex

func (s *IndexService) FindIndex(ctx context.Context, find *api.IndexFind) (*api.Index, error)

FindIndex retrieves a single index based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*IndexService) FindIndexList

func (s *IndexService) FindIndexList(ctx context.Context, find *api.IndexFind) ([]*api.Index, error)

FindIndexList retrieves a list of indexes based on find.

type InstanceService

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

InstanceService represents a service for managing instance.

func NewInstanceService

func NewInstanceService(logger *zap.Logger, db *DB, cache api.CacheService, databaseService api.DatabaseService, dataSourceService api.DataSourceService) *InstanceService

NewInstanceService returns a new instance of InstanceService.

func (*InstanceService) CountInstance

func (s *InstanceService) CountInstance(ctx context.Context, find *api.InstanceFind) (int, error)

CountInstance counts the number of instances.

func (*InstanceService) CreateInstance

func (s *InstanceService) CreateInstance(ctx context.Context, create *api.InstanceCreate) (*api.Instance, error)

CreateInstance creates a new instance.

func (*InstanceService) FindInstance

func (s *InstanceService) FindInstance(ctx context.Context, find *api.InstanceFind) (*api.Instance, error)

FindInstance retrieves a single instance based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*InstanceService) FindInstanceList

func (s *InstanceService) FindInstanceList(ctx context.Context, find *api.InstanceFind) ([]*api.Instance, error)

FindInstanceList retrieves a list of instances based on find.

func (*InstanceService) PatchInstance

func (s *InstanceService) PatchInstance(ctx context.Context, patch *api.InstancePatch) (*api.Instance, error)

PatchInstance updates an existing instance by ID. Returns ENOTFOUND if instance does not exist.

type InstanceUserService

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

InstanceUserService represents a service for managing instanceUser.

func NewInstanceUserService

func NewInstanceUserService(logger *zap.Logger, db *DB) *InstanceUserService

NewInstanceUserService returns a new instance of InstanceUserService.

func (*InstanceUserService) DeleteInstanceUser

func (s *InstanceUserService) DeleteInstanceUser(ctx context.Context, delete *api.InstanceUserDelete) error

DeleteInstanceUser deletes an existing instance user by ID.

func (*InstanceUserService) FindInstanceUserList

func (s *InstanceUserService) FindInstanceUserList(ctx context.Context, find *api.InstanceUserFind) ([]*api.InstanceUser, error)

FindInstanceUserList retrieves a list of instanceUsers based on find.

func (*InstanceUserService) UpsertInstanceUser

func (s *InstanceUserService) UpsertInstanceUser(ctx context.Context, upsert *api.InstanceUserUpsert) (*api.InstanceUser, error)

UpsertInstanceUser would update the existing user if name matches.

type IssueService

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

IssueService represents a service for managing issue.

func NewIssueService

func NewIssueService(logger *zap.Logger, db *DB, cache api.CacheService) *IssueService

NewIssueService returns a new instance of IssueService.

func (*IssueService) CreateIssue

func (s *IssueService) CreateIssue(ctx context.Context, create *api.IssueCreate) (*api.Issue, error)

CreateIssue creates a new issue.

func (*IssueService) FindIssue

func (s *IssueService) FindIssue(ctx context.Context, find *api.IssueFind) (*api.Issue, error)

FindIssue retrieves a single issue based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*IssueService) FindIssueList

func (s *IssueService) FindIssueList(ctx context.Context, find *api.IssueFind) ([]*api.Issue, error)

FindIssueList retrieves a list of issues based on find.

func (*IssueService) PatchIssue

func (s *IssueService) PatchIssue(ctx context.Context, patch *api.IssuePatch) (*api.Issue, error)

PatchIssue updates an existing issue by ID. Returns ENOTFOUND if issue does not exist.

type IssueSubscriberService

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

IssueSubscriberService represents a service for managing issueSubscriber.

func NewIssueSubscriberService

func NewIssueSubscriberService(logger *zap.Logger, db *DB) *IssueSubscriberService

NewIssueSubscriberService returns a new instance of IssueSubscriberService.

func (*IssueSubscriberService) CreateIssueSubscriber

func (s *IssueSubscriberService) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubscriberCreate) (*api.IssueSubscriber, error)

CreateIssueSubscriber creates a new issueSubscriber.

func (*IssueSubscriberService) DeleteIssueSubscriber

func (s *IssueSubscriberService) DeleteIssueSubscriber(ctx context.Context, delete *api.IssueSubscriberDelete) error

DeleteIssueSubscriber deletes an existing issueSubscriber by ID.

func (*IssueSubscriberService) FindIssueSubscriberList

func (s *IssueSubscriberService) FindIssueSubscriberList(ctx context.Context, find *api.IssueSubscriberFind) ([]*api.IssueSubscriber, error)

FindIssueSubscriberList retrieves a list of issueSubscribers based on find.

type LabelService

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

LabelService represents a service for managing labels.

func NewLabelService

func NewLabelService(logger *zap.Logger, db *DB) *LabelService

NewLabelService returns a new instance of LabelService.

func (*LabelService) FindDatabaseLabelList

func (s *LabelService) FindDatabaseLabelList(ctx context.Context, find *api.DatabaseLabelFind) ([]*api.DatabaseLabel, error)

FindDatabaseLabelList finds the labels associated with the database.

func (*LabelService) FindLabelKeyList

func (s *LabelService) FindLabelKeyList(ctx context.Context, find *api.LabelKeyFind) ([]*api.LabelKey, error)

FindLabelKeyList retrieves a list of label keys for labels based on find.

func (*LabelService) PatchLabelKey

func (s *LabelService) PatchLabelKey(ctx context.Context, patch *api.LabelKeyPatch) (*api.LabelKey, error)

PatchLabelKey patches a label key.

func (*LabelService) SetDatabaseLabelList

func (s *LabelService) SetDatabaseLabelList(ctx context.Context, labelList []*api.DatabaseLabel, databaseID int, updaterID int) ([]*api.DatabaseLabel, error)

SetDatabaseLabelList sets the labels for a database.

type MemberService

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

MemberService represents a service for managing member.

func NewMemberService

func NewMemberService(logger *zap.Logger, db *DB, cache api.CacheService) *MemberService

NewMemberService returns a new instance of MemberService.

func (*MemberService) CreateMember

func (s *MemberService) CreateMember(ctx context.Context, create *api.MemberCreate) (*api.Member, error)

CreateMember creates a new member.

func (*MemberService) FindMember

func (s *MemberService) FindMember(ctx context.Context, find *api.MemberFind) (*api.Member, error)

FindMember retrieves a single member based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*MemberService) FindMemberList

func (s *MemberService) FindMemberList(ctx context.Context, find *api.MemberFind) ([]*api.Member, error)

FindMemberList retrieves a list of members based on find.

func (*MemberService) PatchMember

func (s *MemberService) PatchMember(ctx context.Context, patch *api.MemberPatch) (*api.Member, error)

PatchMember updates an existing member by ID. Returns ENOTFOUND if member does not exist.

type PipelineService

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

PipelineService represents a service for managing pipeline.

func NewPipelineService

func NewPipelineService(logger *zap.Logger, db *DB, cache api.CacheService) *PipelineService

NewPipelineService returns a new instance of PipelineService.

func (*PipelineService) CreatePipeline

func (s *PipelineService) CreatePipeline(ctx context.Context, create *api.PipelineCreate) (*api.Pipeline, error)

CreatePipeline creates a new pipeline.

func (*PipelineService) FindPipeline

func (s *PipelineService) FindPipeline(ctx context.Context, find *api.PipelineFind) (*api.Pipeline, error)

FindPipeline retrieves a single pipeline based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*PipelineService) FindPipelineList

func (s *PipelineService) FindPipelineList(ctx context.Context, find *api.PipelineFind) ([]*api.Pipeline, error)

FindPipelineList retrieves a list of pipelines based on find.

func (*PipelineService) PatchPipeline

func (s *PipelineService) PatchPipeline(ctx context.Context, patch *api.PipelinePatch) (*api.Pipeline, error)

PatchPipeline updates an existing pipeline by ID. Returns ENOTFOUND if pipeline does not exist.

type PolicyService

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

PolicyService represents a service for managing environment based policies.

func NewPolicyService

func NewPolicyService(logger *zap.Logger, db *DB, cache api.CacheService) *PolicyService

NewPolicyService returns a new instance of PolicyService.

func (*PolicyService) FindPolicy

func (s *PolicyService) FindPolicy(ctx context.Context, find *api.PolicyFind) (*api.Policy, error)

FindPolicy finds the policy for an environment. Returns ECONFLICT if finding more than 1 matching records.

func (*PolicyService) GetBackupPlanPolicy

func (s *PolicyService) GetBackupPlanPolicy(ctx context.Context, environmentID int) (*api.BackupPlanPolicy, error)

GetBackupPlanPolicy will get the backup plan policy for an environment.

func (*PolicyService) GetPipelineApprovalPolicy

func (s *PolicyService) GetPipelineApprovalPolicy(ctx context.Context, environmentID int) (*api.PipelineApprovalPolicy, error)

GetPipelineApprovalPolicy will get the pipeline approval policy for an environment.

func (*PolicyService) UpsertPolicy

func (s *PolicyService) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*api.Policy, error)

UpsertPolicy sets a policy for an environment.

type PrincipalService

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

PrincipalService represents a service for managing principal.

func NewPrincipalService

func NewPrincipalService(logger *zap.Logger, db *DB, cache api.CacheService) *PrincipalService

NewPrincipalService returns a new instance of PrincipalService.

func (*PrincipalService) CreatePrincipal

func (s *PrincipalService) CreatePrincipal(ctx context.Context, create *api.PrincipalCreate) (*api.Principal, error)

CreatePrincipal creates a new principal.

func (*PrincipalService) FindPrincipal

func (s *PrincipalService) FindPrincipal(ctx context.Context, find *api.PrincipalFind) (*api.Principal, error)

FindPrincipal retrieves a principal based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*PrincipalService) FindPrincipalList

func (s *PrincipalService) FindPrincipalList(ctx context.Context) ([]*api.Principal, error)

FindPrincipalList retrieves a list of principals.

func (*PrincipalService) PatchPrincipal

func (s *PrincipalService) PatchPrincipal(ctx context.Context, patch *api.PrincipalPatch) (*api.Principal, error)

PatchPrincipal updates an existing principal by ID. Returns ENOTFOUND if principal does not exist.

type ProjectMemberService

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

ProjectMemberService represents a service for managing projectMember.

func NewProjectMemberService

func NewProjectMemberService(logger *zap.Logger, db *DB) *ProjectMemberService

NewProjectMemberService returns a new instance of ProjectMemberService.

func (*ProjectMemberService) BatchUpdateProjectMember

func (s *ProjectMemberService) BatchUpdateProjectMember(ctx context.Context, batchUpdate *api.ProjectMemberBatchUpdate) (createdMemberList, deletedMemberList []*api.ProjectMember, err error)

BatchUpdateProjectMember update the project member with provided project member list

func (*ProjectMemberService) CreateProjectMember

func (s *ProjectMemberService) CreateProjectMember(ctx context.Context, create *api.ProjectMemberCreate) (*api.ProjectMember, error)

CreateProjectMember creates a new projectMember.

func (*ProjectMemberService) DeleteProjectMember

func (s *ProjectMemberService) DeleteProjectMember(ctx context.Context, delete *api.ProjectMemberDelete) error

DeleteProjectMember deletes an existing projectMember by ID.

func (*ProjectMemberService) FindProjectMember

func (s *ProjectMemberService) FindProjectMember(ctx context.Context, find *api.ProjectMemberFind) (*api.ProjectMember, error)

FindProjectMember finds project members.

func (*ProjectMemberService) FindProjectMemberList

func (s *ProjectMemberService) FindProjectMemberList(ctx context.Context, find *api.ProjectMemberFind) ([]*api.ProjectMember, error)

FindProjectMemberList retrieves a list of projectMembers based on find.

func (*ProjectMemberService) PatchProjectMember

func (s *ProjectMemberService) PatchProjectMember(ctx context.Context, patch *api.ProjectMemberPatch) (*api.ProjectMember, error)

PatchProjectMember updates an existing projectMember by ID. Returns ENOTFOUND if projectMember does not exist.

type ProjectService

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

ProjectService represents a service for managing project.

func NewProjectService

func NewProjectService(logger *zap.Logger, db *DB, cache api.CacheService) *ProjectService

NewProjectService returns a new project of ProjectService.

func (*ProjectService) CreateProject

func (s *ProjectService) CreateProject(ctx context.Context, create *api.ProjectCreate) (*api.ProjectRaw, error)

CreateProject creates a new project.

func (*ProjectService) FindProject

func (s *ProjectService) FindProject(ctx context.Context, find *api.ProjectFind) (*api.ProjectRaw, error)

FindProject retrieves a single project based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*ProjectService) FindProjectList

func (s *ProjectService) FindProjectList(ctx context.Context, find *api.ProjectFind) ([]*api.ProjectRaw, error)

FindProjectList retrieves a list of projects based on find.

func (*ProjectService) PatchProject

func (s *ProjectService) PatchProject(ctx context.Context, patch *api.ProjectPatch) (*api.ProjectRaw, error)

PatchProject updates an existing project by ID. Returns ENOTFOUND if project does not exist.

func (*ProjectService) PatchProjectTx

func (s *ProjectService) PatchProjectTx(ctx context.Context, tx *sql.Tx, patch *api.ProjectPatch) (*api.ProjectRaw, error)

PatchProjectTx updates an existing project by ID. Returns ENOTFOUND if project does not exist.

type ProjectWebhookService

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

ProjectWebhookService represents a service for managing projectWebhook.

func NewProjectWebhookService

func NewProjectWebhookService(logger *zap.Logger, db *DB) *ProjectWebhookService

NewProjectWebhookService returns a new instance of ProjectWebhookService.

func (*ProjectWebhookService) CreateProjectWebhook

func (s *ProjectWebhookService) CreateProjectWebhook(ctx context.Context, create *api.ProjectWebhookCreate) (*api.ProjectWebhook, error)

CreateProjectWebhook creates a new projectWebhook.

func (*ProjectWebhookService) DeleteProjectWebhook

func (s *ProjectWebhookService) DeleteProjectWebhook(ctx context.Context, delete *api.ProjectWebhookDelete) error

DeleteProjectWebhook deletes an existing projectWebhook by ID.

func (*ProjectWebhookService) FindProjectWebhook

func (s *ProjectWebhookService) FindProjectWebhook(ctx context.Context, find *api.ProjectWebhookFind) (*api.ProjectWebhook, error)

FindProjectWebhook retrieves a single projectWebhook based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*ProjectWebhookService) FindProjectWebhookList

func (s *ProjectWebhookService) FindProjectWebhookList(ctx context.Context, find *api.ProjectWebhookFind) ([]*api.ProjectWebhook, error)

FindProjectWebhookList retrieves a list of projectWebhooks based on find.

func (*ProjectWebhookService) PatchProjectWebhook

func (s *ProjectWebhookService) PatchProjectWebhook(ctx context.Context, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error)

PatchProjectWebhook updates an existing projectWebhook by ID. Returns ENOTFOUND if projectWebhook does not exist.

type RepositoryService

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

RepositoryService represents a service for managing repository.

func NewRepositoryService

func NewRepositoryService(logger *zap.Logger, db *DB, projectService api.ProjectService) *RepositoryService

NewRepositoryService returns a new instance of RepositoryService.

func (*RepositoryService) CreateRepository

func (s *RepositoryService) CreateRepository(ctx context.Context, create *api.RepositoryCreate) (*api.RepositoryRaw, error)

CreateRepository creates a new repository.

func (*RepositoryService) DeleteRepository

func (s *RepositoryService) DeleteRepository(ctx context.Context, delete *api.RepositoryDelete) error

DeleteRepository deletes an existing repository by ID.

func (*RepositoryService) FindRepository

func (s *RepositoryService) FindRepository(ctx context.Context, find *api.RepositoryFind) (*api.RepositoryRaw, error)

FindRepository retrieves a single repository based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*RepositoryService) FindRepositoryList

func (s *RepositoryService) FindRepositoryList(ctx context.Context, find *api.RepositoryFind) ([]*api.RepositoryRaw, error)

FindRepositoryList retrieves a list of repositories based on find.

func (*RepositoryService) PatchRepository

func (s *RepositoryService) PatchRepository(ctx context.Context, patch *api.RepositoryPatch) (*api.RepositoryRaw, error)

PatchRepository updates an existing repository by ID. Returns ENOTFOUND if repository does not exist.

type SettingService

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

SettingService represents a service for managing setting.

func NewSettingService

func NewSettingService(logger *zap.Logger, db *DB) *SettingService

NewSettingService returns a new instance of SettingService.

func (*SettingService) CreateSettingIfNotExist

func (s *SettingService) CreateSettingIfNotExist(ctx context.Context, create *api.SettingCreate) (*api.Setting, error)

CreateSettingIfNotExist creates a new setting only if the named setting does not exist.

func (*SettingService) FindSetting

func (s *SettingService) FindSetting(ctx context.Context, find *api.SettingFind) (*api.Setting, error)

FindSetting retrieves a single setting based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*SettingService) FindSettingList

func (s *SettingService) FindSettingList(ctx context.Context, find *api.SettingFind) ([]*api.Setting, error)

FindSettingList retrieves a list of settings based on find.

func (*SettingService) PatchSetting

func (s *SettingService) PatchSetting(ctx context.Context, patch *api.SettingPatch) (*api.Setting, error)

PatchSetting updates an existing setting by name. Returns ENOTFOUND if setting does not exist.

type SheetService

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

SheetService represents a service for managing sheet.

func NewSheetService

func NewSheetService(logger *zap.Logger, db *DB) *SheetService

NewSheetService returns a new sheet of SheetService.

func (*SheetService) CreateSheet

func (s *SheetService) CreateSheet(ctx context.Context, create *api.SheetCreate) (*api.Sheet, error)

CreateSheet creates a new sheet.

func (*SheetService) DeleteSheet

func (s *SheetService) DeleteSheet(ctx context.Context, delete *api.SheetDelete) error

DeleteSheet deletes an existing sheet by ID. Returns ENOTFOUND if sheet does not exist.

func (*SheetService) FindSheet

func (s *SheetService) FindSheet(ctx context.Context, find *api.SheetFind) (*api.Sheet, error)

FindSheet retrieves a single sheet based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*SheetService) FindSheetList

func (s *SheetService) FindSheetList(ctx context.Context, find *api.SheetFind) ([]*api.Sheet, error)

FindSheetList retrieves a list of sheet based on find.

func (*SheetService) PatchSheet

func (s *SheetService) PatchSheet(ctx context.Context, patch *api.SheetPatch) (*api.Sheet, error)

PatchSheet updates an existing sheet by ID.

type StageService

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

StageService represents a service for managing stage.

func NewStageService

func NewStageService(logger *zap.Logger, db *DB) *StageService

NewStageService returns a new instance of StageService.

func (*StageService) CreateStage

func (s *StageService) CreateStage(ctx context.Context, create *api.StageCreate) (*api.Stage, error)

CreateStage creates a new stage.

func (*StageService) FindStage

func (s *StageService) FindStage(ctx context.Context, find *api.StageFind) (*api.Stage, error)

FindStage retrieves a single stage based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*StageService) FindStageList

func (s *StageService) FindStageList(ctx context.Context, find *api.StageFind) ([]*api.Stage, error)

FindStageList retrieves a list of stages based on find.

type TableService

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

TableService represents a service for managing table.

func NewTableService

func NewTableService(logger *zap.Logger, db *DB) *TableService

NewTableService returns a new instance of TableService.

func (*TableService) CreateTable

func (s *TableService) CreateTable(ctx context.Context, create *api.TableCreate) (*api.Table, error)

CreateTable creates a new table.

func (*TableService) DeleteTable

func (s *TableService) DeleteTable(ctx context.Context, delete *api.TableDelete) error

DeleteTable deletes an existing table by ID.

func (*TableService) FindTable

func (s *TableService) FindTable(ctx context.Context, find *api.TableFind) (*api.Table, error)

FindTable retrieves a single table based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*TableService) FindTableList

func (s *TableService) FindTableList(ctx context.Context, find *api.TableFind) ([]*api.Table, error)

FindTableList retrieves a list of tables based on find.

type TaskCheckRunService

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

TaskCheckRunService represents a service for managing taskCheckRun.

func NewTaskCheckRunService

func NewTaskCheckRunService(logger *zap.Logger, db *DB) *TaskCheckRunService

NewTaskCheckRunService returns a new TaskCheckRunService.

func (*TaskCheckRunService) CreateTaskCheckRunIfNeeded

func (s *TaskCheckRunService) CreateTaskCheckRunIfNeeded(ctx context.Context, create *api.TaskCheckRunCreate) (*api.TaskCheckRun, error)

CreateTaskCheckRunIfNeeded creates a new taskCheckRun. See interface for the expected behavior

func (*TaskCheckRunService) FindTaskCheckRunList

func (s *TaskCheckRunService) FindTaskCheckRunList(ctx context.Context, find *api.TaskCheckRunFind) ([]*api.TaskCheckRun, error)

FindTaskCheckRunList retrieves a list of taskCheckRuns based on find.

func (*TaskCheckRunService) FindTaskCheckRunListTx

func (s *TaskCheckRunService) FindTaskCheckRunListTx(ctx context.Context, tx *sql.Tx, find *api.TaskCheckRunFind) ([]*api.TaskCheckRun, error)

FindTaskCheckRunListTx retrieves a list of taskCheckRuns based on find.

func (*TaskCheckRunService) PatchTaskCheckRunStatus

func (s *TaskCheckRunService) PatchTaskCheckRunStatus(ctx context.Context, patch *api.TaskCheckRunStatusPatch) (*api.TaskCheckRun, error)

PatchTaskCheckRunStatus updates a taskCheckRun status. Returns the new state of the taskCheckRun after update.

type TaskRunService

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

TaskRunService represents a service for managing taskRun.

func NewTaskRunService

func NewTaskRunService(logger *zap.Logger, db *DB) *TaskRunService

NewTaskRunService returns a new TaskRunService.

func (*TaskRunService) CreateTaskRunTx

func (s *TaskRunService) CreateTaskRunTx(ctx context.Context, tx *sql.Tx, create *api.TaskRunCreate) (*api.TaskRun, error)

CreateTaskRunTx creates a new taskRun.

func (*TaskRunService) FindTaskRunListTx

func (s *TaskRunService) FindTaskRunListTx(ctx context.Context, tx *sql.Tx, find *api.TaskRunFind) ([]*api.TaskRun, error)

FindTaskRunListTx retrieves a list of taskRuns based on find.

func (*TaskRunService) FindTaskRunTx

func (s *TaskRunService) FindTaskRunTx(ctx context.Context, tx *sql.Tx, find *api.TaskRunFind) (*api.TaskRun, error)

FindTaskRunTx retrieves a single taskRun based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*TaskRunService) PatchTaskRunStatusTx

func (s *TaskRunService) PatchTaskRunStatusTx(ctx context.Context, tx *sql.Tx, patch *api.TaskRunStatusPatch) (*api.TaskRun, error)

PatchTaskRunStatusTx updates a taskRun status. Returns the new state of the taskRun after update.

type TaskService

type TaskService struct {
	TaskRunService      api.TaskRunService
	TaskCheckRunService api.TaskCheckRunService
	// contains filtered or unexported fields
}

TaskService represents a service for managing task.

func NewTaskService

func NewTaskService(logger *zap.Logger, db *DB, taskRunService api.TaskRunService, taskCheckRunService api.TaskCheckRunService) *TaskService

NewTaskService returns a new instance of TaskService.

func (*TaskService) CreateTask

func (s *TaskService) CreateTask(ctx context.Context, create *api.TaskCreate) (*api.Task, error)

CreateTask creates a new task.

func (*TaskService) FindTask

func (s *TaskService) FindTask(ctx context.Context, find *api.TaskFind) (*api.Task, error)

FindTask retrieves a single task based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*TaskService) FindTaskList

func (s *TaskService) FindTaskList(ctx context.Context, find *api.TaskFind) ([]*api.Task, error)

FindTaskList retrieves a list of tasks based on find.

func (*TaskService) PatchTask

func (s *TaskService) PatchTask(ctx context.Context, patch *api.TaskPatch) (*api.Task, error)

PatchTask updates an existing task. Returns ENOTFOUND if task does not exist.

func (*TaskService) PatchTaskStatus

func (s *TaskService) PatchTaskStatus(ctx context.Context, patch *api.TaskStatusPatch) (*api.Task, error)

PatchTaskStatus updates an existing task status and the correspondng task run status atomically. Returns ENOTFOUND if task does not exist.

type Tx

type Tx struct {
	PTx *sql.Tx
	// contains filtered or unexported fields
}

Tx wraps the SQL Tx object to provide a timestamp at the start of the transaction.

type VCSService

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

VCSService represents a service for managing vcs.

func NewVCSService

func NewVCSService(logger *zap.Logger, db *DB) *VCSService

NewVCSService returns a new instance of VCSService.

func (*VCSService) CreateVCS

func (s *VCSService) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCSRaw, error)

CreateVCS creates a new vcs.

func (*VCSService) DeleteVCS

func (s *VCSService) DeleteVCS(ctx context.Context, delete *api.VCSDelete) error

DeleteVCS deletes an existing vcs by ID.

func (*VCSService) FindVCS

func (s *VCSService) FindVCS(ctx context.Context, find *api.VCSFind) (*api.VCSRaw, error)

FindVCS retrieves a single vcs based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*VCSService) FindVCSList

func (s *VCSService) FindVCSList(ctx context.Context, find *api.VCSFind) ([]*api.VCSRaw, error)

FindVCSList retrieves a list of VCSs based on find conditions.

func (*VCSService) PatchVCS

func (s *VCSService) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCSRaw, error)

PatchVCS updates an existing vcs by ID. Returns ENOTFOUND if vcs does not exist.

type ViewService

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

ViewService represents a service for managing view.

func NewViewService

func NewViewService(logger *zap.Logger, db *DB) *ViewService

NewViewService returns a new instance of ViewService.

func (*ViewService) CreateView

func (s *ViewService) CreateView(ctx context.Context, create *api.ViewCreate) (*api.View, error)

CreateView creates a new view.

func (*ViewService) DeleteView

func (s *ViewService) DeleteView(ctx context.Context, delete *api.ViewDelete) error

DeleteView deletes an existing view by ID.

func (*ViewService) FindView

func (s *ViewService) FindView(ctx context.Context, find *api.ViewFind) (*api.View, error)

FindView retrieves a single view based on find. Returns ECONFLICT if finding more than 1 matching records.

func (*ViewService) FindViewList

func (s *ViewService) FindViewList(ctx context.Context, find *api.ViewFind) ([]*api.View, error)

FindViewList retrieves a list of views based on find.

Jump to

Keyboard shortcuts

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