Documentation
¶
Index ¶
- type ArtifactService
- type ArtifactServiceFactory
- type AuditService
- type AuditServiceFactory
- type AutoCreateNamespace
- type BlobService
- type BlobServiceFactory
- type BlobUploadService
- type BlobUploadServiceFactory
- type BuilderService
- type BuilderServiceFactory
- type CodeRepositoryService
- type CodeRepositoryServiceFactory
- type DaemonService
- type DaemonServiceFactory
- type NamespaceMemberService
- type NamespaceMemberServiceFactory
- type NamespaceService
- type NamespaceServiceFactory
- type Option
- type RepositoryService
- type RepositoryServiceFactory
- type SettingService
- type SettingServiceFactory
- type TagService
- type TagServiceFactory
- type UserService
- type UserServiceFactory
- type WebhookService
- type WebhookServiceFactory
- type WorkQueueService
- type WorkQueueServiceFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactService ¶
type ArtifactService interface {
// Create create a new artifact if conflict do nothing.
Create(ctx context.Context, artifact *models.Artifact) error
// FindWithLastPull ...
FindWithLastPull(ctx context.Context, repositoryID int64, before int64, limit, last int64) ([]*models.Artifact, error)
// FindAssociateWithTag ...
FindAssociateWithTag(ctx context.Context, ids []int64) ([]int64, error)
// FindAssociateWithArtifact ...
FindAssociateWithArtifact(ctx context.Context, ids []int64) ([]int64, error)
// Get gets the artifact with the specified artifact ID.
Get(ctx context.Context, id int64) (*models.Artifact, error)
// GetByDigest gets the artifact with the specified digest.
GetByDigest(ctx context.Context, repositoryID int64, digest string) (*models.Artifact, error)
// GetByDigests gets the artifacts with the specified digests.
GetByDigests(ctx context.Context, repository string, digests []string) ([]*models.Artifact, error)
// DeleteByDigest deletes the artifact with the specified digest.
DeleteByDigest(ctx context.Context, repository, digest string) error
// AssociateBlobs associates the blobs with the artifact.
AssociateBlobs(ctx context.Context, artifact *models.Artifact, blobs []*models.Blob) error
// AssociateArtifact associates the artifacts with the artifact.
AssociateArtifact(ctx context.Context, artifact *models.Artifact, artifacts []*models.Artifact) error
// CountByNamespace counts the artifacts by the specified namespace.
CountByNamespace(ctx context.Context, namespaceIDs []int64) (map[int64]int64, error)
// CountByRepository counts the artifacts by the specified repository.
CountByRepository(ctx context.Context, repositoryIDs []int64) (map[int64]int64, error)
// Incr increases the pull times of the artifact.
Incr(ctx context.Context, id int64) error
// ListArtifact lists the artifacts by the specified request.
ListArtifact(ctx context.Context, req types.ListArtifactRequest) ([]*models.Artifact, error)
// CountArtifact counts the artifacts by the specified request.
CountArtifact(ctx context.Context, req types.ListArtifactRequest) (int64, error)
// DeleteByID deletes the artifact with the specified artifact ID.
DeleteByID(ctx context.Context, id int64) error
// DeleteByIDs deletes the artifact with the specified artifact ID.
DeleteByIDs(ctx context.Context, ids []int64) error
// CreateSbom create a new artifact sbom.
CreateSbom(ctx context.Context, sbom *models.ArtifactSbom) error
// CreateVulnerability save a new artifact vulnerability.
CreateVulnerability(ctx context.Context, vulnerability *models.ArtifactVulnerability) error
// UpdateSbom update the artifact sbom.
UpdateSbom(ctx context.Context, artifactID int64, updates map[string]any) error
// UpdateVulnerability update the artifact vulnerability.
UpdateVulnerability(ctx context.Context, artifactID int64, updates map[string]any) error
// GetNamespaceSize get the specific namespace size
GetNamespaceSize(ctx context.Context, namespaceID int64) (int64, error)
// GetRepositorySize get the specific repository size
GetRepositorySize(ctx context.Context, repositoryID int64) (int64, error)
// GetReferrers ...
GetReferrers(ctx context.Context, repositoryID int64, digest string, artifactTypes []string) ([]*models.Artifact, error)
// IsArtifactAssociatedWithArtifact ...
IsArtifactAssociatedWithArtifact(ctx context.Context, artifactID int64) error
}
ArtifactService is the interface that provides the artifact service methods.
type ArtifactServiceFactory ¶
type ArtifactServiceFactory interface {
New(txs ...*query.Query) ArtifactService
}
ArtifactServiceFactory is the interface that provides the artifact service factory methods.
func NewArtifactServiceFactory ¶
func NewArtifactServiceFactory() ArtifactServiceFactory
NewArtifactServiceFactory creates a new artifact service factory.
type AuditService ¶
type AuditService interface {
// Create creates a new Audit record in the database
Create(ctx context.Context, audit *models.Audit) error
// HotNamespace get top n hot namespace by user id
HotNamespace(ctx context.Context, userID int64, top int) ([]*models.Namespace, error)
}
AuditService is the interface that provides methods to operate on Audit model
type AuditServiceFactory ¶
type AuditServiceFactory interface {
New(txs ...*query.Query) AuditService
}
AuditServiceFactory is the interface that provides the audit service factory methods.
func NewAuditServiceFactory ¶
func NewAuditServiceFactory() AuditServiceFactory
NewAuditServiceFactory creates a new audit service factory.
type AutoCreateNamespace ¶
type AutoCreateNamespace struct {
AutoCreate bool
Visibility enums.Visibility
UserID int64
ProducerClient definition.WorkQueueProducer
}
AutoCreateNamespace ...
type BlobService ¶
type BlobService interface {
// Create creates a new blob.
Create(ctx context.Context, blob *models.Blob) error
// FindWithLastPull find with last pull
FindWithLastPull(ctx context.Context, before int64, last, limit int64) ([]*models.Blob, error)
// FindAssociateWithArtifact ...
FindAssociateWithArtifact(ctx context.Context, ids []int64) ([]int64, error)
// FindByDigest finds the blob with the specified digest.
FindByDigest(ctx context.Context, digest string) (*models.Blob, error)
// FindByDigests finds the blobs with the specified digests.
FindByDigests(ctx context.Context, digests []string) ([]*models.Blob, error)
// Exists checks if the blob with the specified digest exists.
Exists(ctx context.Context, digest string) (bool, error)
// Incr increases the pull times of the artifact.
Incr(ctx context.Context, id int64) error
// DeleteByID deletes the blob with the specified blob ID.
DeleteByID(ctx context.Context, id int64) error
}
BlobService defines the operations related to blobs
type BlobServiceFactory ¶
type BlobServiceFactory interface {
New(txs ...*query.Query) BlobService
}
BlobServiceFactory is the interface that provides the blob service factory methods.
func NewBlobServiceFactory ¶
func NewBlobServiceFactory() BlobServiceFactory
NewBlobServiceFactory creates a new blob service factory.
type BlobUploadService ¶
type BlobUploadService interface {
// Create creates a new blob upload.
Create(ctx context.Context, blobUpload *models.BlobUpload) error
// GetLastPart gets the blob upload with the specified blob upload ID.
GetLastPart(ctx context.Context, uploadID string) (*models.BlobUpload, error)
// FindAllByUploadID find all blob uploads with the specified upload ID.
FindAllByUploadID(ctx context.Context, uploadID string) ([]*models.BlobUpload, error)
// TotalSizeByUploadID gets the total size of the blob uploads with the specified upload ID.
TotalSizeByUploadID(ctx context.Context, uploadID string) (int64, error)
TotalEtagsByUploadID(ctx context.Context, uploadID string) ([]string, error)
// DeleteByUploadID deletes all blob uploads with the specified upload ID.
DeleteByUploadID(ctx context.Context, uploadID string) error
}
BlobUploadService is the interface for the blob upload service.
type BlobUploadServiceFactory ¶
type BlobUploadServiceFactory interface {
New(txs ...*query.Query) BlobUploadService
}
BlobUploadServiceFactory is the interface for the blob upload service factory.
func NewBlobUploadServiceFactory ¶
func NewBlobUploadServiceFactory() BlobUploadServiceFactory
NewBlobUploadServiceFactory creates a new blob upload service factory.
type BuilderService ¶
type BuilderService interface {
// Create creates a new builder record in the database
Create(ctx context.Context, builder *models.Builder) error
// Update update the builder by id
Update(ctx context.Context, id int64, updates map[string]interface{}) error
// Get get builder by repository id
Get(ctx context.Context, repositoryID int64) (*models.Builder, error)
// GetByRepositoryIDs get builders by repository ids
GetByRepositoryIDs(ctx context.Context, repositoryIDs []int64) (map[int64]*models.Builder, error)
// GetByRepositoryID get builder by repository id
GetByRepositoryID(ctx context.Context, repositoryID int64) (*models.Builder, error)
// CreateRunner creates a new builder runner record in the database
CreateRunner(ctx context.Context, runner *models.BuilderRunner) error
// GetRunner get runner from object storage or database
GetRunner(ctx context.Context, id int64) (*models.BuilderRunner, error)
// ListRunners list builder runners
ListRunners(ctx context.Context, id int64, pagination types.Pagination, sort types.Sortable) ([]*models.BuilderRunner, int64, error)
// UpdateRunner update builder runner
UpdateRunner(ctx context.Context, builderID, runnerID int64, updates map[string]interface{}) error
// GetByNextTrigger get by next trigger
GetByNextTrigger(ctx context.Context, now time.Time, limit int) ([]*models.Builder, error)
// UpdateNextTrigger update next trigger
UpdateNextTrigger(ctx context.Context, id int64, next time.Time) error
}
BuilderService is the interface that provides methods to operate on Builder model
type BuilderServiceFactory ¶
type BuilderServiceFactory interface {
New(txs ...*query.Query) BuilderService
}
BuilderServiceFactory is the interface that provides the builder service factory methods.
func NewBuilderServiceFactory ¶
func NewBuilderServiceFactory() BuilderServiceFactory
NewBuilderServiceFactory creates a new builder service factory.
type CodeRepositoryService ¶
type CodeRepositoryService interface {
// Create creates new code repository record in the database
CreateInBatches(ctx context.Context, codeRepositories []*models.CodeRepository) error
// CreateOwnersInBatches creates new code repository owner records in the database
CreateOwnersInBatches(ctx context.Context, codeRepositoryOwners []*models.CodeRepositoryOwner) error
// CreateBranchesInBatches ...
CreateBranchesInBatches(ctx context.Context, branches []*models.CodeRepositoryBranch) error
// UpdateInBatches updates code repository records in the database
UpdateInBatches(ctx context.Context, codeRepositories []*models.CodeRepository) error
// UpdateOwnersInBatches updates code repository owner records in the database
UpdateOwnersInBatches(ctx context.Context, codeRepositoryOwners []*models.CodeRepositoryOwner) error
// DeleteInBatches deletes code repository records in the database
DeleteInBatches(ctx context.Context, ids []int64) error
// DeleteOwnerInBatches deletes code repository owner records in the database
DeleteOwnerInBatches(ctx context.Context, ids []int64) error
// DeleteBranchesInBatches ...
DeleteBranchesInBatches(ctx context.Context, ids []int64) error
// ListAll lists all code repository records in the database
ListAll(ctx context.Context, user3rdPartyID int64) ([]*models.CodeRepository, error)
// Get get code repository record by id
Get(ctx context.Context, id int64) (*models.CodeRepository, error)
// ListOwnersAll lists all code repository owners records in the database
ListOwnersAll(ctx context.Context, user3rdPartyID int64) ([]*models.CodeRepositoryOwner, error)
// ListWithPagination list code repositories with pagination
ListWithPagination(ctx context.Context, userID int64, provider enums.Provider, owner, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.CodeRepository, int64, error)
// ListOwnerWithoutPagination list code repositories without pagination
ListOwnerWithoutPagination(ctx context.Context, userID int64, provider enums.Provider, owner *string) ([]*models.CodeRepositoryOwner, int64, error)
// ListBranchesWithoutPagination ...
ListBranchesWithoutPagination(ctx context.Context, codeRepositoryID int64) ([]*models.CodeRepositoryBranch, int64, error)
// GetBranchByName ...
GetBranchByName(ctx context.Context, codeRepositoryID int64, branch string) (*models.CodeRepositoryBranch, error)
// GetCloneCredential ...
GetCloneCredential(ctx context.Context, user3rdPartyID int64) (*models.CodeRepositoryCloneCredential, error)
}
CodeRepositoryService is the interface that provides the code repository service methods.
type CodeRepositoryServiceFactory ¶
type CodeRepositoryServiceFactory interface {
New(txs ...*query.Query) CodeRepositoryService
}
CodeRepositoryServiceFactory is the interface that provides the code repository service factory methods.
func NewCodeRepositoryServiceFactory ¶
func NewCodeRepositoryServiceFactory() CodeRepositoryServiceFactory
NewCodeRepositoryServiceFactory creates a new code repository service factory
type DaemonService ¶
type DaemonService interface {
// GetGcTagRule ...
GetGcTagRule(ctx context.Context, namespaceID *int64) (*models.DaemonGcTagRule, error)
// CreateGcTagRule ...
CreateGcTagRule(ctx context.Context, ruleObj *models.DaemonGcTagRule) error
// UpdateGcTagRule ...
UpdateGcTagRule(ctx context.Context, ruleID int64, updates map[string]any) error
// GetGcTagLatestRunner ...
GetGcTagLatestRunner(ctx context.Context, ruleID int64) (*models.DaemonGcTagRunner, error)
// GetGcTagRunner ...
GetGcTagRunner(ctx context.Context, runnerID int64) (*models.DaemonGcTagRunner, error)
// ListGcTagRunners ...
ListGcTagRunners(ctx context.Context, ruleID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcTagRunner, int64, error)
// CreateGcTagRunner ...
CreateGcTagRunner(ctx context.Context, runnerObj *models.DaemonGcTagRunner) error
// UpdateGcTagRunner ...
UpdateGcTagRunner(ctx context.Context, runnerID int64, updates map[string]any) error
// CreateGcTagRecords ...
CreateGcTagRecords(ctx context.Context, recordObjs []*models.DaemonGcTagRecord) error
// ListGcTagRecords ...
ListGcTagRecords(ctx context.Context, runnerID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcTagRecord, int64, error)
// GetGcTagRecord ...
GetGcTagRecord(ctx context.Context, recordID int64) (*models.DaemonGcTagRecord, error)
// GetGcRepositoryRule ...
GetGcRepositoryRule(ctx context.Context, namespaceID *int64) (*models.DaemonGcRepositoryRule, error)
// CreateGcRepositoryRule ...
CreateGcRepositoryRule(ctx context.Context, ruleObj *models.DaemonGcRepositoryRule) error
// UpdateGcRepositoryRule ...
UpdateGcRepositoryRule(ctx context.Context, ruleID int64, updates map[string]any) error
// GetGcRepositoryLatestRunner ...
GetGcRepositoryLatestRunner(ctx context.Context, ruleID int64) (*models.DaemonGcRepositoryRunner, error)
// GetGcRepositoryRunner ...
GetGcRepositoryRunner(ctx context.Context, runnerID int64) (*models.DaemonGcRepositoryRunner, error)
// ListGcRepositoryRunners ...
ListGcRepositoryRunners(ctx context.Context, ruleID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcRepositoryRunner, int64, error)
// CreateGcRepositoryRunner ...
CreateGcRepositoryRunner(ctx context.Context, runnerObj *models.DaemonGcRepositoryRunner) error
// UpdateGcRepositoryRunner ...
UpdateGcRepositoryRunner(ctx context.Context, runnerID int64, updates map[string]any) error
// CreateGcRepositoryRecords ...
CreateGcRepositoryRecords(ctx context.Context, records []*models.DaemonGcRepositoryRecord) error
// ListGcRepositoryRecords lists all gc repository records.
ListGcRepositoryRecords(ctx context.Context, runnerID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcRepositoryRecord, int64, error)
// GetGcRepositoryRecord ...
GetGcRepositoryRecord(ctx context.Context, recordID int64) (*models.DaemonGcRepositoryRecord, error)
// GetGcArtifactRule ...
GetGcArtifactRule(ctx context.Context, namespaceID *int64) (*models.DaemonGcArtifactRule, error)
// CreateGcArtifactRule ...
CreateGcArtifactRule(ctx context.Context, ruleObj *models.DaemonGcArtifactRule) error
// UpdateGcArtifactRule ...
UpdateGcArtifactRule(ctx context.Context, ruleID int64, updates map[string]any) error
// GetGcArtifactLatestRunner ...
GetGcArtifactLatestRunner(ctx context.Context, ruleID int64) (*models.DaemonGcArtifactRunner, error)
// GetGcArtifactRunner ...
GetGcArtifactRunner(ctx context.Context, runnerID int64) (*models.DaemonGcArtifactRunner, error)
// ListGcArtifactRunners ...
ListGcArtifactRunners(ctx context.Context, ruleID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcArtifactRunner, int64, error)
// CreateGcArtifactRunner ...
CreateGcArtifactRunner(ctx context.Context, runnerObj *models.DaemonGcArtifactRunner) error
// UpdateGcArtifactRunner ...
UpdateGcArtifactRunner(ctx context.Context, runnerID int64, updates map[string]any) error
// CreateGcArtifactRecords ...
CreateGcArtifactRecords(ctx context.Context, records []*models.DaemonGcArtifactRecord) error
// ListGcArtifactRecords ...
ListGcArtifactRecords(ctx context.Context, runnerID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcArtifactRecord, int64, error)
// GetGcArtifactRecord ...
GetGcArtifactRecord(ctx context.Context, recordID int64) (*models.DaemonGcArtifactRecord, error)
// GetGcBlobRule ...
GetGcBlobRule(ctx context.Context) (*models.DaemonGcBlobRule, error)
// CreateGcBlobRule ...
CreateGcBlobRule(ctx context.Context, ruleObj *models.DaemonGcBlobRule) error
// UpdateGcBlobRule ...
UpdateGcBlobRule(ctx context.Context, ruleID int64, updates map[string]any) error
// GetGcBlobLatestRunner ...
GetGcBlobLatestRunner(ctx context.Context, ruleID int64) (*models.DaemonGcBlobRunner, error)
// GetGcBlobRunner ...
GetGcBlobRunner(ctx context.Context, runnerID int64) (*models.DaemonGcBlobRunner, error)
// ListGcBlobRunners ...
ListGcBlobRunners(ctx context.Context, ruleID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcBlobRunner, int64, error)
// CreateGcBlobRunner ...
CreateGcBlobRunner(ctx context.Context, runnerObj *models.DaemonGcBlobRunner) error
// UpdateGcBlobRunner ...
UpdateGcBlobRunner(ctx context.Context, runnerID int64, updates map[string]any) error
// CreateGcBlobRecords ...
CreateGcBlobRecords(ctx context.Context, records []*models.DaemonGcBlobRecord) error
// ListGcBlobRecords ...
ListGcBlobRecords(ctx context.Context, runnerID int64, pagination types.Pagination, sort types.Sortable) ([]*models.DaemonGcBlobRecord, int64, error)
// GetGcBlobRecord ...
GetGcBlobRecord(ctx context.Context, recordID int64) (*models.DaemonGcBlobRecord, error)
}
DaemonService is the interface that provides methods to operate on daemon model
type DaemonServiceFactory ¶
type DaemonServiceFactory interface {
New(txs ...*query.Query) DaemonService
}
DaemonServiceFactory is the interface that provides the daemon service factory methods.
func NewDaemonServiceFactory ¶
func NewDaemonServiceFactory() DaemonServiceFactory
NewDaemonServiceFactory creates a new audit service factory.
type NamespaceMemberService ¶
type NamespaceMemberService interface {
// AddNamespaceMember ...
AddNamespaceMember(ctx context.Context, userID int64, namespaceObj models.Namespace, role enums.NamespaceRole) (*models.NamespaceMember, error)
// UpdateNamespaceMember ...
UpdateNamespaceMember(ctx context.Context, userID int64, namespaceObj models.Namespace, role enums.NamespaceRole) error
// DeleteNamespaceMember ...
DeleteNamespaceMember(ctx context.Context, userID int64, namespaceObj models.Namespace) error
// ListNamespaceMembers ...
ListNamespaceMembers(ctx context.Context, namespaceID int64, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.NamespaceMember, int64, error)
// GetNamespaceMember ...
GetNamespaceMember(ctx context.Context, namespaceID int64, userID int64) (*models.NamespaceMember, error)
// GetNamespacesMember ...
GetNamespacesMember(ctx context.Context, namespaceIDs []int64, userID int64) ([]*models.NamespaceMember, error)
// CountNamespaceMember ...
CountNamespaceMember(ctx context.Context, userID int64, namespaceID int64) (int64, error)
}
NamespaceMemberService is the interface that provides methods to operate on role model
type NamespaceMemberServiceFactory ¶
type NamespaceMemberServiceFactory interface {
New(txs ...*query.Query) NamespaceMemberService
}
NamespaceMemberServiceFactory is the interface that provides the namespace member service factory methods.
func NewNamespaceMemberServiceFactory ¶
func NewNamespaceMemberServiceFactory() NamespaceMemberServiceFactory
NewNamespaceMemberServiceFactory creates a new namespace member service factory.
type NamespaceService ¶
type NamespaceService interface {
// Create creates a new namespace.
Create(ctx context.Context, namespace *models.Namespace) error
// FindAll ...
FindAll(ctx context.Context) ([]*models.Namespace, error)
// FindWithCursor ...
FindWithCursor(ctx context.Context, limit int64, last int64) ([]*models.Namespace, error)
// UpdateQuota updates the namespace quota.
UpdateQuota(ctx context.Context, namespaceID, limit int64) error
// Get gets the namespace with the specified namespace ID.
Get(ctx context.Context, id int64) (*models.Namespace, error)
// GetByName gets the namespace with the specified namespace name.
GetByName(ctx context.Context, name string) (*models.Namespace, error)
// ListNamespace lists all namespaces.
ListNamespace(ctx context.Context, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.Namespace, int64, error)
// ListNamespaceWithAuth lists all namespaces with auth.
ListNamespaceWithAuth(ctx context.Context, userID int64, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.Namespace, int64, error)
// CountNamespace counts all namespaces.
CountNamespace(ctx context.Context, name *string) (int64, error)
// DeleteByID deletes the namespace with the specified namespace ID.
DeleteByID(ctx context.Context, id int64) error
// UpdateByID updates the namespace with the specified namespace ID.
UpdateByID(ctx context.Context, id int64, updates map[string]interface{}) error
}
NamespaceService is the interface that provides the namespace service methods.
type NamespaceServiceFactory ¶
type NamespaceServiceFactory interface {
New(txs ...*query.Query) NamespaceService
}
NamespaceServiceFactory is the interface that provides the namespace service factory methods.
func NewNamespaceServiceFactory ¶
func NewNamespaceServiceFactory() NamespaceServiceFactory
NewNamespaceServiceFactory creates a new namespace service factory.
type RepositoryService ¶
type RepositoryService interface {
// Create saves the repository.
Create(ctx context.Context, repositoryObj *models.Repository, autoCreateNamespace AutoCreateNamespace) error
// FindAll ...
FindAll(ctx context.Context, namespaceID, limit, last int64) ([]*models.Repository, error)
// Get gets the repository with the specified repository ID.
Get(ctx context.Context, repositoryID int64) (*models.Repository, error)
// GetByName gets the repository with the specified repository name.
GetByName(context.Context, string) (*models.Repository, error)
// ListByDtPagination lists the repositories by the pagination.
ListByDtPagination(ctx context.Context, limit int, lastID ...int64) ([]*models.Repository, error)
// ListWithScrollable list the repository with scrollable last id
ListWithScrollable(ctx context.Context, namespaceID, userID int64, name *string, limit int, lastID int64) ([]*models.Repository, error)
// ListRepository lists all repositories.
ListRepository(ctx context.Context, namespaceID int64, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.Repository, int64, error)
// ListRepository lists all repositories with auth.
ListRepositoryWithAuth(ctx context.Context, namespaceID, userID int64, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.Repository, int64, error)
// CountRepository counts all repositories.
CountRepository(ctx context.Context, namespaceID int64, name *string) (int64, error)
// UpdateRepository update specific repository
UpdateRepository(ctx context.Context, id int64, updates map[string]any) error
// CountByNamespace counts the repositories by the namespace ID.
CountByNamespace(ctx context.Context, namespaceIDs []int64) (map[int64]int64, error)
// DeleteByID deletes the repository with the specified repository ID.
DeleteByID(ctx context.Context, id int64) error
// DeleteEmpty delete all of empty repository
DeleteEmpty(ctx context.Context, namespaceID *int64) ([]string, error)
}
RepositoryService is the interface that provides the repository service methods.
type RepositoryServiceFactory ¶
type RepositoryServiceFactory interface {
New(txs ...*query.Query) RepositoryService
}
RepositoryServiceFactory is the interface that provides the repository service factory methods.
func NewRepositoryServiceFactory ¶
func NewRepositoryServiceFactory() RepositoryServiceFactory
NewRepositoryServiceFactory creates a new repository service factory.
type SettingService ¶
type SettingService interface {
// Create create a new setting record in the database
Create(ctx context.Context, key string, val []byte) error
// Update update a setting record in the database by key
Update(ctx context.Context, key string, val []byte) error
// Delete get a setting record
Delete(ctx context.Context, key string) error
// Get get a setting record
Get(ctx context.Context, key string) (*models.Setting, error)
}
SettingService is the interface that provides methods to operate on setting model
type SettingServiceFactory ¶
type SettingServiceFactory interface {
New(txs ...*query.Query) SettingService
}
SettingServiceFactory is the interface that provides the setting service factory methods.
func NewSettingServiceFactory ¶
func NewSettingServiceFactory() SettingServiceFactory
NewSettingServiceFactory creates a new setting service factory.
type TagService ¶
type TagService interface {
// Create save a new tag if conflict do nothing.
Create(ctx context.Context, tag *models.Tag, options ...Option) error
// FindWithQuantityCursor ...
FindWithQuantityCursor(ctx context.Context, repositoryID int64, quantity, limit int, last int64) ([]*models.Tag, error)
// FindWithDayCursor ...
FindWithDayCursor(ctx context.Context, repositoryID int64, day, limit int, last int64) ([]*models.Tag, error)
// GetByID gets the tag with the specified tag ID.
GetByID(ctx context.Context, tagID int64) (*models.Tag, error)
// GetByName gets the tag with the specified tag name.
GetByName(ctx context.Context, repositoryID int64, tag string) (*models.Tag, error)
// GetByArtifactID ...
GetByArtifactID(ctx context.Context, repositoryID, artifactID int64) (*models.Tag, error)
// DeleteByName deletes the tag with the specified tag name.
DeleteByName(ctx context.Context, repositoryID int64, tag string) error
// DeleteByArtifactID deletes the tag with the specified artifact ID.
DeleteByArtifactID(ctx context.Context, artifactID int64) error
// Incr increases the pull times of the artifact.
Incr(ctx context.Context, id int64) error
// ListByDtPagination lists the tags by the specified repository and pagination.
ListByDtPagination(ctx context.Context, repository string, limit int, lastID ...int64) ([]*models.Tag, error)
// ListTag lists the tags by the specified request.
ListTag(ctx context.Context, repositoryID int64, name *string, types []enums.ArtifactType, pagination types.Pagination, sort types.Sortable) ([]*models.Tag, int64, error)
// CountTag counts the artifacts by the specified request.
// CountTag(ctx context.Context, req types.ListTagRequest) (int64, error)
// CountByNamespace counts the tags by the specified namespace.
CountByNamespace(ctx context.Context, namespaceIDs []int64) (map[int64]int64, error)
// CountByRepositories counts the tags by the specified repositories.
CountByRepositories(ctx context.Context, repositoryIDs []int64) (map[int64]int64, error)
// CountByRepository counts the tags by the specified repository.
CountByRepository(ctx context.Context, repositoryID int64) (int64, error)
// DeleteByID deletes the tag with the specified tag ID.
DeleteByID(ctx context.Context, id int64) error
// CountByArtifact counts the tags by the specified artifact.
CountByArtifact(ctx context.Context, artifactIDs []int64) (map[int64]int64, error)
}
TagService is the interface that provides the tag service methods.
type TagServiceFactory ¶
type TagServiceFactory interface {
New(txs ...*query.Query) TagService
}
TagServiceFactory is the interface that provides the tag service factory methods.
func NewTagServiceFactory ¶
func NewTagServiceFactory() TagServiceFactory
NewTagServiceFactory creates a new tag service factory.
type UserService ¶
type UserService interface {
// Get get user by id.
Get(ctx context.Context, id int64) (*models.User, error)
// GetByUsername gets the user with the specified user name.
GetByUsername(ctx context.Context, username string) (*models.User, error)
// Create creates a new user.
Create(ctx context.Context, user *models.User) error
// CreateUser3rdParty create a new 3rdparty user.
CreateUser3rdParty(ctx context.Context, user3rdParty *models.User3rdParty) error
// UpdateUser3rdParty update 3rdParty user
UpdateUser3rdParty(ctx context.Context, id int64, updates map[string]any) error
// List all users with pagination
List(ctx context.Context, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.User, int64, error)
// ListWithoutUsername all users with pagination, and without specific username
ListWithoutUsername(ctx context.Context, except []string, withoutAdmin bool, name *string, pagination types.Pagination, sort types.Sortable) ([]*models.User, int64, error)
// UpdateByID updates the namespace with the specified namespace ID.
UpdateByID(ctx context.Context, id int64, updates map[string]interface{}) error
// AddPlatformMember bind a platform role for user
AddPlatformMember(ctx context.Context, userID int64, role enums.UserRole) error
// DeletePlatformMember unbind platform role for user
DeletePlatformMember(ctx context.Context, userID int64, role enums.UserRole) error
// Count gets the total number of users.
Count(ctx context.Context) (int64, error)
// GetUser3rdPartyByAccountID gets the user with the specified oauth2 provider.
GetUser3rdPartyByAccountID(ctx context.Context, provider enums.Provider, accountID string) (*models.User3rdParty, error)
// GetUser3rdPartyByProvider gets the 3rdParty user by provider
GetUser3rdPartyByProvider(ctx context.Context, userID int64, provider enums.Provider) (*models.User3rdParty, error)
// GetUser3rdParty gets the user 3rdparty with the specified 3rdparty userid
GetUser3rdParty(ctx context.Context, user3rdPartyID int64) (*models.User3rdParty, error)
// ListUser3rdParty gets the user 3rdparty with the specified 3rdparty userid
ListUser3rdParty(ctx context.Context, userID int64) ([]*models.User3rdParty, error)
// GetRecoverCodeByUserID gets the recover code with the specified user id.
GetRecoverCodeByUserID(ctx context.Context, userID int64) (*models.UserRecoverCode, error)
// GetByRecoverCode gets the user with the specified recover code.
GetByRecoverCode(ctx context.Context, code string) (*models.User, error)
// CreateRecoverCode creates a new recover code.
CreateRecoverCode(ctx context.Context, recoverCode *models.UserRecoverCode) error
// DeleteRecoverCode deletes the recover code with the specified user id.
DeleteRecoverCode(ctx context.Context, userID int64) error
}
UserService is the interface that provides the user service methods.
type UserServiceFactory ¶
type UserServiceFactory interface {
New(txs ...*query.Query) UserService
}
UserServiceFactory is the interface that provides the user service factory methods.
func NewUserServiceFactory ¶
func NewUserServiceFactory() UserServiceFactory
NewUserServiceFactory creates a new user service factory.
type WebhookService ¶
type WebhookService interface {
// Create a new webhook
Create(ctx context.Context, webhook *models.Webhook) error
// List all webhook with pagination
List(ctx context.Context, namespaceID *int64, pagination types.Pagination, sort types.Sortable) ([]*models.Webhook, int64, error)
// Get gets the webhook with the specified webhook ID.
Get(ctx context.Context, id int64) (*models.Webhook, error)
// GetByFilter gets the webhook with the specified filter.
GetByFilter(ctx context.Context, filter map[string]any) ([]*models.Webhook, error)
// DeleteByID deletes the webhook with the specified webhook ID.
DeleteByID(ctx context.Context, id int64) error
// UpdateByID updates the webhook with the specified webhook ID.
UpdateByID(ctx context.Context, id int64, updates map[string]interface{}) error
// CreateLog create a new webhook log
CreateLog(ctx context.Context, webhookLog *models.WebhookLog) error
// ListLogs all webhook logs with pagination
ListLogs(ctx context.Context, webhookID int64, pagination types.Pagination, sort types.Sortable) ([]*models.WebhookLog, int64, error)
// GetLog get webhook log with the specified webhook ID
GetLog(ctx context.Context, webhookLogID int64) (*models.WebhookLog, error)
// DeleteLogByID delete webhook log by id
DeleteLogByID(ctx context.Context, webhookLogID int64) error
}
WebhookService is the interface that provides methods to operate on webhook model
type WebhookServiceFactory ¶
type WebhookServiceFactory interface {
New(txs ...*query.Query) WebhookService
}
WebhookServiceFactory is the interface that provides the webhook service factory methods.
func NewWebhookServiceFactory ¶
func NewWebhookServiceFactory() WebhookServiceFactory
NewWebhookServiceFactory creates a new webhook service factory.
type WorkQueueService ¶
type WorkQueueService interface {
// Create creates a new work queue record in the database
Create(ctx context.Context, workqObj *models.WorkQueue) error
// Get get a work queue record
Get(ctx context.Context, topic enums.Daemon) (*models.WorkQueue, error)
// UpdateStatus update a work queue record status
UpdateStatus(ctx context.Context, id int64, version, newVersion string, times int, status enums.TaskCommonStatus) error
}
WorkQueueService is the interface that provides methods to operate on work queue model
type WorkQueueServiceFactory ¶
type WorkQueueServiceFactory interface {
New(txs ...*query.Query) WorkQueueService
}
WorkQueueServiceFactory is the interface that provides the work queue service factory methods.
func NewWorkQueueServiceFactory ¶
func NewWorkQueueServiceFactory() WorkQueueServiceFactory
NewWorkQueueServiceFactory creates a new work queue service factory.