project

package
v0.0.0-...-562c01e Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Ctl is a global project controller instance
	Ctl = NewController()
)

Functions

func ListAll

func ListAll(ctx context.Context, chunkSize int, query *q.Query, options ...Option) <-chan Result

ListAll returns all projects with chunk support

Types

type Controller

type Controller interface {
	// Create create project instance
	Create(ctx context.Context, project *models.Project) (int64, error)
	// Count returns the total count of projects according to the query
	Count(ctx context.Context, query *q.Query) (int64, error)
	// Delete delete the project by project id
	Delete(ctx context.Context, id int64) error
	// Exists returns true when the specific project exists
	Exists(ctx context.Context, projectIDOrName interface{}) (bool, error)
	// Get get the project by project id or name
	Get(ctx context.Context, projectIDOrName interface{}, options ...Option) (*models.Project, error)
	// GetByName get the project by project name
	GetByName(ctx context.Context, projectName string, options ...Option) (*models.Project, error)
	// List list projects
	List(ctx context.Context, query *q.Query, options ...Option) ([]*models.Project, error)
	// Update update the project
	Update(ctx context.Context, project *models.Project) error
	// ListRoles lists the roles of user for the specific project
	ListRoles(ctx context.Context, projectID int64, u *commonmodels.User) ([]int, error)
}

Controller defines the operations related with blobs

func NewController

func NewController() Controller

NewController creates an instance of the default project controller

type MemberQuery

type MemberQuery = models.MemberQuery

MemberQuery alias to models.MemberQuery

type Option

type Option func(*Options)

Option option for `Get` and `Exist` method of `Controller`

func Detail

func Detail(detail bool) Option

Detail set WithDetail for the Options

func Metadata

func Metadata(metadata bool) Option

Metadata set WithMetadata for the Options

func WithCVEAllowlist

func WithCVEAllowlist() Option

WithCVEAllowlist set WithCVEAllowlist for the Options

func WithEffectCVEAllowlist

func WithEffectCVEAllowlist() Option

WithEffectCVEAllowlist set WithEffectCVEAllowlist for the Options

func WithOwner

func WithOwner() Option

WithOwner set WithOwner for the Options

type Options

type Options struct {
	WithDetail             bool
	WithCVEAllowlist       bool // get project with cve allowlist
	WithEffectCVEAllowlist bool // get project with effect cve allowlist
	WithMetadata           bool // get project with metadata
	WithOwner              bool // get project with owner name
}

Options options used by `Get` method of `Controller`

type Project

type Project = models.Project

Project alias to models.Project

type Result

type Result struct {
	Data  *models.Project
	Error error
}

Result the result for ListAll func

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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