label

package
v0.0.0-...-045f829 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mgr = New()

Mgr is a global instance of label manager

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Create the label
	Create(ctx context.Context, label *model.Label) (id int64, err error)
	// Get the label specified by ID
	Get(ctx context.Context, id int64) (label *model.Label, err error)
	// Count returns the total count of Labels according to the query
	Count(ctx context.Context, query *q.Query) (total int64, err error)
	// Update the label
	Update(ctx context.Context, label *model.Label) error
	// Delete the label
	Delete(ctx context.Context, id int64) (err error)
	// List ...
	List(ctx context.Context, query *q.Query) ([]*model.Label, error)

	// List labels that added to the artifact specified by the ID
	ListByArtifact(ctx context.Context, artifactID int64) (labels []*model.Label, err error)
	// Add label to the artifact specified the ID
	AddTo(ctx context.Context, labelID int64, artifactID int64) (err error)
	// Remove the label added to the artifact specified by the ID
	RemoveFrom(ctx context.Context, labelID int64, artifactID int64) (err error)
	// Remove all labels added to the artifact specified by the ID
	RemoveAllFrom(ctx context.Context, artifactID int64) (err error)
	// RemoveFromAllArtifacts removes the label specified by the ID from all artifacts
	RemoveFromAllArtifacts(ctx context.Context, labelID int64) (err error)
}

Manager manages the labels and references between label and resource

func New

func New() Manager

New creates an instance of the default label manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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