db

package
v0.0.0-...-33e2069 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentInterface

type AgentInterface interface {
	Create(ctx context.Context, object *model.Agent) (*model.Agent, error)
	Update(ctx context.Context, agentId int64, resourceVersion int64, updates map[string]interface{}) error
	Delete(ctx context.Context, agentId int64) error
	Get(ctx context.Context, agentId int64) (*model.Agent, error)
	GetByName(ctx context.Context, agentName string) (*model.Agent, error)
	DeleteBy(ctx context.Context, opts ...Options) error
	UpdateByName(ctx context.Context, agentName string, updates map[string]interface{}) error
	List(ctx context.Context, opts ...Options) ([]model.Agent, error)
	ListForSchedule(ctx context.Context, opts ...Options) ([]model.Agent, error)
	Count(ctx context.Context, opts ...Options) (int64, error)
}

type BuildInterface

type BuildInterface interface {
	Create(ctx context.Context, object *model.Build) (*model.Build, error)
	Delete(ctx context.Context, dockerfileId int64) error
	Update(ctx context.Context, DockerfileId int64, resourceVersion int64, updates map[string]interface{}) error
	List(ctx context.Context, opts ...Options) ([]model.Build, error)
	Get(ctx context.Context, dockerfileId int64) (*model.Build, error)
	UpdateBy(ctx context.Context, updates map[string]interface{}, opts ...Options) error
	Count(ctx context.Context, opts ...Options) (int64, error)

	CreateBuildMessage(ctx context.Context, object *model.BuildMessage) error
	ListBuildMessages(ctx context.Context, opts ...Options) ([]model.BuildMessage, error)
}

type ImageInterface

type ImageInterface interface {
	Create(ctx context.Context, object *model.Image) (*model.Image, error)
	Update(ctx context.Context, imageId int64, resourceVersion int64, updates map[string]interface{}) error
	Delete(ctx context.Context, imageId int64) error
	Get(ctx context.Context, imageId int64, del bool) (*model.Image, error)
	List(ctx context.Context, opts ...Options) ([]model.Image, error)

	UpdateWithoutLock(ctx context.Context, imageId int64, updates map[string]interface{}) error

	GetImageWithTagsCount(ctx context.Context, imageId int64, del bool) (*model.Image, error)
	ListWithTagsCount(ctx context.Context, opts ...Options) ([]model.Image, error)
	CreateFlow(ctx context.Context, object *model.Downflow) error

	CreateInBatch(ctx context.Context, objects []model.Image) error
	DeleteInBatch(ctx context.Context, ids []int64) error
	SoftDeleteInBatch(ctx context.Context, taskId int64) error
	ListWithTask(ctx context.Context, taskId int64, opts ...Options) ([]model.Image, error)
	ListWithUser(ctx context.Context, userId string, opts ...Options) ([]model.Image, error)

	Count(ctx context.Context, opts ...Options) (int64, error)

	GetByPath(ctx context.Context, path string, mirror string, opts ...Options) (*model.Image, error)
	GetBy(ctx context.Context, opts ...Options) (*model.Image, error)

	ListImagesWithTag(ctx context.Context, opts ...Options) ([]model.Image, error)


	CreateTag(ctx context.Context, object *model.Tag) (*model.Tag, error)
	UpdateTag(ctx context.Context, imageId int64, tag string, updates map[string]interface{}) error
	DeleteTag(ctx context.Context, tagId int64) error
	GetTag(ctx context.Context, tagId int64, del bool) (*model.Tag, error)
	ListTags(ctx context.Context, opts ...Options) ([]model.Tag, error)

	GetTagWithArch(ctx context.Context, imageId int64, name string, arch string, del bool) (*model.Tag, error)

	TagCount(ctx context.Context, opts ...Options) (int64, error)
	PullAllCount(ctx context.Context) (int64, error)

	CreateNamespace(ctx context.Context, object *model.Namespace) (*model.Namespace, error)
	UpdateNamespace(ctx context.Context, namespaceId int64, resourceVersion int64, updates map[string]interface{}) error
	DeleteNamespace(ctx context.Context, namespaceId int64) error
	ListNamespaces(ctx context.Context, opts ...Options) ([]model.Namespace, error)
	GetNamespace(ctx context.Context, opts ...Options) (*model.Namespace, error)
	GetNamespaceCount(ctx context.Context, opts ...Options) (int64, error)
}

type LabelInterface

