dao

package
v0.0.0-...-29bd094 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 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 Artifact

type Artifact struct {
	ID                int64     `orm:"pk;auto;column(id)"`
	Type              string    `orm:"column(type)"`                // image, chart or other OCI compatible
	MediaType         string    `orm:"column(media_type)"`          // the media type of artifact
	ManifestMediaType string    `orm:"column(manifest_media_type)"` // the media type of manifest/index
	ArtifactType      string    `orm:"colume(artifact_type)"`       // the artifactType of manifest/index
	ProjectID         int64     `orm:"column(project_id)"`          // needed for quota
	RepositoryID      int64     `orm:"column(repository_id)"`
	RepositoryName    string    `orm:"column(repository_name)"`
	Digest            string    `orm:"column(digest)"`
	Size              int64     `orm:"column(size)"`
	Icon              string    `orm:"column(icon)"`
	PushTime          time.Time `orm:"column(push_time)"`
	PullTime          time.Time `orm:"column(pull_time)"`
	ExtraAttrs        string    `orm:"column(extra_attrs)"`             // json string
	Annotations       string    `orm:"column(annotations);type(jsonb)"` // json string
}

Artifact model in database

func (*Artifact) GetDefaultSorts

func (a *Artifact) GetDefaultSorts() []*q.Sort

GetDefaultSorts specifies the default sorts

func (*Artifact) TableName

func (a *Artifact) TableName() string

TableName for artifact

type ArtifactReference

type ArtifactReference struct {
	ID          int64  `orm:"pk;auto;column(id)"`
	ParentID    int64  `orm:"column(parent_id)"`
	ChildID     int64  `orm:"column(child_id)"`
	ChildDigest string `orm:"column(child_digest)"`
	Platform    string `orm:"column(platform)"` // json string
	URLs        string `orm:"column(urls)"`     // json string
	Annotations string `orm:"column(annotations);type(jsonb)"`
}

ArtifactReference records the child artifact referenced by parent artifact

func (*ArtifactReference) TableName

func (a *ArtifactReference) TableName() string

TableName for artifact reference

type DAO

type DAO interface {
	// Count returns the total count of artifacts according to the query
	Count(ctx context.Context, query *q.Query) (total int64, err error)
	// List artifacts according to the query. The artifacts that referenced by others and
	// without tags are not returned
	List(ctx context.Context, query *q.Query) (artifacts []*Artifact, err error)
	// Get the artifact specified by ID
	Get(ctx context.Context, id int64) (*Artifact, error)
	// GetByDigest returns the artifact specified by repository and digest
	GetByDigest(ctx context.Context, repository, digest string) (artifact *Artifact, err error)
	// Create the artifact
	Create(ctx context.Context, artifact *Artifact) (id int64, err error)
	// Delete the artifact specified by ID
	Delete(ctx context.Context, id int64) (err error)
	// Update updates the artifact. Only the properties specified by "props" will be updated if it is set
	Update(ctx context.Context, artifact *Artifact, props ...string) (err error)
	// UpdatePullTime updates artifact pull time by ID.
	UpdatePullTime(ctx context.Context, id int64, pullTime time.Time) (err error)
	// CreateReference creates the artifact reference
	CreateReference(ctx context.Context, reference *ArtifactReference) (id int64, err error)
	// ListReferences lists the artifact references according to the query
	ListReferences(ctx context.Context, query *q.Query) (references []*ArtifactReference, err error)
	// DeleteReference specified by ID
	DeleteReference(ctx context.Context, id int64) (err error)
	// DeleteReferences deletes the references referenced by the artifact specified by parent ID
	DeleteReferences(ctx context.Context, parentID int64) (err error)
	// ListWithLatest ...
	ListWithLatest(ctx context.Context, query *q.Query) (artifacts []*Artifact, err error)
}

DAO is the data access object interface for artifact

func New

func New() DAO

New returns an instance of the default DAO

Jump to

Keyboard shortcuts

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