type LabelInterface interface {
	Create(ctx context.Context, object *model.Label) (*model.Label, error)
	Delete(ctx context.Context, id int64) error
	Update(ctx context.Context, labelId int64, resourceVersion int64, updates map[string]interface{}) error
	List(ctx context.Context, opts ...Options) ([]model.Label, error)
	Count(ctx context.Context, opts ...Options) (int64, error)
	Get(ctx context.Context, opts ...Options) (*model.Label, error)

	ListLogos(ctx context.Context, opts ...Options) ([]model.Logo, error)
	CountLogos(ctx context.Context, opts ...Options) (int64, error)

	CreateImageLabel(ctx context.Context, object *model.ImageLabel) (*model.ImageLabel, error)
	GetImageLabel(ctx context.Context, opts ...Options) (*model.ImageLabel, error)
	DeleteImageLabel(ctx context.Context, opts ...Options) error
	ListImageLabels(ctx context.Context, opts ...Options) ([]model.ImageLabel, error)

	ListImageLabelsV2(ctx context.Context, imageId int64) ([]model.Label, error)
	ListImageLabelNames(ctx context.Context, imageId int64) ([]string, error)

	ListLabelImages(ctx context.Context, labelIds []int64, page int, limit int) ([]model.Image, int64, error)
	ListLabelPublicImages(ctx context.Context, labelIds []int64, query string, userId string, trusted int, page int, limit int) ([]model.Image, int64, error)
}

type MetricsInterface

type MetricsInterface interface {
	Create(ctx context.Context, object *model.Metrics) (*model.Metrics, error)
	Delete(ctx context.Context, opts ...Options) error
	List(ctx context.Context, opts ...Options) ([]model.Metrics, error)
	CountMetrics(ctx context.Context, opts ...Options) (int64, error)
}

type NotifyInterface

type NotifyInterface interface {
	Create(ctx context.Context, object *model.Notification) (*model.Notification, error)
	Update(ctx context.Context, id int64, resourceVersion int64, updates map[string]interface{}) error
	Delete(ctx context.Context, id int64) error
	Get(ctx context.Context, id int64) (*model.Notification, error)
	List(ctx context.Context, opts ...Options) ([]model.Notification, error)
	Count(ctx context.Context, opts ...Options) (int64, error)
}

type Options

type Options func(*gorm.DB) *gorm.DB

func WithAgent

func WithAgent(agent string) Options

func WithArch

func WithArch(arch string) Options

func WithBuild

func WithBuild(buildId int64) Options

func WithCreateOrderByASC

func WithCreateOrderByASC() Options

func WithCreateOrderByDesc

func WithCreateOrderByDesc() Options

func WithCreatedAfter

func WithCreatedAfter(t time.Time) Options

func WithCreatedBefore

func WithCreatedBefore(t time.Time) Options
func WithEmptyLogo() Options

func WithEnable

func WithEnable(enable int) Options

func WithErrorTask

func WithErrorTask(onlyErr bool) Options

func WithFailTimes

func WithFailTimes(t int) Options

func WithIDIn

func WithIDIn(ids ...int64) Options

func WithIDStrIn

func WithIDStrIn(ids ...string) Options

func WithId

func WithId(id int64) Options

func WithImage

func WithImage(imageId int64) Options

func WithLabel

func WithLabel(labelId int64) Options

func WithLabelIn

func WithLabelIn(labels ...string) Options

func WithLastSyncBefore

func WithLastSyncBefore(t time.Time) Options

func WithLimit

func WithLimit(limit int) Options

func WithModifyOrderByDesc

func WithModifyOrderByDesc() Options

func WithName

func WithName(name string) Options

func WithNameIn

func WithNameIn(names ...string) Options

func WithNameLike

func WithNameLike(name string) Options

func WithNamespace

func WithNamespace(ns string) Options

func WithNotOfficial

func WithNotOfficial() Options

func WithOfficial

func WithOfficial() Options

func WithOffset

func WithOffset(offset int) Options

func WithOrderByASC

func WithOrderByASC() Options

func WithOrderByDesc

func WithOrderByDesc() Options

func WithPath

func WithPath(path string) Options

func WithPathLike

func WithPathLike(path string) Options

func WithPublic

func WithPublic() Options

func WithRainbowdName

func WithRainbowdName(name string) Options

func WithRef

func WithRef(ref string) Options

func WithRole

func WithRole(role int) Options

func WithStatus

func WithStatus(status string) Options

func WithSubscribe

func WithSubscribe(subId int64) Options

func WithTagLike

func WithTagLike(tag string) Options

func WithTagOrderByDESC

func WithTagOrderByDESC() Options

func WithTask

func WithTask(taskId int64) Options

func WithTaskLike

func WithTaskLike(taskId int64) Options

func WithType

func WithType(Type string) Options

func WithUser

func WithUser(userId string) Options

type RainbowdInterface

type RainbowdInterface interface {
	Create(ctx context.Context, object *model.Rainbowd) (*model.Rainbowd, error)
	Update(ctx context.Context, rainbowdId int64, updates map[string]interface{}) error
	Delete(ctx context.Context, rainbowdId int64) error
	Get(ctx context.Context, rainbowdId int64) (*model.Rainbowd, error)
	List(ctx context.Context, opts ...Options) ([]model.Rainbowd, error)

	GetByName(ctx context.Context, name string) (*model.Rainbowd, error)

	CreateEvent(ctx context.Context, object *model.RainbowdEvent) (*model.RainbowdEvent, error)
	DeleteEvent(ctx context.Context, eid int64) error
	ListEvents(ctx context.Context, opts ...Options) ([]model.RainbowdEvent, error)
}

type RegistryInterface

type RegistryInterface interface {
	Create(ctx context.Context, object *model.Registry) (*model.Registry, error)
	Update(ctx context.Context, registryId int64, resourceVersion int64, updates map[string]interface{}) error
	Delete(ctx context.Context, registryId int64) error
	Get(ctx context.Context, registryId int64) (*model.Registry, error)
	List(ctx context.Context, opts ...Options) ([]model.Registry, error)
	ListWithUser(ctx context.Context, userId string, opts ...Options) ([]model.Registry, error)

	GetByName(ctx context.Context, registryName string) (*model.Registry, error)
	GetAdminRegistries(ctx context.Context, opts ...Options) ([]model.Registry, error)
	GetDefaultRegistry(ctx context.Context, opts ...Options) (*model.Registry, error)
}

type ShareDaoFactory

type ShareDaoFactory interface {
	Agent() AgentInterface
	Task() TaskInterface
	Registry() RegistryInterface
	Image() ImageInterface
	Label() LabelInterface
	Build() BuildInterface
	Notify() NotifyInterface
	Rainbowd() RainbowdInterface
	Metrics() MetricsInterface
}

func NewDaoFactory

func NewDaoFactory(db *gorm.DB, migrate bool) (ShareDaoFactory, error)

type TaskInterface

type TaskInterface interface {
	Create(ctx context.Context, object *model.Task) (*model.Task, error)
	Update(ctx context.Context, taskId int64, resourceVersion int64, updates map[string]interface{}) error
	Delete(ctx context.Context, taskId int64) error
	Get(ctx context.Context, taskId int64) (*model.Task, error)
	List(ctx context.Context, opts ...Options) ([]model.Task, error)

	DeleteInBatch(ctx context.Context, taskIds []int64) error
	UpdateDirectly(ctx context.Context, taskId int64, updates map[string]interface{}) error

	DeleteBySubscribe(ctx context.Context, subId int64) error

	GetOne(ctx context.Context, taskId int64, resourceVersion int64) (*model.Task, error)
	AssignToAgent(ctx context.Context, taskId int64, agentName string) error
	ListWithAgent(ctx context.Context, agentName string, process int, opts ...Options) ([]model.Task, error)
	ListWithNoAgent(ctx context.Context, process int, opts ...Options) ([]model.Task, error)
	ListWithUser(ctx context.Context, userId string, opts ...Options) ([]model.Task, error)
	GetOneForSchedule(ctx context.Context, opts ...Options) (*model.Task, error)
	GetRunningTask(ctx context.Context, opts ...Options) ([]model.Task, error)

	Count(ctx context.Context, opts ...Options) (int64, error)
	CountSubscribe(ctx context.Context, opts ...Options) (int64, error)

	ListReview(ctx context.Context) ([]model.Review, error)
	AddDailyReview(ctx context.Context, object *model.Daily) error
	CountDailyReview(ctx context.Context) (int64, error)

	CreateTaskMessage(ctx context.Context, object *model.TaskMessage) error
	DeleteTaskMessages(ctx context.Context, taskId int64) error
	ListTaskMessages(ctx context.Context, opts ...Options) ([]model.TaskMessage, error)

	CreateUser(ctx context.Context, object *model.User) error
	ListUsers(ctx context.Context, opts ...Options) ([]model.User, error)
	CountUsers(ctx context.Context, opts ...Options) (int64, error)
	GetUser(ctx context.Context, userId string) (*model.User, error)
	DeleteUser(ctx context.Context, userId string) error
	UpdateUser(ctx context.Context, userId string, resourceVersion int64, updates map[string]interface{}) error

	GetUserBy(ctx context.Context, opts ...Options) (*model.User, error)
	UpdateUserBy(ctx context.Context, updates map[string]interface{}, opts ...Options) error

	CreateOrUpdateUser(ctx context.Context, object *model.User) error

	ListKubernetesVersions(ctx context.Context, opts ...Options) ([]model.KubernetesVersion, error)
	GetKubernetesVersionCount(ctx context.Context, opts ...Options) (int64, error)
	GetKubernetesVersion(ctx context.Context, name string) (*model.KubernetesVersion, error)
	CreateKubernetesVersion(ctx context.Context, object *model.KubernetesVersion) error

	CreateSubscribe(ctx context.Context, object *model.Subscribe) error
	UpdateSubscribe(ctx context.Context, subId int64, resourceVersion int64, updates map[string]interface{}) error
	DeleteSubscribe(ctx context.Context, subId int64) error
	GetSubscribe(ctx context.Context, subId int64) (*model.Subscribe, error)
	ListSubscribes(ctx context.Context, opts ...Options) ([]model.Subscribe, error)
	GetSubscribeBy(ctx context.Context, opts ...Options) (*model.Subscribe, error)

	DeleteSubscribeAllMessage(ctx context.Context, subId int64) error
	UpdateSubscribeDirectly(ctx context.Context, subId int64, updates map[string]interface{}) error

	CreateSubscribeMessage(ctx context.Context, object *model.SubscribeMessage) error
	DeleteSubscribeMessage(ctx context.Context, subId int64) error
	ListSubscribeMessages(ctx context.Context, opts ...Options) ([]model.SubscribeMessage, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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